コード例 #1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            this.btnNext.Enabled = false;
            PromotionInfo promotion = this.promotionView.Promotion;

            if (promotion.MemberGradeIds.Count <= 0)
            {
                this.btnNext.Enabled = true;
                this.ShowMsg("必须选择一个适合的客户", false);
            }
            else if (promotion.StartDate.CompareTo(promotion.EndDate) > 0)
            {
                this.btnNext.Enabled = true;
                this.ShowMsg("开始日期应该小于结束日期", false);
            }
            else
            {
                promotion.GiftIds     = this.hidSelectGiftId.Value;
                promotion.PromoteType = (PromoteType)int.Parse(this.txtPromoteType.Text);
                decimal num           = default(decimal);
                decimal discountValue = default(decimal);
                decimal.TryParse(this.txtCondition.Text.Trim(), out num);
                decimal.TryParse(this.txtDiscountValue.Text.Trim(), out discountValue);
                promotion.Condition     = num;
                promotion.DiscountValue = discountValue;
                if (promotion.PromoteType == PromoteType.QuantityDiscount && num < decimal.One)
                {
                    this.ShowMsg("单品批发的数量必须大于1", false);
                }
                else
                {
                    int num2 = PromoteHelper.AddPromotion(promotion, this.IsMobileExclusive);
                    switch (num2)
                    {
                    case -1:
                        this.btnNext.Enabled = true;
                        this.ShowMsg("添加促销活动失败,可能是信填写有误,请重试", false);
                        break;

                    case -2:
                        this.btnNext.Enabled = true;
                        this.ShowMsg("添加促销活动失败,可能是选择的会员等级已经被删除,请重试", false);
                        break;

                    case 0:
                        this.btnNext.Enabled = true;
                        this.ShowMsg("添加促销活动失败,请重试", false);
                        break;

                    default:
                        base.Response.Redirect(Globals.GetAdminAbsolutePath("/promotion/SetPromotionProducts.aspx?ActivityId=" + num2 + "&isWholesale=" + this.isWholesale.ToString() + "&IsMobileExclusive=" + this.IsMobileExclusive.ToString()), true);
                        break;
                    }
                }
            }
        }
コード例 #2
0
        private void btnNext_Click(object sender, System.EventArgs e)
        {
            PromotionInfo promotion = this.promotionView.Promotion;

            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);
            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    = UserHelper.GetAssociatedSupplierId(HiContext.Current.User.UserId);
            int num = PromoteHelper.AddPromotion(promotion);

            if (num == -1)
            {
                this.ShowMsg("添加促销活动失败,可能是信填写有误,请重试", false);
                return;
            }
            if (num == -2)
            {
                this.ShowMsg("添加促销活动失败,可能是选择的会员等级已经被删除,请重试", false);
                return;
            }
            if (num == 0)
            {
                this.ShowMsg("添加促销活动失败,请重试", false);
                return;
            }
            base.Response.Redirect(Globals.GetAdminAbsolutePath(string.Concat(new object[]
            {
                "/Supplier/SupplierSetPromotionProducts.aspx?ActivityId=",
                num,
                "&isWholesale=",
                this.isWholesale,
                "&supplierId=", promotion.SupplierId
            })), true);
        }
コード例 #3
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            PromotionInfo promotion = this.promotionView.Promotion;

            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);
            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;
            int num = PromoteHelper.AddPromotion(promotion);

            if (num == -1)
            {
                this.ShowMsg("添加促销活动失败,可能是信填写有误,请重试", false);
                return;
            }
            if (num == -2)
            {
                this.ShowMsg("添加促销活动失败,可能是选择的会员等级已经被删除,请重试", false);
                return;
            }
            if (num == 0)
            {
                this.ShowMsg("添加促销活动失败,请重试", false);
                return;
            }
            if (this.isWholesale)
            {
                base.Response.Redirect(Globals.GetAdminAbsolutePath("/promotion/OrderPromotions.aspx?isWholesale=true"), true);
                return;
            }
            base.Response.Redirect(Globals.GetAdminAbsolutePath("/promotion/OrderPromotions.aspx"), true);
        }
