Exemplo n.º 1
0
        private void btnConfirm_Click(object sender, System.EventArgs e)
        {
            PaymentModeInfo   paymentMode       = SubsiteStoreHelper.GetPaymentMode(this.paymentModeId);
            InpourRequestInfo inpourRequestInfo = new InpourRequestInfo
            {
                InpourId     = this.GenerateInpourId(),
                TradeDate    = System.DateTime.Now,
                InpourBlance = this.balance,
                UserId       = Hidistro.Membership.Context.HiContext.Current.User.UserId,
                PaymentId    = paymentMode.ModeId
            };

            if (SubsiteStoreHelper.AddInpourBalance(inpourRequestInfo))
            {
                string attach = "";
                System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()];
                if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                {
                    attach = httpCookie.Value;
                }
                string         text           = inpourRequestInfo.InpourId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, inpourRequestInfo.InpourBlance + paymentMode.CalcPayCharge(inpourRequestInfo.InpourBlance), "预付款充值", "操作流水号-" + text, Hidistro.Membership.Context.HiContext.Current.User.Email, inpourRequestInfo.TradeDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[]
                {
                    paymentMode.Gateway
                })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourNotify_url", new object[]
                {
                    paymentMode.Gateway
                })), attach);
                paymentRequest.SendRequest();
            }
        }
Exemplo n.º 2
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (this.ValidateCreateOrder())
     {
         PurchaseOrderInfo purchaseOrderInfo = this.GetPurchaseOrderInfo();
         if (purchaseOrderInfo.PurchaseOrderItems.Count == 0)
         {
             this.ShowMsg("您暂时未选择您要添加的商品", false);
         }
         else if (SubsiteSalesHelper.CreatePurchaseOrder(purchaseOrderInfo))
         {
             SubsiteSalesHelper.ClearPurchaseShoppingCart();
             int.Parse(this.radioPaymentMode.SelectedValue);
             PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(int.Parse(this.radioPaymentMode.SelectedValue));
             if ((paymentMode != null) && paymentMode.Gateway.ToLower().Equals("hishop.plugins.payment.podrequest"))
             {
                 this.ShowMsg("您选择的是货到付款方式,请等待主站发货", true);
             }
             else if ((paymentMode != null) && paymentMode.Gateway.ToLower().Equals("hishop.plugins.payment.bankrequest"))
             {
                 this.ShowMsg("您选择的是线下付款方式,请与主站管理员联系", true);
             }
             else
             {
                 base.Response.Redirect(Globals.ApplicationPath + "/Shopadmin/purchaseOrder/Pay.aspx?PurchaseOrderId=" + purchaseOrderInfo.PurchaseOrderId + "&PayMode=" + this.radioPaymentMode.SelectedValue);
             }
         }
         else
         {
             this.ShowMsg("提交采购单失败", false);
         }
     }
 }
Exemplo n.º 3
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            string          text        = base.Request["PurchaseOrderId"];
            PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(int.Parse(this.radioPaymentMode.SelectedValue));

            if (paymentMode != null)
            {
                SubsiteSalesHelper.SetPayment(text, paymentMode.ModeId, paymentMode.Name, paymentMode.Gateway);
            }
            if (paymentMode != null && paymentMode.Gateway.ToLower().Equals("hishop.plugins.payment.podrequest"))
            {
                this.ShowMsg("您选择的是货到付款方式,请等待主站发货", true);
                return;
            }
            if (paymentMode != null && paymentMode.Gateway.ToLower().Equals("hishop.plugins.payment.bankrequest"))
            {
                this.ShowMsg("您选择的是线下付款方式,请与主站管理员联系", true);
                return;
            }
            base.Response.Redirect(string.Concat(new string[]
            {
                Globals.ApplicationPath,
                "/Shopadmin/purchaseOrder/Pay.aspx?PurchaseOrderId=",
                text,
                "&PayMode=",
                this.radioPaymentMode.SelectedValue
            }));
        }
