Exemplo n.º 1
0
        private void btnOperationOK_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.productIds))
            {
                this.ShowMsg("没有要修改的商品", false);
                return;
            }
            if (!this.ddlUnderlingPrice.SelectedValue.HasValue)
            {
                this.ShowMsg("请选择要修改的价格", false);
                return;
            }
            if (!this.ddlUnderlingPrice2.SelectedValue.HasValue)
            {
                this.ShowMsg("请选择要修改的价格", false);
                return;
            }
            decimal num = 0m;

            if (!decimal.TryParse(this.txtOperationPrice.Text.Trim(), out num))
            {
                this.ShowMsg("请输入正确的价格", false);
                return;
            }
            if (this.ddlOperation.SelectedValue == "*" && num <= 0m)
            {
                this.ShowMsg("必须乘以一个正数", false);
                return;
            }
            if (this.ddlOperation.SelectedValue == "+" && num < 0m)
            {
                decimal checkPrice = -num;
                if (SubSiteProducthelper.CheckPrice(this.productIds, this.ddlSalePrice.SelectedValue, checkPrice))
                {
                    this.ShowMsg("加了一个太小的负数,导致价格中有负数的情况", false);
                    return;
                }
            }
            if (SubSiteProducthelper.CheckPrice(this.productIds, this.ddlSalePrice.SelectedValue, num, this.ddlOperation.SelectedValue))
            {
                this.ShowMsg("公式调价的计算结果导致价格超出了系统表示范围", false);
                return;
            }
            if (SubSiteProducthelper.UpdateSkuUnderlingPrices(this.productIds, this.ddlUnderlingPrice2.SelectedValue.Value, this.ddlSalePrice.SelectedValue, this.ddlOperation.SelectedValue, num))
            {
                this.ShowMsg("修改商品的价格成功", true);
            }
        }
Exemplo n.º 2
0
 private void btnOperationOK_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(productIds))
     {
         ShowMsg("没有要修改的商品", false);
     }
     else if (!ddlUnderlingPrice.SelectedValue.HasValue)
     {
         ShowMsg("请选择要修改的价格", false);
     }
     else if (!ddlUnderlingPrice2.SelectedValue.HasValue)
     {
         ShowMsg("请选择要修改的价格", false);
     }
     else
     {
         decimal result = 0M;
         if (!decimal.TryParse(txtOperationPrice.Text.Trim(), out result))
         {
             ShowMsg("请输入正确的价格", false);
         }
         else if ((ddlOperation.SelectedValue == "*") && (result <= 0M))
         {
             ShowMsg("必须乘以一个正数", false);
         }
         else
         {
             if ((ddlOperation.SelectedValue == "+") && (result < 0M))
             {
                 decimal checkPrice = -result;
                 if (SubSiteProducthelper.CheckPrice(productIds, ddlSalePrice.SelectedValue, checkPrice))
                 {
                     ShowMsg("加了一个太小的负数,导致价格中有负数的情况", false);
                     return;
                 }
             }
             if (SubSiteProducthelper.UpdateSkuUnderlingPrices(productIds, ddlUnderlingPrice2.SelectedValue.Value, ddlSalePrice.SelectedValue, ddlOperation.SelectedValue, result))
             {
                 ShowMsg("修改商品的价格成功", true);
             }
         }
     }
 }