コード例 #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            PromotionInfo promotion = this.promotionView.Promotion;

            if (promotion.MemberGradeIds.Count <= 0)
            {
                this.ShowMsg("必须选择一个适合的客户", false);
            }
            else if (promotion.StartDate.CompareTo(promotion.EndDate) > 0)
            {
                this.ShowMsg("开始日期应该小于结束日期", false);
            }
            else
            {
                promotion.PromoteType = (PromoteType)int.Parse(this.txtPromoteType.Text);
                decimal result = 0M;
                decimal num2   = 0M;
                decimal.TryParse(this.txtCondition.Text.Trim(), out result);
                decimal.TryParse(this.txtDiscountValue.Text.Trim(), out num2);
                promotion.Condition     = result;
                promotion.DiscountValue = num2;
                switch (PromoteHelper.AddPromotion(promotion))
                {
                case -1:
                    this.ShowMsg("添加促销活动失败,可能是信填写有误,请重试", false);
                    return;

                case -2:
                    this.ShowMsg("添加促销活动失败,可能是选择的会员等级已经被删除,请重试", false);
                    return;

                case 0:
                    this.ShowMsg("添加促销活动失败,请重试", false);
                    return;
                }
                if (this.isWholesale)
                {
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("/promotion/OrderPromotions.aspx?isWholesale=true"), true);
                }
                else
                {
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("/promotion/OrderPromotions.aspx"), true);
                }
            }
        }
コード例 #5
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            PromotionInfo promotion = this.promotionView.Promotion;

            if (promotion.MemberGradeIds.Count <= 0)
            {
                this.ShowMsg("必须选择一个适合的客户", false);
            }
            else if (promotion.StartDate.CompareTo(promotion.EndDate) > 0)
            {
                this.ShowMsg("开始日期应该小于结束日期", false);
            }
            else
            {
                promotion.PromoteType = (PromoteType)int.Parse(this.txtPromoteType.Text);
                decimal result = 0M;
                decimal num2   = 0M;
                decimal.TryParse(this.txtCondition.Text.Trim(), out result);
                decimal.TryParse(this.txtDiscountValue.Text.Trim(), out num2);
                promotion.Condition     = result;
                promotion.DiscountValue = num2;
                int num3 = PromoteHelper.AddPromotion(promotion);
                switch (num3)
                {
                case -1:
                    this.ShowMsg("添加促销活动失败,可能是信填写有误,请重试", false);
                    return;

                case -2:
                    this.ShowMsg("添加促销活动失败,可能是选择的会员等级已经被删除,请重试", false);
                    return;

                case 0:
                    this.ShowMsg("添加促销活动失败,请重试", false);
                    return;
                }
                base.Response.Redirect(Globals.GetAdminAbsolutePath(string.Concat(new object[] { "/promotion/SetPromotionProducts.aspx?ActivityId=", num3, "&isWholesale=", this.isWholesale })), true);
            }
        }
コード例 #6
0
        private void btnAddFeeFree_Click(object sender, EventArgs e)
        {
            decimal num;
            string  str = string.Empty;

            if (ValidateValues(out num))
            {
                if (!((chkShipChargeFee.Checked || chkServiceChargeFree.Checked) || chkPackingChargeFree.Checked))
                {
                    str = str + Formatter.FormatErrorMessage("请选择此促销活动要免除的订单费用");
                }
                if (chklMemberGrade.SelectedValue.Count <= 0)
                {
                    str = str + Formatter.FormatErrorMessage("适合的客户必须选择一个");
                }
                if (!addpromoteSales.IsValid)
                {
                    ShowMsg(addpromoteSales.CurrentErrors, false);
                }
                else
                {
                    FullFreeInfo info2 = new FullFreeInfo();
                    info2.Name              = addpromoteSales.Item.Name;
                    info2.Description       = addpromoteSales.Item.Description;
                    info2.Amount            = num;
                    info2.ShipChargeFree    = chkShipChargeFee.Checked;
                    info2.OptionFeeFree     = chkPackingChargeFree.Checked;
                    info2.ServiceChargeFree = chkServiceChargeFree.Checked;
                    info2.MemberGradeIds    = chklMemberGrade.SelectedValue;
                    FullFreeInfo      target  = info2;
                    ValidationResults results = Hishop.Components.Validation.Validation.Validate <FullFreeInfo>(target, new string[] { "ValPromotion" });
                    if (!results.IsValid)
                    {
                        foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                        {
                            str = str + Formatter.FormatErrorMessage(result.Message);
                        }
                    }
                    if (!string.IsNullOrEmpty(str))
                    {
                        ShowMsg(str, false);
                    }
                    else
                    {
                        switch (PromoteHelper.AddPromotion(target))
                        {
                        case PromotionActionStatus.Success:
                            txtAmount.Text               = string.Empty;
                            chkShipChargeFee.Checked     = false;
                            chkPackingChargeFree.Checked = false;
                            chkServiceChargeFree.Checked = false;
                            addpromoteSales.Reset();
                            ShowMsg("成功添加了一个满额免费用促销活动", true);
                            return;

                        case PromotionActionStatus.DuplicateName:
                            ShowMsg("添加促销活动失败,存在相同的促销活动名称", false);
                            return;

                        case PromotionActionStatus.SameCondition:
                            ShowMsg("已经存在相同满足条件的优惠活动", false);
                            return;
                        }
                        txtAmount.Text               = string.Empty;
                        chkShipChargeFee.Checked     = false;
                        chkPackingChargeFree.Checked = false;
                        chkServiceChargeFree.Checked = false;
                        addpromoteSales.Reset();
                        ShowMsg("添加促销活动失败", false);
                    }
                }
            }
        }