Exemplo n.º 4
0
 private void btnConfirmPay_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.txtTradePassword.Text))
     {
         this.ShowMsg("请输入交易密码", false);
     }
     else
     {
         int num;
         int.TryParse(base.Request["PayMode"], out num);
         SubsiteStoreHelper.GetPaymentMode(num);
         if (((decimal)this.lblUseableBalance.Money) < ((decimal)this.lblTotalPrice.Money))
         {
             this.ShowMsg("您的预付款金额不足", false);
         }
         else
         {
             Distributor user = SubsiteStoreHelper.GetDistributor();
             if ((user.Balance - user.RequestBalance) < this.purchaseOrder.GetPurchaseTotal())
             {
                 this.ShowMsg("您的预付款金额不足", false);
             }
             else
             {
                 BalanceDetailInfo balance = new BalanceDetailInfo();
                 balance.UserId     = user.UserId;
                 balance.UserName   = user.Username;
                 balance.TradeType  = TradeTypes.Consume;
                 balance.TradeDate  = DateTime.Now;
                 balance.Expenses   = new decimal?(this.purchaseOrder.GetPurchaseTotal());
                 balance.Balance    = user.Balance - this.purchaseOrder.GetPurchaseTotal();
                 balance.Remark     = string.Format("采购单{0}的付款", this.purchaseOrder.PurchaseOrderId);
                 user.TradePassword = this.txtTradePassword.Text;
                 if (Users.ValidTradePassword(user))
                 {
                     if (!SubsiteSalesHelper.ConfirmPay(balance, this.purchaseOrder))
                     {
                         this.ShowMsg("付款失败", false);
                     }
                     else
                     {
                         PurchaseDebitNote note = new PurchaseDebitNote();
                         note.NoteId          = Globals.GetGenerateId();
                         note.PurchaseOrderId = this.purchaseOrderId;
                         note.Operator        = HiContext.Current.User.Username;
                         note.Remark          = "分销商采购单预付款支付成功";
                         SubsiteSalesHelper.SavePurchaseDebitNote(note);
                         this.ShowMsg("采购单预付款支付成功", true);
                     }
                 }
                 else
                 {
                     this.ShowMsg("交易密码错误", false);
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
        private void btnConfirmPay_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtTradePassword.Text))
            {
                this.ShowMsg("请输入交易密码", false);
                return;
            }
            int modeId;

            int.TryParse(base.Request["PayMode"], out modeId);
            SubsiteStoreHelper.GetPaymentMode(modeId);
            if ((decimal)this.lblUseableBalance.Money < (decimal)this.lblTotalPrice.Money)
            {
                this.ShowMsg("您的预付款金额不足", false);
                return;
            }
            Hidistro.Membership.Context.Distributor distributor = SubsiteStoreHelper.GetDistributor();
            if (distributor.Balance - distributor.RequestBalance < this.purchaseOrder.GetPurchaseTotal())
            {
                this.ShowMsg("您的预付款金额不足", false);
                return;
            }
            BalanceDetailInfo balanceDetailInfo = new BalanceDetailInfo();

            balanceDetailInfo.UserId    = distributor.UserId;
            balanceDetailInfo.UserName  = distributor.Username;
            balanceDetailInfo.TradeType = TradeTypes.Consume;
            balanceDetailInfo.TradeDate = System.DateTime.Now;
            balanceDetailInfo.Expenses  = new decimal?(this.purchaseOrder.GetPurchaseTotal());
            balanceDetailInfo.Balance   = distributor.Balance - this.purchaseOrder.GetPurchaseTotal();
            balanceDetailInfo.Remark    = string.Format("采购单{0}的付款", this.purchaseOrder.PurchaseOrderId);
            distributor.TradePassword   = this.txtTradePassword.Text;
            if (!Hidistro.Membership.Context.Users.ValidTradePassword(distributor))
            {
                this.ShowMsg("交易密码错误", false);
                return;
            }
            if (!SubsiteSalesHelper.ConfirmPay(balanceDetailInfo, this.purchaseOrder))
            {
                this.ShowMsg("付款失败", false);
                return;
            }
            SubsiteSalesHelper.SavePurchaseDebitNote(new PurchaseDebitNote
            {
                NoteId          = Globals.GetGenerateId(),
                PurchaseOrderId = this.purchaseOrderId,
                Operator        = Hidistro.Membership.Context.HiContext.Current.User.Username,
                Remark          = "分销商采购单预付款支付成功"
            });
            this.ShowMsg("采购单预付款支付成功", true);
        }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int.TryParse(Page.Request.QueryString["modeId"], out paymentModeId);
     decimal.TryParse(Page.Request.QueryString["blance"], out balance);
     btnConfirm.Click += new EventHandler(btnConfirm_Click);
     if ((!Page.IsPostBack && (paymentModeId > 0)) && (balance > 0M))
     {
         PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(paymentModeId);
         litRealName.Text = HiContext.Current.User.Username;
         if (paymentMode != null)
         {
             lblPaymentName.Text    = paymentMode.Name;
             lblBlance.Money        = balance;
             ViewState["PayCharge"] = paymentMode.CalcPayCharge(balance);
             litPayCharge.Text      = Globals.FormatMoney(paymentMode.CalcPayCharge(balance));
         }
     }
 }
