private void grdProducts_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "setQuantity")
     {
         if (!this.order.CheckAction(OrderActions.SELLER_MODIFY_TRADE))
         {
             this.ShowMsg("你当前订单的状态不能进行修改订单费用操作", false);
         }
         else
         {
             int     num2;
             int     rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex;
             string  skuId    = this.grdProducts.DataKeys[rowIndex].Value.ToString();
             TextBox box      = this.grdProducts.Rows[rowIndex].FindControl("txtQuantity") as TextBox;
             if (!int.TryParse(box.Text.Trim(), out num2))
             {
                 this.BindProductList(this.order);
                 this.ShowMsg("商品数量填写错误", false);
             }
             else if ((num2 > SubsiteSalesHelper.GetSkuStock(skuId)) || SubsiteSalesHelper.GetAlertStock(skuId))
             {
                 this.BindProductList(this.order);
                 this.ShowMsg("此商品库存不够", false);
             }
             else if (num2 <= 0)
             {
                 this.BindProductList(this.order);
                 this.ShowMsg("商品购买数量不能为0", false);
             }
             else
             {
                 OrderInfo order    = this.order;
                 int       quantity = order.LineItems[skuId].Quantity;
                 order.LineItems[skuId].ShipmentQuantity  = num2;
                 order.LineItems[skuId].Quantity          = num2;
                 order.LineItems[skuId].ItemAdjustedPrice = order.LineItems[skuId].ItemListPrice;
                 if (order.GetTotal() < 0M)
                 {
                     this.ShowMsg("订单金额不允许为负数", false);
                 }
                 else if (quantity != num2)
                 {
                     if (SubsiteSalesHelper.UpdateLineItem(skuId, this.order, num2))
                     {
                         this.BindProductList(this.order);
                         this.BindTatolAmount(this.order);
                         this.ShowMsg("修改商品购买数量成功", true);
                     }
                     else
                     {
                         this.ShowMsg("修改商品购买数量失败", false);
                     }
                 }
             }
         }
     }
 }
Example #2
0
 private void grdProducts_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (e.CommandName == "setQuantity")
     {
         if (!this.order.CheckAction(OrderActions.SELLER_MODIFY_TRADE))
         {
             this.ShowMsg("你当前订单的状态不能进行修改订单费用操作", false);
             return;
         }
         int    rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex;
         string text     = this.grdProducts.DataKeys[rowIndex].Value.ToString();
         System.Web.UI.WebControls.TextBox textBox = this.grdProducts.Rows[rowIndex].FindControl("txtQuantity") as System.Web.UI.WebControls.TextBox;
         int num;
         if (!int.TryParse(textBox.Text.Trim(), out num))
         {
             this.BindProductList(this.order);
             this.ShowMsg("商品数量填写错误", false);
             return;
         }
         if (num > SubsiteSalesHelper.GetSkuStock(text) || SubsiteSalesHelper.GetAlertStock(text))
         {
             this.BindProductList(this.order);
             this.ShowMsg("此商品库存不够", false);
             return;
         }
         if (num <= 0)
         {
             this.BindProductList(this.order);
             this.ShowMsg("商品购买数量不能为0", false);
             return;
         }
         OrderInfo orderInfo = this.order;
         int       quantity  = orderInfo.LineItems[text].Quantity;
         orderInfo.LineItems[text].ShipmentQuantity  = num;
         orderInfo.LineItems[text].Quantity          = num;
         orderInfo.LineItems[text].ItemAdjustedPrice = orderInfo.LineItems[text].ItemListPrice;
         if (orderInfo.GetTotal() < 0m)
         {
             this.ShowMsg("订单金额不允许为负数", false);
             return;
         }
         if (quantity != num)
         {
             if (SubsiteSalesHelper.UpdateLineItem(text, this.order, num))
             {
                 this.BindProductList(this.order);
                 this.BindTatolAmount(this.order);
                 this.ShowMsg("修改商品购买数量成功", true);
                 return;
             }
             this.ShowMsg("修改商品购买数量失败", false);
         }
     }
 }
Example #3
0
 private void grdProducts_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "setQuantity")
     {
         if (!order.CheckAction(OrderActions.SELLER_MODIFY_TRADE))
         {
             ShowMsg("你当前订单的状态不能进行修改订单费用操作", false);
         }
         else
         {
             int     num;
             int     rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex;
             string  skuId    = grdProducts.DataKeys[rowIndex].Value.ToString();
             TextBox box      = grdProducts.Rows[rowIndex].FindControl("txtQuantity") as TextBox;
             if (!int.TryParse(box.Text.Trim(), out num))
             {
                 BindProductList(order);
                 ShowMsg("商品数量填写错误", false);
             }
             else if ((num > SubsiteSalesHelper.GetSkuStock(skuId)) || SubsiteSalesHelper.GetAlertStock(skuId))
             {
                 BindProductList(order);
                 ShowMsg("此商品库存不够", false);
             }
             else if (num <= 0)
             {
                 BindProductList(order);
                 ShowMsg("商品购买数量不能为0", false);
             }
             else if (order.LineItems[skuId].Quantity != num)
             {
                 if (SubsiteSalesHelper.UpdateLineItem(skuId, order, num))
                 {
                     BindProductList(order);
                     BindTatolAmount(order);
                     ShowMsg("修改商品购买数量成功", true);
                 }
                 else
                 {
                     ShowMsg("修改商品购买数量失败", false);
                 }
             }
         }
     }
 }