Esempio n. 1
0
        private void Add(HttpContext context)
        {
            int value  = base.GetIntParam(context, "giftId", false).Value;
            int value2 = base.GetIntParam(context, "quantity", false).Value;

            if (string.IsNullOrWhiteSpace(this.orderId))
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (value <= 0)
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (value2 <= 0)
            {
                throw new HidistroAshxException("礼品数量填写错误");
            }
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (!orderInfo.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS))
            {
                throw new HidistroAshxException("当前订单状态没有订单礼品操作");
            }
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(value);

            if (giftDetails == null)
            {
                throw new HidistroAshxException("错误的数据编号");
            }
            if (!OrderHelper.AddOrderGift(orderInfo, giftDetails, value2, 15.GetHashCode()))
            {
                throw new HidistroAshxException("添加订单礼品失败,可能礼品己存在");
            }
            base.ReturnSuccessResult(context, "操作成功!", 0, true);
        }
Esempio n. 2
0
 private void dlstGifts_ItemCommand(object source, DataListCommandEventArgs e)
 {
     if (e.CommandName == "check")
     {
         if (!order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS))
         {
             ShowMsg("当前订单状态没有订单礼品操作", false);
         }
         else
         {
             int     num;
             int     itemIndex = e.Item.ItemIndex;
             int     giftId    = int.Parse(dlstGifts.DataKeys[itemIndex].ToString());
             TextBox box       = dlstGifts.Items[itemIndex].FindControl("txtQuantity") as TextBox;
             if (!int.TryParse(box.Text.Trim(), out num))
             {
                 ShowMsg("礼品数量填写错误", false);
             }
             else if (num <= 0)
             {
                 ShowMsg("礼品赠送数量不能为0", false);
             }
             else
             {
                 GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);
                 if (giftDetails == null)
                 {
                     base.GotoResourceNotFound();
                 }
                 else if (!OrderHelper.AddOrderGift(order, giftDetails, num))
                 {
                     ShowMsg("添加订单礼品失败", false);
                 }
                 else
                 {
                     BindOrderGifts();
                 }
             }
         }
     }
 }
Esempio n. 3
0
 private void dlstGifts_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e)
 {
     if (e.CommandName == "check")
     {
         if (!this.order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS))
         {
             this.ShowMsg("当前订单状态没有订单礼品操作", false);
             return;
         }
         int itemIndex = e.Item.ItemIndex;
         int giftId    = int.Parse(this.dlstGifts.DataKeys[itemIndex].ToString());
         System.Web.UI.WebControls.TextBox textBox = this.dlstGifts.Items[itemIndex].FindControl("txtQuantity") as System.Web.UI.WebControls.TextBox;
         int num;
         if (!int.TryParse(textBox.Text.Trim(), out num))
         {
             this.ShowMsg("礼品数量填写错误", false);
             return;
         }
         if (num <= 0)
         {
             this.ShowMsg("礼品赠送数量不能为0", false);
             return;
         }
         GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId);
         if (giftDetails == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         if (!OrderHelper.AddOrderGift(this.order, giftDetails, num, 0))
         {
             this.ShowMsg("添加订单礼品失败", false);
             return;
         }
         this.BindOrderGifts();
     }
 }