Exemplo n.º 7
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     int.TryParse(this.Page.Request.QueryString["modeId"], out this.paymentModeId);
     decimal.TryParse(this.Page.Request.QueryString["blance"], out this.balance);
     this.btnConfirm.Click += new System.EventHandler(this.btnConfirm_Click);
     if (!this.Page.IsPostBack && this.paymentModeId > 0 && this.balance > 0m)
     {
         PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(this.paymentModeId);
         this.litRealName.Text = Hidistro.Membership.Context.HiContext.Current.User.Username;
         if (paymentMode != null)
         {
             this.lblPaymentName.Text    = paymentMode.Name;
             this.lblBlance.Money        = this.balance;
             this.ViewState["PayCharge"] = paymentMode.CalcPayCharge(this.balance);
             this.litPayCharge.Text      = Globals.FormatMoney(paymentMode.CalcPayCharge(this.balance));
         }
     }
 }
Exemplo n.º 8
0
 private void DoValidate()
 {
     System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection
     {
         this.Page.Request.Form,
         this.Page.Request.QueryString
     };
     this.Gateway = this.Page.Request.QueryString["HIGW"];
     this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
     if (this.isBackRequest)
     {
         this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[]
         {
             this.Gateway
         }));
         PaymentNotify expr_AC = this.Notify;
         expr_AC.ReturnUrl = expr_AC.ReturnUrl + "?" + this.Page.Request.Url.Query;
     }
     this.InpourId      = this.Notify.GetOrderId();
     this.Amount        = this.Notify.GetOrderAmount();
     this.InpourRequest = SubsiteStoreHelper.GetInpouRequest(this.InpourId);
     if (this.InpourRequest == null)
     {
         this.ResponseStatus(true, "success");
     }
     else
     {
         this.Amount  = this.InpourRequest.InpourBlance;
         this.paymode = SubsiteStoreHelper.GetPaymentMode(this.InpourRequest.PaymentId);
         if (this.paymode == null)
         {
             this.ResponseStatus(true, "gatewaynotfound");
         }
         else
         {
             this.Notify.Finished          += new System.EventHandler <FinishedEventArgs>(this.Notify_Finished);
             this.Notify.NotifyVerifyFaild += new System.EventHandler(this.Notify_NotifyVerifyFaild);
             this.Notify.Payment           += new System.EventHandler(this.Notify_Payment);
             this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(this.paymode.Settings));
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            NameValueCollection values2 = new NameValueCollection();

            values2.Add(this.Page.Request.Form);
            values2.Add(this.Page.Request.QueryString);
            NameValueCollection parameters = values2;

            this.Gateway = this.Page.Request.QueryString["HIGW"];
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentReturn_url", new object[] { this.Gateway })) + "?" + this.Page.Request.Url.Query;
            }
            this.PurchaseOrderId = this.Notify.GetOrderId();
            this.PurchaseOrder   = SubsiteSalesHelper.GetPurchaseOrder(this.PurchaseOrderId);
            if (this.PurchaseOrder == null)
            {
                this.ResponseStatus(true, "purchaseordernotfound");
            }
            else
            {
                this.Amount = this.Notify.GetOrderAmount();
                if (this.Amount <= 0M)
                {
                    this.Amount = this.PurchaseOrder.GetPurchaseTotal();
                }
                PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(this.PurchaseOrder.PaymentTypeId);
                if (paymentMode == null)
                {
                    this.ResponseStatus(true, "gatewaynotfound");
                }
                else
                {
                    this.Notify.Finished          += new EventHandler <FinishedEventArgs>(this.Notify_Finished);
                    this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
                    this.Notify.Payment           += new EventHandler(this.Notify_Payment);
                    this.Notify.VerifyNotify(0x7530, HiCryptographer.Decrypt(paymentMode.Settings));
                }
            }
        }
