Пример #1
0
 private void btn_Submint(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
     {
         this.ShowMsg("名称不能为空", false);
     }
     else
     {
         decimal result = 0M;
         int     num2   = 0;
         decimal num3   = 0M;
         int     num4   = 0;
         decimal num5   = 0M;
         RedPagerActivityInfo redpaperactivity = new RedPagerActivityInfo();
         if (this.redpaperactivityid > 0)
         {
             redpaperactivity = RedPagerActivityBrower.GetRedPagerActivityInfo(this.redpaperactivityid);
         }
         if (redpaperactivity != null)
         {
             redpaperactivity.Name       = this.txtName.Text.Trim();
             redpaperactivity.CategoryId = int.Parse(this.ddlCategoryId.SelectedValue);
             decimal.TryParse(this.txtMinOrderAmount.Text.Trim(), out result);
             int.TryParse(this.txtMaxGetTimes.Text.Trim(), out num2);
             decimal.TryParse(this.txtItemAmountLimit.Text.Trim(), out num3);
             int.TryParse(this.txtExpiryDays.Text.Trim(), out num4);
             decimal.TryParse(this.txtOrderAmountCanUse.Text.Trim(), out num5);
             redpaperactivity.MinOrderAmount    = result;
             redpaperactivity.MaxGetTimes       = num2;
             redpaperactivity.ItemAmountLimit   = num3;
             redpaperactivity.ExpiryDays        = num4;
             redpaperactivity.OrderAmountCanUse = num5;
             if (RedPagerActivityBrower.IsExistsMinOrderAmount(redpaperactivity.RedPagerActivityId, redpaperactivity.MinOrderAmount))
             {
                 this.ShowMsg("已存在相同金额的代金券活动", false);
             }
             else if (this.redpaperactivityid > 0)
             {
                 if (RedPagerActivityBrower.UpdateRedPagerActivity(redpaperactivity))
                 {
                     if (base.Request.QueryString["reurl"] != null)
                     {
                         this.ReUrl = base.Request.QueryString["reurl"].ToString();
                     }
                     this.ShowMsgAndReUrl("代金券活动修改成功", true, this.ReUrl);
                 }
                 else
                 {
                     this.ShowMsg("代金券活动修改失败", false);
                 }
             }
             else if (RedPagerActivityBrower.CreateRedPagerActivity(redpaperactivity))
             {
                 this.ShowMsgAndReUrl("代金券活动新增成功", true, this.ReUrl);
             }
             else
             {
                 this.ShowMsg("代金券活动新增失败", false);
             }
         }
         else
         {
             this.ShowMsg("代金券活动不存在!", false);
         }
     }
 }
Пример #2
0
        private void btnSubmit_Click(object obj, EventArgs eventArg)
        {
            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                this.ShowMsg("名称不能为空", false);
                return;
            }
            decimal num  = new decimal(0);
            int     num1 = 0;
            decimal num2 = new decimal(0);
            int     num3 = 0;
            decimal num4 = new decimal(0);
            RedPagerActivityInfo redPagerActivityInfo = new RedPagerActivityInfo();

            if (this.m_redpaperactivityid > 0)
            {
                redPagerActivityInfo = RedPagerActivityBrower.GetRedPagerActivityInfo(this.m_redpaperactivityid);
            }
            if (redPagerActivityInfo == null)
            {
                this.ShowMsg("代金券活动不存在!", false);
                return;
            }
            redPagerActivityInfo.Name       = this.txtName.Text.Trim();
            redPagerActivityInfo.CategoryId = int.Parse(this.ddlCategoryId.SelectedValue);
            decimal.TryParse(this.txtMinOrderAmount.Text.Trim(), out num);
            int.TryParse(this.txtMaxGetTimes.Text.Trim(), out num1);
            decimal.TryParse(this.txtItemAmountLimit.Text.Trim(), out num2);
            int.TryParse(this.txtExpiryDays.Text.Trim(), out num3);
            decimal.TryParse(this.txtOrderAmountCanUse.Text.Trim(), out num4);
            redPagerActivityInfo.MinOrderAmount    = num;
            redPagerActivityInfo.MaxGetTimes       = num1;
            redPagerActivityInfo.ItemAmountLimit   = num2;
            redPagerActivityInfo.ExpiryDays        = num3;
            redPagerActivityInfo.OrderAmountCanUse = num4;
            if (RedPagerActivityBrower.IsExistsMinOrderAmount(redPagerActivityInfo.RedPagerActivityId, redPagerActivityInfo.MinOrderAmount))
            {
                this.ShowMsg("已存在相同金额的代金券活动", false);
                return;
            }
            if (this.m_redpaperactivityid <= 0)
            {
                if (!RedPagerActivityBrower.CreateRedPagerActivity(redPagerActivityInfo))
                {
                    this.ShowMsg("代金券活动新增失败", false);
                    return;
                }
                this.ShowMsgAndReUrl("代金券活动新增成功", true, this.ReUrl);
                return;
            }
            if (!RedPagerActivityBrower.UpdateRedPagerActivity(redPagerActivityInfo))
            {
                this.ShowMsg("代金券活动修改失败", false);
                return;
            }
            if (base.Request.QueryString["reurl"] != null)
            {
                this.ReUrl = base.Request.QueryString["reurl"].ToString();
            }
            this.ShowMsgAndReUrl("代金券活动修改成功", true, this.ReUrl);
        }