Beispiel #1
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="entity">数据实体</param>
 /// <returns>新增记录编号</returns>
 /// <remarks>2013-08-21  朱成果 创建</remarks>
 public override int Insert(SpPromotionOverlay entity)
 {
     entity.SysNo = Context.Insert("SpPromotionOverlay", entity)
                    .AutoMap(o => o.SysNo)
                    .ExecuteReturnLastId <int>("SysNo");
     return(entity.SysNo);
 }
Beispiel #2
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="entity">数据实体</param>
 /// <returns></returns>
 /// <remarks>2013-08-21  朱成果 创建</remarks>
 public override void Update(SpPromotionOverlay entity)
 {
     Context.Update("SpPromotionOverlay", entity)
     .AutoMap(o => o.SysNo)
     .Where("SysNo", entity.SysNo)
     .Execute();
 }
Beispiel #3
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="entity">数据实体</param>
 /// <returns></returns>
 /// <remarks>2013-08-21  朱成果 创建</remarks>
 public abstract void Update(SpPromotionOverlay entity);
Beispiel #4
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="entity">数据实体</param>
 /// <returns>新增记录编号</returns>
 /// <remarks>2013-08-21  朱成果 创建</remarks>
 public abstract int Insert(SpPromotionOverlay entity);
Beispiel #5
0
        /// <summary>
        /// 审核促销
        /// </summary>
        /// <param name="cbSpPromotion">促销参数实体</param>
        /// <param name="user">操作人</param>
        /// <returns>操作是否成功</returns>
        /// <remarks>2013-08-26 余勇 创建</remarks>
        public Result Audit(CBSpPromotion cbSpPromotion, SyUser user)
        {
            SpPromotion model = cbSpPromotion.Promotion;
            var         res   = new Result();

            if (model.SysNo > 0)
            {
                #region 修改
                var upModel = ISpPromotionDao.Instance.Get(model.SysNo);
                upModel.Name                  = model.Name;
                upModel.Description           = model.Description;
                upModel.DisplayPrefix         = model.DisplayPrefix;
                upModel.SubjectUrl            = model.SubjectUrl;
                upModel.PromotionType         = model.PromotionType;
                upModel.WebPlatform           = model.WebPlatform; //2014-01-07 朱家宏 添加
                upModel.ShopPlatform          = model.ShopPlatform;
                upModel.MallAppPlatform       = model.MallAppPlatform;
                upModel.LogisticsAppPlatform  = model.LogisticsAppPlatform;       //2014-02-26 黄志勇 添加
                upModel.StartTime             = model.StartTime;
                upModel.EndTime               = model.EndTime;
                upModel.PromotionCode         = model.PromotionCode;
                upModel.IsUsePromotionCode    = model.IsUsePromotionCode;
                upModel.PromotionUseQuantity  = model.PromotionUseQuantity;
                upModel.PromotionUsedQuantity = model.PromotionUsedQuantity;
                upModel.UserUseQuantity       = model.UserUseQuantity;
                upModel.Priority              = model.Priority;
                upModel.Status                = (int)PromotionStatus.促销状态.已审;
                upModel.AuditorSysNo          = user.SysNo;
                upModel.AuditDate             = DateTime.Now;
                upModel.LastUpdateBy          = user.SysNo;
                upModel.LastUpdateDate        = DateTime.Now;
                ISpPromotionDao.Instance.Update(upModel); //修改
                if (model.SysNo > 0)                      //添加子表
                {
                    ISpPromotionGiftDao.Instance.DeleteByPromotionSysNo(model.SysNo);
                    ISpPromotionOverlayDao.Instance.DeleteByPromotionSysNo(model.SysNo);
                    ISpPromotionRuleKeyValueDao.Instance.DeleteByPromotionSysNo(model.SysNo);
                    ISpPromotionRuleConditionDao.Instance.DeleteByPromotionSysNo(model.SysNo);
                    if (cbSpPromotion.PromotionGifts != null)
                    {
                        foreach (var item in cbSpPromotion.PromotionGifts)
                        {
                            item.PromotionSysNo = model.SysNo;
                            ISpPromotionGiftDao.Instance.Insert(item);
                        }
                    }
                    if (cbSpPromotion.PromotionOverlays != null)
                    {
                        foreach (var item in cbSpPromotion.PromotionOverlays)
                        {
                            var m = new SpPromotionOverlay {
                                OverlayCode = model.SysNo, PromotionSysNo = item
                            };
                            ISpPromotionOverlayDao.Instance.Insert(m);
                        }
                        ISpPromotionOverlayDao.Instance.Insert(new SpPromotionOverlay {
                            OverlayCode = model.SysNo, PromotionSysNo = model.SysNo
                        });
                    }
                    if (cbSpPromotion.PromotionRuleKeyValues != null)
                    {
                        foreach (var item in cbSpPromotion.PromotionRuleKeyValues)
                        {
                            if (item.RuleValue != null && item.RuleValue.EndsWith(";"))
                            {
                                item.RuleValue = item.RuleValue.TrimEnd(';');
                            }
                            item.PromotionSysNo = model.SysNo;
                            ISpPromotionRuleKeyValueDao.Instance.Insert(item);
                        }
                    }
                    if (cbSpPromotion.PromotionRule != null)
                    {
                        cbSpPromotion.PromotionRule.LastUpdateBy   = user.SysNo;
                        cbSpPromotion.PromotionRule.LastUpdateDate = DateTime.Now;
                        var ruleCondition = new SpPromotionRuleCondition
                        {
                            PromotionSysNo     = model.SysNo,
                            PromotionRuleSysNo = cbSpPromotion.PromotionRule.SysNo
                        };
                        ISpPromotionRuleConditionDao.Instance.Insert(ruleCondition);
                    }
                    res.Status = true;
                }
                #endregion
            }
            return(res);
        }