Exemplo n.º 10
0
        void DoValidate()
        {
            NameValueCollection values2 = new NameValueCollection();

            values2.Add(Page.Request.Form);
            values2.Add(Page.Request.QueryString);
            NameValueCollection parameters = values2;

            Gateway = Page.Request.QueryString["HIGW"];
            Notify  = PaymentNotify.CreateInstance(Gateway, parameters);
            if (isBackRequest)
            {
                Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[] { Gateway }));
                Notify.ReturnUrl = Notify.ReturnUrl + "?" + Page.Request.Url.Query;
            }
            InpourId      = Notify.GetOrderId();
            Amount        = Notify.GetOrderAmount();
            InpourRequest = SubsiteStoreHelper.GetInpouRequest(InpourId);
            if (InpourRequest == null)
            {
                ResponseStatus(true, "success");
            }
            else
            {
                Amount  = InpourRequest.InpourBlance;
                paymode = SubsiteStoreHelper.GetPaymentMode(InpourRequest.PaymentId);
                if (paymode == null)
                {
                    ResponseStatus(true, "gatewaynotfound");
                }
                else
                {
                    Notify.Finished          += new EventHandler <FinishedEventArgs>(Notify_Finished);
                    Notify.NotifyVerifyFaild += new EventHandler(Notify_NotifyVerifyFaild);
                    Notify.Payment           += new EventHandler(Notify_Payment);
                    Notify.VerifyNotify(0x7530, Cryptographer.Decrypt(paymode.Settings));
                }
            }
        }
Exemplo n.º 11
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            string          purchaseOrderId = base.Request["PurchaseOrderId"];
            PaymentModeInfo paymentMode     = SubsiteStoreHelper.GetPaymentMode(int.Parse(this.radioPaymentMode.SelectedValue));

            if (paymentMode != null)
            {
                SubsiteSalesHelper.SetPayment(purchaseOrderId, paymentMode.ModeId, paymentMode.Name, paymentMode.Gateway);
            }
            if ((paymentMode != null) && paymentMode.Gateway.ToLower().Equals("hishop.plugins.payment.podrequest"))
            {
                this.ShowMsg("您选择的是货到付款方式,请等待主站发货", true);
            }
            else if ((paymentMode != null) && paymentMode.Gateway.ToLower().Equals("hishop.plugins.payment.bankrequest"))
            {
                this.ShowMsg("您选择的是线下付款方式,请与主站管理员联系", true);
            }
            else
            {
                base.Response.Redirect(Globals.ApplicationPath + "/Shopadmin/purchaseOrder/Pay.aspx?PurchaseOrderId=" + purchaseOrderId + "&PayMode=" + this.radioPaymentMode.SelectedValue);
            }
        }
Exemplo n.º 12
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            PaymentModeInfo   paymentMode   = SubsiteStoreHelper.GetPaymentMode(paymentModeId);
            InpourRequestInfo inpourRequest = new InpourRequestInfo();

            inpourRequest.InpourId     = GenerateInpourId();
            inpourRequest.TradeDate    = DateTime.Now;
            inpourRequest.InpourBlance = balance;
            inpourRequest.UserId       = HiContext.Current.User.UserId;
            inpourRequest.PaymentId    = paymentMode.ModeId;

            if (SubsiteStoreHelper.AddInpourBalance(inpourRequest))
            {
                string     attach = "";
                HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()];
                if (!((cookie == null) || string.IsNullOrEmpty(cookie.Value)))
                {
                    attach = cookie.Value;
                }
                string orderId = inpourRequest.InpourId.ToString(CultureInfo.InvariantCulture);
                PaymentRequest.CreateInstance(paymentMode.Gateway, Cryptographer.Decrypt(paymentMode.Settings), orderId, inpourRequest.InpourBlance + paymentMode.CalcPayCharge(inpourRequest.InpourBlance), "预付款充值", "操作流水号-" + orderId, HiContext.Current.User.Email, inpourRequest.TradeDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest();
            }
        }
