protected void dlstOrders_ItemCommand(object sender, DataListCommandEventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int maxCount = 0; int orderCount = 0; int groupBuyOerderNumber = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if ((countDownBuy == null) || (countDownBuy.EndDate < DateTime.Now)) { this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if ((groupBuy == null) || (groupBuy.Status != GroupBuyStatus.UnderWay)) { this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } orderCount = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); maxCount = groupBuy.MaxCount; groupBuyOerderNumber = orderInfo.GetGroupBuyOerderNumber(); if (maxCount < (orderCount + groupBuyOerderNumber)) { this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } } if (OrderHelper.ConfirmPay(orderInfo)) { DebitNote note = new DebitNote(); note.NoteId = Globals.GetGenerateId(); note.OrderId = e.CommandArgument.ToString(); note.Operator = HiContext.Current.User.Username; note.Remark = "后台" + note.Operator + "收款成功"; OrderHelper.SaveDebitNote(note); if ((orderInfo.GroupBuyId > 0) && (maxCount == (orderCount + groupBuyOerderNumber))) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } this.BindOrders(); int userId = orderInfo.UserId; if (userId == 0x44c) { userId = 0; } Messenger.OrderPayment(Users.GetUser(userId), orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.ShowMsg("成功的确认了订单收款", true); } else { this.ShowMsg("确认订单收款失败", false); } } else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { this.BindOrders(); this.ShowMsg("成功的完成了该订单", true); } else { this.ShowMsg("完成订单失败", false); } } } }
protected void dlstOrders_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if (countDownBuy == null || countDownBuy.EndDate < System.DateTime.Now) { this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy != null) { if (groupBuy.Status == GroupBuyStatus.UnderWay) { num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } goto IL_E2; } } this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } IL_E2: if (OrderHelper.ConfirmPay(orderInfo)) { DebitNote debitNote = new DebitNote(); debitNote.NoteId = Globals.GetGenerateId(); debitNote.OrderId = e.CommandArgument.ToString(); debitNote.Operator = Hidistro.Membership.Context.HiContext.Current.User.Username; debitNote.Remark = "后台" + debitNote.Operator + "收款成功"; OrderHelper.SaveDebitNote(debitNote); if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } this.BindOrders(); int num4 = orderInfo.UserId; if (num4 == 1100) { num4 = 0; } Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num4); Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "sucess", string.Format("<script language=\"javascript\" >alert('确认收款成功');window.location.href=\"{0}\"</script>", System.Web.HttpContext.Current.Request.RawUrl)); return; } this.ShowMsg("确认订单收款失败", false); return; } else { if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { this.BindOrders(); this.ShowMsg("成功的完成了该订单", true); return; } this.ShowMsg("完成订单失败", false); return; } else { if (e.CommandName == "Match_Order") { if (orderInfo == null) { return; } if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success) { this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false); return; } if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS)) { this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false); return; } if (Methods.Supplier_OrderIsFenPei(e.CommandArgument.ToString())) { this.ShowMsg("生成成功", true); return; } string text = Methods.Supplier_OrderItemSupplierUpdate(orderInfo); if (text != "true") { this.ShowMsg(text, false); return; } orderInfo.RealShippingModeId = 0; orderInfo.RealModeName = "配送方式(已实际发货单为准)"; orderInfo.ShipOrderNumber = string.Format("{0}", string.Format(" <a style=\"color:red;cursor:pointer;\" target=\"_blank\" onclick=\"{0}\">物流详细</a>", "showWindow_ShipInfoPage('" + orderInfo.OrderId + "')")); if (OrderHelper.SendGoods(orderInfo)) { Methods.Supplier_OrderItemsSupplierFenPeiOverUpdate(orderInfo.OrderId); if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0) { PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), ""); paymentRequest.SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS"); } } int num5 = orderInfo.UserId; if (num5 == 1100) { num5 = 0; } Hidistro.Membership.Core.IUser user2 = Hidistro.Membership.Context.Users.GetUser(num5); Messenger.OrderShipping(orderInfo, user2); orderInfo.OnDeliver(); this.ShowMsg("生成成功", true); this.BindOrders(); return; } this.ShowMsg("发货失败", false); this.ShowMsg("生成成功", true); } } } } }
protected void btnPay_Click(object sender, EventArgs e) { OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId); int maxCount = 0; int orderCount = 0; int groupBuyOerderNumber = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if ((countDownBuy == null) || (countDownBuy.EndDate < DateTime.Now)) { this.ShowMessage("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(orderInfo.GroupBuyId); if ((groupBuy == null) || (groupBuy.Status != GroupBuyStatus.UnderWay)) { this.ShowMessage("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } orderCount = TradeHelper.GetOrderCount(orderInfo.GroupBuyId); groupBuyOerderNumber = orderInfo.GetGroupBuyOerderNumber(); maxCount = groupBuy.MaxCount; if (maxCount < (orderCount + groupBuyOerderNumber)) { this.ShowMessage("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } } if (!orderInfo.CheckAction(OrderActions.BUYER_PAY)) { this.ShowMessage("当前的订单订单状态不是等待付款,所以不能支付", false); } else if (HiContext.Current.User.UserId != orderInfo.UserId) { this.ShowMessage("预付款只能为自己下的订单付款,查一查该订单是不是你的", false); } else if (((decimal)this.litUseableBalance.Money) < orderInfo.GetTotal()) { this.ShowMessage("预付款余额不足,支付失败", false); } else { IUser user = HiContext.Current.User; user.TradePassword = this.txtPassword.Text; if (Users.ValidTradePassword(user)) { foreach (LineItemInfo info4 in orderInfo.LineItems.Values) { if (ShoppingProcessor.GetStock(info4.ProductId, info4.SkuId) < info4.ShipmentQuantity) { this.ShowMessage("订单中商品库存不足,禁止支付!", false); return; } } if (TradeHelper.UserPayOrder(orderInfo, true)) { DebitNote note = new DebitNote(); note.NoteId = Globals.GetGenerateId(); note.OrderId = this.orderId; note.Operator = HiContext.Current.User.Username; note.Remark = "客户预付款订单支付成功"; TradeHelper.SaveDebitNote(note); if ((orderInfo.GroupBuyId > 0) && (maxCount == (orderCount + groupBuyOerderNumber))) { TradeHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.Page.Response.Redirect(Globals.ApplicationPath + "/user/PaySucceed.aspx?orderId=" + this.orderId); } else { this.ShowMessage(string.Format("对订单{0} 支付失败", orderInfo.OrderId), false); } } else { this.ShowMessage("交易密码有误,请重试", false); } } }
protected void btnPay_Click(object sender, System.EventArgs e) { OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId); int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if (countDownBuy == null || countDownBuy.EndDate < System.DateTime.Now) { this.ShowMessage("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay) { this.ShowMessage("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } num2 = TradeHelper.GetOrderCount(orderInfo.GroupBuyId); num3 = orderInfo.GetGroupBuyOerderNumber(); num = groupBuy.MaxCount; if (num < num2 + num3) { this.ShowMessage("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } } if (!orderInfo.CheckAction(OrderActions.BUYER_PAY)) { this.ShowMessage("当前的订单订单状态不是等待付款,所以不能支付", false); } else { if (HiContext.Current.User.UserId != orderInfo.UserId) { this.ShowMessage("预付款只能为自己下的订单付款,查一查该订单是不是你的", false); } else { if ((decimal)this.litUseableBalance.Money < orderInfo.GetTotal()) { this.ShowMessage("预付款余额不足,支付失败", false); } else { Hidistro.Membership.Core.IUser user = HiContext.Current.User; user.TradePassword = this.txtPassword.Text; if (Users.ValidTradePassword(user)) { System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems; foreach (LineItemInfo current in lineItems.Values) { int stock = ShoppingProcessor.GetStock(current.ProductId, current.SkuId); if (stock < current.ShipmentQuantity) { this.ShowMessage("订单中商品库存不足,禁止支付!", false); return; } } if (TradeHelper.UserPayOrder(orderInfo, true)) { TradeHelper.SaveDebitNote(new DebitNote { NoteId = Globals.GetGenerateId(), OrderId = this.orderId, Operator = HiContext.Current.User.Username, Remark = "客户预付款订单支付成功" }); if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { TradeHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.Page.Response.Redirect(Globals.ApplicationPath + "/user/PaySucceed.aspx?orderId=" + this.orderId); } else { this.ShowMessage(string.Format("对订单{0} 支付失败", orderInfo.OrderId), false); } } else { this.ShowMessage("交易密码有误,请重试", false); } } } } }
protected void dlstOrders_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString()); if (orderInfo != null) { if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY)) { int num = 0; int num2 = 0; int num3 = 0; if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownBuy = TradeHelper.GetCountDownBuy(orderInfo.CountDownBuyId); if (countDownBuy == null || countDownBuy.EndDate < System.DateTime.Now) { this.ShowMsg("当前的订单为限时抢购订单,此活动已结束,所以不能支付", false); return; } } if (orderInfo.GroupBuyId > 0) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId); if (groupBuy != null) { if (groupBuy.Status == GroupBuyStatus.UnderWay) { num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId); num = groupBuy.MaxCount; num3 = orderInfo.GetGroupBuyOerderNumber(); if (num < num2 + num3) { this.ShowMsg("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false); return; } goto IL_D9; } } this.ShowMsg("当前的订单为团购订单,此团购活动已结束,所以不能支付", false); return; } IL_D9: if (OrderHelper.ConfirmPay(orderInfo)) { if (orderInfo.GroupBuyId > 0 && num == num2 + num3) { PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId); } this.BindOrders(); int num4 = orderInfo.UserId; if (num4 == 1100) { num4 = 0; } Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.GetUser(num4); Messenger.OrderPayment(user, orderInfo.OrderId, orderInfo.GetTotal()); orderInfo.OnPayment(); this.ShowMsg("成功的确认了订单收款", true); return; } this.ShowMsg("确认订单收款失败", false); return; } else { if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE)) { if (OrderHelper.ConfirmOrderFinish(orderInfo)) { this.BindOrders(); this.ShowMsg("成功的完成了该订单", true); return; } this.ShowMsg("完成订单失败", false); } } } }