コード例 #7
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            int    num;
            int    num2;
            string str = string.Empty;

            if (ValidateValues(out num, out num2))
            {
                if (!addpromoteSales.IsValid)
                {
                    ShowMsg(addpromoteSales.CurrentErrors, false);
                }
                else
                {
                    PurchaseGiftInfo target = new PurchaseGiftInfo();
                    target.Name           = addpromoteSales.Item.Name;
                    target.Description    = addpromoteSales.Item.Description;
                    target.MemberGradeIds = chklMemberGrade.SelectedValue;
                    target.BuyQuantity    = num;
                    target.GiveQuantity   = num2;
                    if (target.GiveQuantity > target.BuyQuantity)
                    {
                        str = Formatter.FormatErrorMessage("赠送数量不能大于购买数量");
                    }
                    if (chklMemberGrade.SelectedValue.Count <= 0)
                    {
                        str = str + Formatter.FormatErrorMessage("适合的客户必须选择一个");
                    }
                    ValidationResults results = Hishop.Components.Validation.Validation.Validate <PurchaseGiftInfo>(target, new string[] { "ValPromotion" });
                    if (!results.IsValid)
                    {
                        foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                        {
                            str = str + Formatter.FormatErrorMessage(result.Message);
                        }
                    }
                    if (!string.IsNullOrEmpty(str))
                    {
                        ShowMsg(str, false);
                    }
                    else
                    {
                        switch (PromoteHelper.AddPromotion(target))
                        {
                        case PromotionActionStatus.Success:
                        {
                            int activeIdByPromotionName = PromoteHelper.GetActiveIdByPromotionName(target.Name);
                            base.Response.Redirect(Globals.GetAdminAbsolutePath("/promotion/PromotionProducts.aspx?ActiveId=" + activeIdByPromotionName), true);
                            return;
                        }

                        case PromotionActionStatus.DuplicateName:
                            ShowMsg("已存在此名称的促销活动", false);
                            return;

                        case PromotionActionStatus.SameCondition:
                            ShowMsg("已经存在相同满足条件的优惠活动", false);
                            return;
                        }
                        ShowMsg("添加促销活动--买几送几错误", false);
                    }
                }
            }
        }