Exemplo n.º 13
0
        private PurchaseOrderInfo GetPurchaseOrderInfo()
        {
            PurchaseOrderInfo purchaseOrderInfo = new PurchaseOrderInfo();

            Hidistro.Membership.Context.Distributor distributor = Hidistro.Membership.Context.Users.GetUser(Hidistro.Membership.Context.HiContext.Current.User.UserId) as Hidistro.Membership.Context.Distributor;
            int             num         = int.Parse(this.radioPaymentMode.SelectedValue);
            PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(num);

            if (paymentMode != null)
            {
                purchaseOrderInfo.PaymentTypeId = num;
                purchaseOrderInfo.PaymentType   = paymentMode.Name;
                purchaseOrderInfo.Gateway       = paymentMode.Gateway;
            }
            string purchaseOrderId = this.GeneratePurchaseOrderId();

            purchaseOrderInfo.PurchaseOrderId = purchaseOrderId;
            System.Collections.Generic.IList <PurchaseShoppingCartItemInfo> purchaseShoppingCartItemInfos = SubsiteSalesHelper.GetPurchaseShoppingCartItemInfos();
            decimal num2 = 0m;

            if (purchaseShoppingCartItemInfos.Count >= 1)
            {
                foreach (PurchaseShoppingCartItemInfo current in purchaseShoppingCartItemInfos)
                {
                    PurchaseOrderItemInfo purchaseOrderItemInfo = new PurchaseOrderItemInfo();
                    purchaseOrderItemInfo.PurchaseOrderId         = purchaseOrderId;
                    purchaseOrderItemInfo.SkuId                   = current.SkuId;
                    purchaseOrderItemInfo.ThumbnailsUrl           = current.ThumbnailsUrl;
                    purchaseOrderItemInfo.SKUContent              = current.SKUContent;
                    purchaseOrderItemInfo.SKU                     = current.SKU;
                    purchaseOrderItemInfo.Quantity                = current.Quantity;
                    purchaseOrderItemInfo.ProductId               = current.ProductId;
                    purchaseOrderItemInfo.ItemWeight              = current.ItemWeight;
                    purchaseOrderItemInfo.ItemCostPrice           = current.CostPrice;
                    purchaseOrderItemInfo.ItemPurchasePrice       = current.ItemPurchasePrice;
                    purchaseOrderItemInfo.ItemListPrice           = current.ItemListPrice;
                    purchaseOrderItemInfo.ItemDescription         = current.ItemDescription;
                    purchaseOrderItemInfo.ItemHomeSiteDescription = current.ItemDescription;
                    num2 += current.ItemWeight * current.Quantity;
                    purchaseOrderInfo.PurchaseOrderItems.Add(purchaseOrderItemInfo);
                }
                ShippingModeInfo shippingMode = SubsiteSalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true);
                purchaseOrderInfo.ShipTo = this.txtShipTo.Text.Trim();
                if (this.rsddlRegion.GetSelectedRegionId().HasValue)
                {
                    purchaseOrderInfo.RegionId = this.rsddlRegion.GetSelectedRegionId().Value;
                }
                purchaseOrderInfo.Address             = Globals.HtmlEncode(this.txtAddress.Text.Trim());
                purchaseOrderInfo.TelPhone            = this.txtTel.Text.Trim();
                purchaseOrderInfo.ZipCode             = this.txtZipcode.Text.Trim();
                purchaseOrderInfo.CellPhone           = this.txtMobile.Text.Trim();
                purchaseOrderInfo.OrderId             = null;
                purchaseOrderInfo.RealShippingModeId  = this.radioShippingMode.SelectedValue.Value;
                purchaseOrderInfo.RealModeName        = shippingMode.Name;
                purchaseOrderInfo.ShippingModeId      = this.radioShippingMode.SelectedValue.Value;
                purchaseOrderInfo.ModeName            = shippingMode.Name;
                purchaseOrderInfo.AdjustedFreight     = SubsiteSalesHelper.CalcFreight(purchaseOrderInfo.RegionId, num2, shippingMode);
                purchaseOrderInfo.Freight             = purchaseOrderInfo.AdjustedFreight;
                purchaseOrderInfo.ShippingRegion      = this.rsddlRegion.SelectedRegions;
                purchaseOrderInfo.Remark              = Globals.HtmlEncode(this.txtRemark.Text.Trim());
                purchaseOrderInfo.PurchaseStatus      = OrderStatus.WaitBuyerPay;
                purchaseOrderInfo.DistributorId       = distributor.UserId;
                purchaseOrderInfo.Distributorname     = distributor.Username;
                purchaseOrderInfo.DistributorEmail    = distributor.Email;
                purchaseOrderInfo.DistributorRealName = distributor.RealName;
                purchaseOrderInfo.DistributorQQ       = distributor.QQ;
                purchaseOrderInfo.DistributorWangwang = distributor.Wangwang;
                purchaseOrderInfo.DistributorMSN      = distributor.MSN;
                purchaseOrderInfo.RefundStatus        = RefundStatus.None;
                purchaseOrderInfo.Weight              = num2;
            }
            return(purchaseOrderInfo);
        }
