Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            decimal productTotalPrice = Sessions.ProductTotalPrice;
            string  key = RequestHelper.GetForm <string>("Pay");

            //默认选择支付宝AliPay
            if (UserAgentHelper.IsWx(Request.UserAgent))
            {
                key = "WxPay";
            }
            else
            {
                key = "AliPay";
            }
            PayPluginsInfo info  = PayPlugins.ReadPayPlugins(key);
            OrderInfo      order = new OrderInfo();

            order.PayKey      = key;
            order.PayName     = info.Name;
            order.OrderNumber = ShopCommon.CreateOrderNumber();
            if (info.IsCod == 1)
            {
                order.OrderStatus = 2;
            }
            else
            {
                order.OrderStatus = 1;
            }
            order.OrderNote    = string.Empty;
            order.ProductMoney = productTotalPrice;
            //order.PayDate = RequestHelper.DateNow;
            order.UserID = UserID;
            //order.UserName = base.UserName;
            int orderID = OrderBLL.AddOrder(order);

            this.AddOrderProduct(orderID);
            if (order.OrderStatus == (int)OrderStatus.WaitPay && info.IsOnline == (int)BoolType.True)
            {
                ResponseHelper.Redirect("/Plugins/Pay/" + key + "/Pay.aspx?OrderID=" + orderID + "&Action=PayOrder");
            }
        }