コード例 #8
0
ファイル: AddDiscount.aspx.cs プロジェクト: yuelinsoft/himedi
        private void btnAddDiscount_Click(object sender, EventArgs e)
        {
            decimal num;
            decimal num2;
            int     num3;
            string  str = string.Empty;

            if (ValidateValues(out num, out num2, out num3))
            {
                DiscountValueType selectedValue = radioValueType.SelectedValue;
                if (!addpromoteSales.IsValid)
                {
                    ShowMsg(addpromoteSales.CurrentErrors, false);
                }
                else
                {
                    FullDiscountInfo target = new FullDiscountInfo();
                    target.Name        = addpromoteSales.Item.Name;
                    target.Description = addpromoteSales.Item.Description;
                    target.Amount      = num;
                    switch (selectedValue)
                    {
                    case DiscountValueType.Amount:
                        target.DiscountValue = num2;
                        break;

                    case DiscountValueType.Percent:
                        target.DiscountValue = num3;
                        break;
                    }
                    target.ValueType      = selectedValue;
                    target.MemberGradeIds = chklMemberGrade.SelectedValue;
                    if (chklMemberGrade.SelectedValue.Count <= 0)
                    {
                        str = str + Formatter.FormatErrorMessage("适合的客户必须选择一个");
                    }
                    ValidationResults results = Hishop.Components.Validation.Validation.Validate <FullDiscountInfo>(target, new string[] { "ValPromotion" });
                    if (!results.IsValid)
                    {
                        foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                        {
                            str = str + Formatter.FormatErrorMessage(result.Message);
                        }
                    }
                    if (!string.IsNullOrEmpty(str))
                    {
                        ShowMsg(str, false);
                    }
                    else
                    {
                        PromotionActionStatus status = PromoteHelper.AddPromotion(target);
                        switch (status)
                        {
                        case PromotionActionStatus.Success:
                            txtAmount.Text        = string.Empty;
                            txtDiscountValue.Text = string.Empty;
                            addpromoteSales.Reset();
                            ShowMsg("成功添加了促销活动--满额打折", true);
                            return;

                        case PromotionActionStatus.DuplicateName:
                            ShowMsg("已存在此名称的促销活动", false);
                            return;
                        }
                        if (status == PromotionActionStatus.SameCondition)
                        {
                            ShowMsg("已经存在相同满足条件的优惠活动", false);
                        }
                        else
                        {
                            txtAmount.Text        = string.Empty;
                            txtDiscountValue.Text = string.Empty;
                            addpromoteSales.Reset();
                            ShowMsg("添加促销活动--满额打折错误", false);
                        }
                    }
                }
            }
        }
コード例 #9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            PromotionInfo promotion = this.promotionView.Promotion;

            if (promotion.MemberGradeIds.Count <= 0)
            {
                this.ShowMsg("必须选择一个适合的客户", false);
            }
            else if (promotion.StartDate.CompareTo(promotion.EndDate) > 0)
            {
                this.ShowMsg("开始日期应该小于结束日期", false);
            }
            else
            {
                promotion.PromoteType = (PromoteType)int.Parse(this.txtPromoteType.Text);
                decimal condition     = default(decimal);
                decimal discountValue = default(decimal);
                decimal.TryParse(this.txtCondition.Text.Trim(), out condition);
                decimal.TryParse(this.txtDiscountValue.Text.Trim(), out discountValue);
                promotion.Condition     = condition;
                promotion.DiscountValue = discountValue;
                promotion.GiftIds       = this.hidSelectGiftId.Value;
                if (SettingsManager.GetMasterSettings().OpenMultStore&& string.IsNullOrEmpty(base.Request.QueryString["isWholesale"]))
                {
                    if (string.IsNullOrEmpty(this.hidStoreIds.Value))
                    {
                        this.ShowMsg("请选择门店范围", false);
                        return;
                    }
                    promotion.StoreType = 2;
                    promotion.StoreIds  = this.hidStoreIds.Value;
                }
                else
                {
                    promotion.StoreType = 0;
                }
                switch (PromoteHelper.AddPromotion(promotion, false))
                {
                case -1:
                    this.ShowMsg("添加促销活动失败,可能是信填写有误,请重试", false);
                    break;

                case -2:
                    this.ShowMsg("添加促销活动失败,可能是选择的会员等级已经被删除,请重试", false);
                    break;

                case 0:
                    this.ShowMsg("添加促销活动失败,请重试", false);
                    break;

                default:
                    if (this.isWholesale)
                    {
                        base.Response.Redirect(Globals.GetAdminAbsolutePath("/promotion/OrderPromotions.aspx?isWholesale=true"), true);
                    }
                    else
                    {
                        base.Response.Redirect(Globals.GetAdminAbsolutePath("/promotion/OrderPromotions.aspx"), true);
                    }
                    break;
                }
            }
        }