Exemplo n.º 14
0
        private PurchaseOrderInfo GetPurchaseOrderInfo()
        {
            PurchaseOrderInfo info      = new PurchaseOrderInfo();
            Distributor       user      = Users.GetUser(HiContext.Current.User.UserId) as Distributor;
            int             modeId      = int.Parse(this.radioPaymentMode.SelectedValue);
            PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(modeId);

            if (paymentMode != null)
            {
                info.PaymentTypeId = modeId;
                info.PaymentType   = paymentMode.Name;
                info.Gateway       = paymentMode.Gateway;
            }
            string str = this.GeneratePurchaseOrderId();

            info.PurchaseOrderId = str;
            IList <PurchaseShoppingCartItemInfo> purchaseShoppingCartItemInfos = SubsiteSalesHelper.GetPurchaseShoppingCartItemInfos();
            decimal totalWeight = 0M;

            if (purchaseShoppingCartItemInfos.Count >= 1)
            {
                foreach (PurchaseShoppingCartItemInfo info3 in purchaseShoppingCartItemInfos)
                {
                    PurchaseOrderItemInfo item = new PurchaseOrderItemInfo();
                    item.PurchaseOrderId         = str;
                    item.SkuId                   = info3.SkuId;
                    item.ThumbnailsUrl           = info3.ThumbnailsUrl;
                    item.SKUContent              = info3.SKUContent;
                    item.SKU                     = info3.SKU;
                    item.Quantity                = info3.Quantity;
                    item.ProductId               = info3.ProductId;
                    item.ItemWeight              = info3.ItemWeight;
                    item.ItemCostPrice           = info3.CostPrice;
                    item.ItemPurchasePrice       = info3.ItemPurchasePrice;
                    item.ItemListPrice           = info3.ItemListPrice;
                    item.ItemDescription         = info3.ItemDescription;
                    item.ItemHomeSiteDescription = info3.ItemDescription;
                    totalWeight                 += info3.ItemWeight * info3.Quantity;
                    info.PurchaseOrderItems.Add(item);
                }
                ShippingModeInfo shippingMode = SubsiteSalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true);
                info.ShipTo = this.txtShipTo.Text.Trim();
                if (this.rsddlRegion.GetSelectedRegionId().HasValue)
                {
                    info.RegionId = this.rsddlRegion.GetSelectedRegionId().Value;
                }
                info.Address             = Globals.HtmlEncode(this.txtAddress.Text.Trim());
                info.TelPhone            = this.txtTel.Text.Trim();
                info.ZipCode             = this.txtZipcode.Text.Trim();
                info.CellPhone           = this.txtMobile.Text.Trim();
                info.OrderId             = null;
                info.RealShippingModeId  = this.radioShippingMode.SelectedValue.Value;
                info.RealModeName        = shippingMode.Name;
                info.ShippingModeId      = this.radioShippingMode.SelectedValue.Value;
                info.ModeName            = shippingMode.Name;
                info.AdjustedFreight     = SubsiteSalesHelper.CalcFreight(info.RegionId, totalWeight, shippingMode);
                info.Freight             = info.AdjustedFreight;
                info.ShippingRegion      = this.rsddlRegion.SelectedRegions;
                info.Remark              = Globals.HtmlEncode(this.txtRemark.Text.Trim());
                info.PurchaseStatus      = OrderStatus.WaitBuyerPay;
                info.DistributorId       = user.UserId;
                info.Distributorname     = user.Username;
                info.DistributorEmail    = user.Email;
                info.DistributorRealName = user.RealName;
                info.DistributorQQ       = user.QQ;
                info.DistributorWangwang = user.Wangwang;
                info.DistributorMSN      = user.MSN;
                info.RefundStatus        = RefundStatus.None;
                info.Weight              = totalWeight;
            }
            return(info);
        }
