예제 #1
0
        private void btnNext_Click(object sender, System.EventArgs e)
        {
            PromotionInfo promotion = this.promotionView.Promotion;

            promotion.ActivityId = this.activityId;
            if (PromoteHelper.GetActivityProductAmount(promotion.ActivityId) > 0)
            {
                this.ShowMsg("已经添加促销商品的活动不可以修改,请先删除促销商品", false);
                return;
            }
            if (promotion.MemberGradeIds.Count <= 0)
            {
                this.ShowMsg("必须选择一个适合的客户", false);
                return;
            }
            if (promotion.StartDate.CompareTo(promotion.EndDate) > 0)
            {
                this.ShowMsg("开始日期应该小于结束日期", false);
                return;
            }
            promotion.PromoteType = (PromoteType)int.Parse(this.txtPromoteType.Text);
            if (promotion.PromoteType == PromoteType.QuantityDiscount)
            {
                this.radPromoteType.IsWholesale = true;
            }
            decimal condition     = 0m;
            decimal discountValue = 0m;

            decimal.TryParse(this.txtCondition.Text.Trim(), out condition);
            decimal.TryParse(this.txtDiscountValue.Text.Trim(), out discountValue);
            promotion.Condition     = condition;
            promotion.DiscountValue = discountValue;
            //promotion.SupplierId = HiContext.Current.User.UserId;
            int num = PromoteHelper.EditPromotion(promotion);

            if (num == -1)
            {
                this.ShowMsg("编辑促销活动失败,可能是信填写有误,请重试", false);
                return;
            }
            if (num == -2)
            {
                this.ShowMsg("编辑促销活动失败,可能是选择的会员等级已经被删除,请重试", false);
                return;
            }
            if (num == 0)
            {
                this.ShowMsg("编辑促销活动失败,请重试", false);
                return;
            }
            this.ShowMsg("编辑促销活动成功", true);
        }