コード例 #1
0
        public DataResult DelInvoiceSubject(InvoiceSubject inputInvoiceSubject)
        {
            #region 角色验证
            //分社访问
            if (LoginUser.Type != 0&& LoginUser.Type != UserType.Branch)
            {
                throw new DataOperationPermissions(BusinessResourceMessage.NoPower);
            }
            #endregion

            #region 输入验证
            if (!CommonValidator.isInt(inputInvoiceSubject.ID.ToString()))
                throw new DataValidationException(string.Format(BusinessResourceMessage.Inexistent, "发票科目"));
            #endregion

            inputInvoiceSubject.UpdaterId = LoginUser.ID;
            inputInvoiceSubject.UpdateTime = DateTime.Now;
            branchService.DelInvoiceSubject(inputInvoiceSubject);
            dataResult.Code = ResponseStatusCode.Success;
            dataResult.Msg = BusinessResourceMessage.Success;
            return dataResult;
        }
コード例 #2
0
        public DataResult AddInvoiceSubject(InvoiceSubject inputInvoiceSubject)
        {
            #region 角色验证
            //分社访问
            if (LoginUser.Type != 0&& LoginUser.Type != UserType.Branch)
            {
                throw new DataOperationPermissions(BusinessResourceMessage.NoPower);
            }
            #endregion

            #region 输入验证
            //判断菜单进入、选择分社配置进入
            if (inputInvoiceSubject.BranchId == 0)
            {
                //验证菜单进入用户是否有打开分社配置权限
                if (LoginUser.BranchId != null && LoginUser.Type == UserType.Branch)
                    inputInvoiceSubject.BranchId = (int)LoginUser.BranchId;
                else
                    throw new DataOperationPermissions(BusinessResourceMessage.NoPower);
            }
            if (string.IsNullOrEmpty(inputInvoiceSubject.InvoiceSubjectName))
                throw new DataValidationException(string.Format(BusinessResourceMessage.ItemCanNotNull, "发票科目名称"));
            #endregion

            DateTime dtNow = DateTime.Now;
            inputInvoiceSubject.CreaterId = LoginUser.ID;
            inputInvoiceSubject.CreateTime = dtNow;
            inputInvoiceSubject.UpdaterId = LoginUser.ID;
            inputInvoiceSubject.UpdateTime = dtNow;
            branchService.AddInvoiceSubject(inputInvoiceSubject);
            dataResult.Code = ResponseStatusCode.Success;
            dataResult.Msg = BusinessResourceMessage.Success;
            dataResult.Data = inputInvoiceSubject.ID;
            return dataResult;
        }