private void dlstGifts_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "check") { if (!this.order.CheckAction(OrderActions.SUBSITE_SELLER_MODIFY_GIFTS)) { this.ShowMsg("当前订单状态没有订单礼品操作", false); } else { int num3; int itemIndex = e.Item.ItemIndex; int giftId = int.Parse(this.dlstGifts.DataKeys[itemIndex].ToString()); TextBox box = this.dlstGifts.Items[itemIndex].FindControl("txtQuantity") as TextBox; if (!int.TryParse(box.Text.Trim(), out num3)) { this.ShowMsg("礼品数量填写错误", false); } else if (num3 <= 0) { this.ShowMsg("礼品赠送数量不能为0", false); } else { GiftInfo giftDetails = SubsiteSalesHelper.GetGiftDetails(giftId); if (giftDetails == null) { base.GotoResourceNotFound(); } else if (!SubsiteSalesHelper.AddOrderGift(this.order, giftDetails, num3, 0)) { this.ShowMsg("添加订单礼品失败", false); } else { this.BindOrderGifts(); } } } } }