Exemplo n.º 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.btnConfirmPay.Click += new EventHandler(this.btnConfirmPay_Click);
     this.btnBack.Click       += new EventHandler(this.btnBack_Click);
     this.btnBack1.Click      += new EventHandler(this.btnBack_Click);
     this.imgBtnBack.Click    += new ImageClickEventHandler(this.btnBack_Click);
     if (string.IsNullOrEmpty(base.Request.QueryString["PurchaseOrderId"]))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         this.purchaseOrderId = base.Request.QueryString["PurchaseOrderId"];
         this.purchaseOrder   = SubsiteSalesHelper.GetPurchaseOrder(this.purchaseOrderId);
         if (!base.IsPostBack)
         {
             if (this.purchaseOrder == null)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 int num;
                 int.TryParse(base.Request["PayMode"], out num);
                 PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(num);
                 if ((num > 0) && (paymentMode.Gateway != "hishop.plugins.payment.advancerequest"))
                 {
                     SubsiteStoreHelper.GetDistributor();
                     string showUrl = Globals.FullPath(Globals.GetSiteUrls().Home);
                     if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest")
                     {
                         showUrl = base.Server.UrlEncode(string.Format("http://{0}/shopadmin/purchaseorder/MyPurchaseOrderDetails.aspx?purchaseOrderId={1}", base.Request.Url.Host, this.purchaseOrder.PurchaseOrderId));
                     }
                     if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0)
                     {
                         showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { this.purchaseOrder.PurchaseOrderId }));
                     }
                     if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0)
                     {
                         showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { this.purchaseOrder.PurchaseOrderId }));
                     }
                     string     attach = "";
                     HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()];
                     if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value))
                     {
                         attach = cookie.Value;
                     }
                     PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.purchaseOrder.PurchaseOrderId, this.purchaseOrder.GetPurchaseTotal(), "采购单支付", "采购单号-" + this.purchaseOrder.PurchaseOrderId, "", this.purchaseOrder.PurchaseDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentNotify_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest();
                 }
                 if (this.purchaseOrder.IsManualPurchaseOrder)
                 {
                     this.litorder.Visible   = false;
                     this.litOrderId.Visible = false;
                 }
                 else
                 {
                     this.litOrderId.Text = this.purchaseOrder.OrderId;
                 }
                 this.litPurchaseOrderId.Text = this.purchaseOrder.PurchaseOrderId;
                 this.lblPurchaseDate.Time    = this.purchaseOrder.PurchaseDate;
                 this.lblTotalPrice.Money     = this.purchaseOrder.GetPurchaseTotal();
                 AccountSummaryInfo myAccountSummary = SubsiteStoreHelper.GetMyAccountSummary();
                 this.lblUseableBalance.Money = myAccountSummary.UseableBalance;
             }
         }
     }
 }