// 呼叫service利用departmentID查詢dept資料 public DepartmentPresentationModel SearchDepartmentByID() { DepartmentPresentationModel deptPresentModel = new DepartmentPresentationModel(); if (this._deptModel.GetDepartmentID() == null || _deptModel.GetDepartmentID() == "") MessageBox.Show("請輸入部門ID"); else { _deptService = new DepartmentService(this._deptModel); _deptModel = _deptService.searchByDeptID(); deptPresentModel.setDepartmentID(_deptModel.GetDepartmentID()); deptPresentModel.setDepartmentName(_deptModel.GetDepartmentName()); deptPresentModel.setDepartmentStartTime(_deptModel.GetDepartmentStartTime()); deptPresentModel.setDepartmentEndTime(_deptModel.GetDepartmentEndTime()); deptPresentModel.setDepartmentManager(_deptModel.GetDepartmentManager()); if(_deptModel.GetDepartmentName() == null || _deptModel.GetDepartmentName() == "") { MessageBox.Show("此部門ID不存在!"); deptPresentModel.setDepartmentID(null); } } return deptPresentModel; }
// 建構子 public DepartmentService(DepartmentModel departmentModel) { this._deptModel = departmentModel; }
public void Initialize() { _department = new DepartmentModel(); _target = new PrivateObject(_department); }