// 建構子 public WorkAttendanController(WorkAttendancePresentationModel waPresentationModel) { this._workAttendanceModel.SetWAEmplID(waPresentationModel.GetWAEmplID()); this._workAttendanceModel.SetWADate(waPresentationModel.GetWADate()); this._workAttendanceModel.SetWAStatus(waPresentationModel.GetWAStatus()); String waStatus = this._workAttendanceModel.GetWAStatus(); if (!(waStatus == "無故未到" || waStatus == "病假" || waStatus == "婚假" || waStatus == "產假" || waStatus == "休假")) { this._workAttendanceModel.SetStartTime(waPresentationModel.GetStartTime()); this._workAttendanceModel.SetEndTime(waPresentationModel.GetEndTime()); } this._workAttendanceModel.SetIsOvertime(waPresentationModel.GetIsOvertime()); if (this._workAttendanceModel.GetIsOvertime()) { this._workAttendanceModel.SetStartOvertime(waPresentationModel.GetStartOvertime()); this._workAttendanceModel.SetEndOvertime(waPresentationModel.GetEndOvertime()); } }
//呼叫service 利用員工ID與日期查詢work attendance資料 public WorkAttendancePresentationModel SearchDataByEmplIDAndDate() { WorkAttendancePresentationModel waPresentationModel = new WorkAttendancePresentationModel(); if (this._workAttendanceModel.GetWAEmplID() == null || this._workAttendanceModel.GetWAEmplID() == "") MessageBox.Show("請輸入員工ID"); else { this._waService = new WorkAttendanceService(_workAttendanceModel); this._workAttendanceModel = this._waService.SearchWAByEmplIDAndDate(); waPresentationModel.SetWAEmplID(this._workAttendanceModel.GetWAEmplID()); waPresentationModel.SetWADate(this._workAttendanceModel.GetWADate()); waPresentationModel.SetWAStatus(this._workAttendanceModel.GetWAStatus()); waPresentationModel.SetStartTime(this._workAttendanceModel.GetStartTime()); waPresentationModel.SetEndTime(this._workAttendanceModel.GetStartTime()); waPresentationModel.SetIsOvertime(this._workAttendanceModel.GetIsOvertime()); waPresentationModel.SetStartOvertime(this._workAttendanceModel.GetStartOvertime()); waPresentationModel.SetEndOvertime(this._workAttendanceModel.GetEndOvertime()); if (waPresentationModel.GetWAStatus() == null || waPresentationModel.GetWAStatus() == "") { MessageBox.Show("該筆考勤紀錄不存在!"); waPresentationModel.SetWAEmplID(null); } } return waPresentationModel; }
// 按下搜尋work attendance private void ClickSearchWAButton(object sender, EventArgs e) { String emplID = _editWAEmplIDTB.Text; DateTime date = _editWADateDTP.Value; _waPresentationModel.SetWAEmplID(emplID); _waPresentationModel.SetWADate(date); _waController = new WorkAttendanController(_waPresentationModel); _waPresentationModel = _waController.SearchDataByEmplIDAndDate(); if (_waPresentationModel.GetWAEmplID() == null || _waPresentationModel.GetWAEmplID() == "") return; this.ResetAllEditWAUI(); }