// 呼叫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 void TestDepartmentName() { _department.SetDepartmentName("testdepName"); Assert.AreEqual("testdepName", _department.GetDepartmentName()); }