/// <summary> /// 新增部門資料 /// </summary> public bool InsertDepartmentData(DeptParams param) { InsertResult insResult = new InsertResult() { IsSuccess = false }; using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess()) { Department entity = new Department() { DeptName = param.DeptName, SortNo = param.SortNo, PostAccount = param.PostAccount, PostDate = DateTime.Now }; insResult = empAuthDao.InsertDepartmentData(entity); dbErrMsg = empAuthDao.GetErrMsg(); if (insResult.IsSuccess) { param.DeptId = (int)insResult.NewId; } else if (empAuthDao.GetSqlErrNumber() == 50000 && empAuthDao.GetSqlErrState() == 2) { param.HasDeptNameBeenUsed = true; } } return(insResult.IsSuccess); }