public DataResult DelDeduction(Deduction inputDeduction) { #region 角色验证 //分社访问 if (LoginUser.Type != 0&& LoginUser.Type != UserType.Branch) { throw new DataOperationPermissions(BusinessResourceMessage.NoPower); } #endregion #region 输入验证 if (!CommonValidator.isInt(inputDeduction.ID.ToString())) throw new DataValidationException(string.Format(BusinessResourceMessage.Inexistent, "扣款类型")); #endregion inputDeduction.UpdaterId = LoginUser.ID; inputDeduction.UpdateTime = DateTime.Now; branchService.DelDeduction(inputDeduction); dataResult.Code = ResponseStatusCode.Success; dataResult.Msg = BusinessResourceMessage.Success; return dataResult; }
public DataResult AddDeduction(Deduction inputDeduction) { #region 角色验证 //分社访问 if (LoginUser.Type != 0&& LoginUser.Type != UserType.Branch) { throw new DataOperationPermissions(BusinessResourceMessage.NoPower); } #endregion #region 输入验证 //判断菜单进入、选择分社配置进入 if (inputDeduction.BranchId == 0) { //验证菜单进入用户是否有打开分社配置权限 if (LoginUser.BranchId != null && LoginUser.Type == UserType.Branch) inputDeduction.BranchId = (int)LoginUser.BranchId; else throw new DataOperationPermissions(BusinessResourceMessage.NoPower); } if (string.IsNullOrEmpty(inputDeduction.Name)) throw new DataValidationException(string.Format(BusinessResourceMessage.ItemCanNotNull, "扣款类型名称")); #endregion DateTime dtNow = DateTime.Now; inputDeduction.CreaterId = LoginUser.ID; inputDeduction.CreateTime = dtNow; inputDeduction.UpdaterId = LoginUser.ID; inputDeduction.UpdateTime = dtNow; branchService.AddDeduction(inputDeduction); dataResult.Code = ResponseStatusCode.Success; dataResult.Msg = BusinessResourceMessage.Success; dataResult.Data = inputDeduction.ID; return dataResult; }