Ejemplo n.º 1
0
        /// <summary>
        /// 更新部門資料
        /// </summary>
        public bool UpdateDepartmentData(DeptParams param)
        {
            bool result = false;

            using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
            {
                Department entity = empAuthDao.GetEmptyEntity <Department>(new DepartmentRequiredPropValues()
                {
                    DeptId   = param.DeptId,
                    DeptName = ""
                });

                entity.DeptName   = param.DeptName;
                entity.SortNo     = param.SortNo;
                entity.MdfAccount = param.PostAccount;
                entity.MdfDate    = DateTime.Now;

                result   = empAuthDao.UpdateDepartmentData(entity);
                dbErrMsg = empAuthDao.GetErrMsg();

                if (!result && empAuthDao.GetSqlErrNumber() == 50000 && empAuthDao.GetSqlErrState() == 2)
                {
                    param.HasDeptNameBeenUsed = true;
                }
            }

            return(result);
        }