Exemplo n.º 1
0
        /// <summary>
        /// 描述:修改一个审核中的优惠
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-10-29</para>
        /// </summary>
        /// <param name="autCouponRuleId">赠与奖学金审核表Id</param>
        /// <param name="dto">要修改的赠与奖学金信息</param
        /// <returns>无</returns>
        /// <exception cref="AMS.Core.BussinessException">
        /// 异常ID:1, 异常描述:该奖学金信息不存在
        /// </exception>
        public void Modify(long autCouponRuleId, CouponRuleDetailRequest dto)
        {
            var auditModel = _tblAutCouponRuleRepository.Load(x => x.AutCouponRuleId == autCouponRuleId);

            if (auditModel == null)
            {
                throw new BussinessException(ModelType.Discount, 1);
            }
            var model = Mapper.Map(dto, auditModel);

            _tblAutCouponRuleRepository.Update(model);
        }
        public void Post(CouponRuleDetailRequest request)
        {
            var result = new CouponRuleAuditService(base.SchoolId);

            result.Add(request);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 描述:添加一个审核中的优惠设置
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-10-29</para>
        /// </summary>
        /// <param name="dto">要添加的赠与奖学金信息</param>
        /// <returns>无</returns>
        public void Add(CouponRuleDetailRequest dto)
        {
            //1、确定当前校区是否存在正在审核的赠与奖学金设置
            if (base.TblAutAudit != null && base.TblAutAudit.AuditStatus == (int)AuditStatus.Auditing)   //当前单据在审核中,不允许添加
            {
                throw new BussinessException(ModelType.Discount, 2);
            }

            //2、确定当前校区是否存在被退回或未提交的赠与奖学金设置
            //2.1向审核主表添加数据
            long auditId = 0;

            if (base.TblAutAudit == null || base.TblAutAudit.AuditStatus == (int)AuditStatus.Return || base.TblAutAudit.AuditStatus == (int)AuditStatus.Success)
            {
                if (dto.CouponType == CouponType.Recommend)
                {
                    ValidationCouponRule(dto.BeginDate, dto.EndDate);   //验证正式表是否已存在转介绍优惠
                }

                var auditModel = new TblAutAudit()
                {
                    AuditId        = IdGenerator.NextId(),
                    SchoolId       = this._schoolId,
                    BizType        = (int)AuditBusinessType.ScholarshipGive,
                    ExtField1      = _schoolId,
                    ExtField2      = string.Empty,
                    FlowNo         = string.Empty,
                    AuditStatus    = (int)AuditStatus.WaitAudit,
                    AuditUserId    = string.Empty,
                    AuditUserName  = string.Empty,
                    AuditDate      = DateTime.Now,
                    CreateUserId   = "",
                    CreateUserName = "",
                    DataExt        = string.Empty,
                    DataExtVersion = string.Empty,
                    CreateTime     = DateTime.Now,
                    UpdateTime     = DateTime.Now
                };
                auditId = auditModel.AuditId;
                _tblAutAuditRepository.Add(auditModel);
            }
            else if (base.TblAutAudit.AuditStatus == (int)AuditStatus.WaitAudit)
            {
                if (dto.CouponType == CouponType.Recommend)
                {
                    //验证正式表是否已存在转介绍优惠
                    ValidationCouponRule(dto.BeginDate, dto.EndDate);
                    //验证临时表是否已存在转介绍优惠
                    ValidationAuditCouponRule(dto.BeginDate, dto.EndDate);
                }

                auditId = base.TblAutAudit.AuditId;
            }

            //2.2向赠与奖学金审核子表添加数据
            var couponRuleModel = Mapper.Map <TblAutCouponRule>(dto);

            couponRuleModel.AutCouponRuleId = IdGenerator.NextId();  //审核子表主键
            couponRuleModel.AuditId         = auditId;               //审核主表Id
            couponRuleModel.CouponRuleId    = IdGenerator.NextId();  //奖学金正式表Id
            couponRuleModel.CreateTime      = DateTime.Now;
            couponRuleModel.SchoolId        = this._schoolId;

            _tblAutCouponRuleRepository.Add(couponRuleModel);
        }
        public void Put(long autCouponRuleId, CouponRuleDetailRequest request)
        {
            var result = new CouponRuleAuditService(base.SchoolId);

            result.Modify(autCouponRuleId, request);
        }