// 呼叫service, 將資料更新至資料庫 public Boolean editPayway() { this._salaryService = new SalaryService(this._salaryModel); if (_salaryService.EditPayway()) MessageBox.Show("修改成功"); else { MessageBox.Show("修改失敗"); return false; } return true; }
// 取得該員工薪水支付方式 private List<String> GetEmplSalaryPayWay(String emplID) { List<String> salaryPayWayData = new List<String>(); SalaryModel salaryModel = new SalaryModel(); salaryModel.setEmplID(emplID); SalaryService salaryService = new SalaryService(salaryModel); salaryModel = salaryService.searchByEmplID(); salaryPayWayData.Add(salaryModel.getPayway()); salaryPayWayData.Add(salaryModel.getAccountData()); return salaryPayWayData; }
// 呼叫service將資料新增至資料庫 public void AddPayway() { this._salaryService = new SalaryService(_salaryModel); //SalaryPresentationModel salaryPresentationModel = new SalaryPresentationModel(); int errorFlag = 0; if(this._salaryModel.getEmplID() == "" ||(this._salaryModel.getPayway() == "Transfer" && this._salaryModel.getAccountData() =="")) { MessageBox.Show("尚有重要資料欄位為空白, 請重新確認"); errorFlag = 1; } if (errorFlag == 1) return; if (_salaryService.addPayway()) MessageBox.Show("新增成功!"); else MessageBox.Show("資料庫內已有該員工支付資料"); }
// 以員工ID搜尋支付資料 public SalaryPresentationModel SearchDataByEmplID() { SalaryPresentationModel salaryPresentationModel = new SalaryPresentationModel(); if (this._salaryModel.getEmplID() == null || this._salaryModel.getEmplID() == "") MessageBox.Show("請輸入員工ID"); else { //MessageBox.Show("yes"); _salaryService = new SalaryService(this._salaryModel); _salaryModel = _salaryService.searchByEmplID(); salaryPresentationModel.setEmplID(_salaryModel.getEmplID()); salaryPresentationModel.setPayway(_salaryModel.getPayway()); salaryPresentationModel.setAccountData(_salaryModel.getAccountData()); if (_salaryModel.getPayway() == null || _salaryModel.getPayway() == "") { MessageBox.Show("此員工ID不存在!"); //MessageBox.Show(_authoModel.GetAuthoID()); salaryPresentationModel.setEmplID(null); } } return salaryPresentationModel; }