// 建構子 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; }