Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["preSaleId"], out this.preSaleId))
     {
         base.GotoResourceNotFound();
     }
     else if (!this.Page.IsPostBack)
     {
         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.preSaleId);
         if (productPreSaleInfo == null || productPreSaleInfo.ProductId <= 0)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             Literal literal = this.litProductSaleAmount;
             int     num     = ProductPreSaleHelper.GetPreSaleProductAmount(this.preSaleId);
             literal.Text = num.ToString();
             Literal literal2 = this.litPayAllProductAmount;
             num           = ProductPreSaleHelper.GetPreSalePayFinalPaymentAmount(this.preSaleId);
             literal2.Text = num.ToString();
             this.litPayDepositTotal.Text   = ProductPreSaleHelper.GetPayDepositTotal(this.preSaleId).F2ToString("f2");
             this.litFinalPaymentTotal.Text = ProductPreSaleHelper.GetPayFinalPaymentTotal(this.preSaleId).F2ToString("f2");
             this.litAllTotal.Text          = (ProductPreSaleHelper.GetPayFinalPaymentTotal(this.preSaleId) + ProductPreSaleHelper.GetPayDepositTotal(this.preSaleId)).F2ToString("f2");
         }
     }
 }
Exemplo n.º 2
0
        public bool CanConfirmOfflineReceipt(OrderModel order, bool isStore = true)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            bool         result         = false;

            if (order.OrderStatus == OrderStatus.WaitBuyerPay && order.Gateway != "hishop.plugins.payment.podrequest" && order.FightGroupId == 0)
            {
                result = (order.ShippingModeId != -2);
                if (masterSettings.OpenMultStore && order.ShippingModeId == -2 && order.PaymentTypeId != -3)
                {
                    result = true;
                }
                if (order.PreSaleId > 0)
                {
                    if (order.DepositDate.HasValue)
                    {
                        result = false;
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
                        if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now)
                        {
                            result = true;
                        }
                    }
                }
                else if (!isStore)
                {
                    result = false;
                    if (order.ParentOrderId == "0" || order.ParentOrderId == "-1")
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }
Exemplo n.º 3
0
 private bool CheckPresaleInfo()
 {
     if (this.PresaleId > 0)
     {
         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.PresaleId);
         if (productPreSaleInfo == null)
         {
             this.ShowWapMessage("活动不存在!", "");
             return(false);
         }
         if (this.productSku.Split(',').Length > 1)
         {
             base.GotoResourceNotFound("");
             return(false);
         }
         if (!ProductPreSaleHelper.HasProductPreSaleInfo(this.productSku, this.PresaleId))
         {
             base.GotoResourceNotFound("");
             return(false);
         }
         return(true);
     }
     base.GotoResourceNotFound("");
     return(false);
 }
Exemplo n.º 4
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(base.Text))
            {
                base.Text = "我要咨询";
            }
            int num  = RouteConfig.GetParameter(this.Page, "countDownId", false).ToInt(0);
            int num2 = RouteConfig.GetParameter(this.Page, "groupBuyId", false).ToInt(0);
            int num3 = RouteConfig.GetParameter(this.Page, "PreSaleId", false).ToInt(0);

            if (num > 0)
            {
                CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, 0);
                if (countDownInfo != null)
                {
                    base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new
                    {
                        countDownInfo.ProductId
                    });
                }
            }
            else if (num2 > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num2);
                if (groupBuy != null)
                {
                    base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new
                    {
                        groupBuy.ProductId
                    });
                }
            }
            else if (num3 > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(num3);
                if (productPreSaleInfo != null)
                {
                    base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new
                    {
                        productPreSaleInfo.ProductId
                    });
                }
            }
            else
            {
                base.NavigateUrl = base.GetRouteUrl("ProductConsultations", new
                {
                    ProductId = RouteConfig.GetParameter(this.Page, "productId", false)
                });
            }
            base.Render(writer);
        }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["preSaleId"], out this.preSaleId))
     {
         base.GotoResourceNotFound();
     }
     else if (!this.Page.IsPostBack)
     {
         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.preSaleId);
         if (productPreSaleInfo == null || productPreSaleInfo.ProductId <= 0)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             this.hidProductId.Value = productPreSaleInfo.ProductId.ToString();
             string text = Globals.HostPath(HttpContext.Current.Request.Url) + "/ProductDetails.aspx?productId=" + productPreSaleInfo.ProductId;
             this.lblReferralsLink.Text = text;
         }
     }
 }
Exemplo n.º 6
0
        protected override void AttachChildControls()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       empty          = string.Empty;

            this.spandemo         = (HtmlGenericControl)this.FindControl("spandemo");
            this.spandemo.Visible = masterSettings.IsDemoSite;
            this.litShipTo        = (Literal)this.FindControl("litShipTo");
            this.litCellPhone     = (Literal)this.FindControl("litCellPhone");
            this.litAddress       = (Literal)this.FindControl("litAddress");
            this.rptCartProducts  = (Common_SubmmitCartProducts)this.FindControl("Common_SubmmitCartProducts");
            this.rptCartProducts.ItemDataBound += this.rptCartProducts_ItemDataBound;
            this.rptCartGifts                = (WapTemplatedRepeater)this.FindControl("rptCartGifts");
            this.rptCartPointGifts           = (WapTemplatedRepeater)this.FindControl("rptCartPointGifts");
            this.divGifts                    = (HtmlGenericControl)this.FindControl("divGifts");
            this.dropCoupon                  = (Common_CouponSelect)this.FindControl("dropCoupon");
            this.lblOrderTotal               = (Label)this.FindControl("lblOrderTotal");
            this.groupbuyHiddenBox           = (HtmlInputControl)this.FindControl("groupbuyHiddenBox");
            this.countdownHiddenBox          = (HtmlInputControl)this.FindControl("countdownHiddenBox");
            this.fightGroupHiddenBox         = (HtmlInputControl)this.FindControl("fightGroupHiddenBox");
            this.fightGroupActivityHiddenBox = (HtmlInputControl)this.FindControl("fightGroupActivityHiddenBox");
            this.lblTotalPrice               = (HtmlGenericControl)this.FindControl("lblTotalPrice");
            this.lblTotalPrice1              = (HtmlGenericControl)this.FindControl("lblTotalPrice1");
            this.lblTax                    = (HtmlGenericControl)this.FindControl("lblTax");
            this.rptPromotions             = (WapTemplatedRepeater)this.FindControl("rptPromotions");
            this.rptShippingType           = (WapTemplatedRepeater)this.FindControl("rptShippingType");
            this.paymenttypeselect         = (Common_WAPPaymentTypeSelect)this.FindControl("paymenttypeselect");
            this.hidIsMultiStore           = (HtmlInputHidden)this.FindControl("hidIsMultiStore");
            this.hdCurrentckIds            = (HtmlInputControl)this.FindControl("hdCurrentckIds");
            this.hidShoppingDeduction      = (HtmlInputHidden)this.FindControl("hidShoppingDeduction");
            this.hidCanPointUseWithCoupon  = (HtmlInputHidden)this.FindControl("hidCanPointUseWithCoupon");
            this.lblMaxPoints              = (Label)this.FindControl("lblMaxPoints");
            this.hidTotalPrice             = (HtmlInputHidden)this.FindControl("hidTotalPrice");
            this.txtUsePoints              = (HtmlInputText)this.FindControl("txtUsePoint");
            this.hidShoppingDeductionRatio = (HtmlInputHidden)this.FindControl("hidShoppingDeductionRatio");
            this.hidMyPoints               = (HtmlInputHidden)this.FindControl("hidMyPoints");
            this.hidOrderRate              = (HtmlInputHidden)this.FindControl("hidOrderRate");
            this.inputPaymentModeId        = (HtmlInputHidden)this.FindControl("inputPaymentModeId");
            this.hidStoreId                = (HtmlInputHidden)this.FindControl("hidStoreId");
            this.hidChooseStoreId          = (HtmlInputHidden)this.FindControl("hidChooseStoreId");
            this.hidStoreName              = (HtmlInputHidden)this.FindControl("hidStoreName");
            this.lblMaxPointsToPrice       = (Label)this.FindControl("lblMaxPointsToPrice");
            this.lblDeductibleMoney        = (HtmlGenericControl)this.FindControl("lblDeductibleMoney");
            this.litTaxRate                = (Label)this.FindControl("litTaxRate");
            this.hlkFeeFreight             = (HyperLink)this.FindControl("hlkFeeFreight");
            this.hlkReducedPromotion       = (HyperLink)this.FindControl("hlkReducedPromotion");
            this.rptOrderCoupon            = (WapTemplatedRepeater)this.FindControl("rptOrderCoupon");
            this.htmlCouponCode            = (HtmlInputHidden)this.FindControl("htmlCouponCode");
            this.couponName                = (HtmlGenericControl)this.FindControl("couponName");
            this.litCouponAmout            = (HtmlGenericControl)this.FindControl("litCouponAmout");
            this.hidCanUsePoint            = (HtmlInputHidden)this.FindControl("hidCanUsePoint");
            this.divTax                    = (HtmlGenericControl)this.FindControl("divTax");
            this.spanTaxRate               = (HtmlGenericControl)this.FindControl("spanTaxRate");
            this.lblGiftFeright            = (Label)this.FindControl("lblGiftFeright");
            this.hidHasSupplierProduct     = (HtmlInputHidden)this.FindControl("hidHasSupplierProduct");
            this.hidPointRate              = (HtmlInputHidden)this.FindControl("hidPointRate");
            this.divlinegifts              = (HtmlGenericControl)this.FindControl("divlinegifts");
            this.hidOnlinePayCount         = (HtmlInputHidden)this.FindControl("hidOnlinePayCount");
            this.hidHasStoresInCity        = (HtmlInputHidden)this.FindControl("hidHasStoresInCity");
            this.hidPaymentId_Offline      = (HtmlInputHidden)this.FindControl("hidPaymentId_Offline");
            this.storeName                 = (HtmlGenericControl)this.FindControl("storeName");
            this.storeTel                  = (HtmlGenericControl)this.FindControl("storeTel");
            this.storeAddress              = (HtmlGenericControl)this.FindControl("storeAddress");
            this.storeTime                 = (HtmlGenericControl)this.FindControl("storeTime");
            this.storeDistance             = (HtmlGenericControl)this.FindControl("storeDistance");
            this.hidIsSubmitInTime         = (HtmlInputHidden)this.FindControl("hidIsSubmitInTime");
            this.hidInputItemsJson         = (HtmlInputHidden)this.FindControl("hidInputItemsJson");
            this.hidInvoiceType            = (HtmlInputHidden)this.FindControl("hidInvoiceType");
            this.hidInvoiceTitle           = (HtmlInputHidden)this.FindControl("hidInvoiceTitle");
            this.hidInvoiceTaxpayerNumber  = (HtmlInputHidden)this.FindControl("hidInvoiceTaxpayerNumber");
            this.hidOpenBalancePay         = (HtmlInputHidden)this.FindControl("hidOpenBalancePay");
            this.hidBalanceAmount          = (HtmlInputHidden)this.FindControl("hidBalanceAmount");
            this.lblBalance                = (Label)this.FindControl("lblBalance");
            this.hidEnableTax              = (HtmlInputHidden)this.FindControl("hidEnableTax");
            this.hidEnableETax             = (HtmlInputHidden)this.FindControl("hidEnableETax");
            this.hidEnableVATTax           = (HtmlInputHidden)this.FindControl("hidEnableVATTax");
            this.hidVATTaxRate             = (HtmlInputHidden)this.FindControl("hidVATTaxRate");
            this.hidTaxRate                = (HtmlInputHidden)this.FindControl("hidTaxRate");
            this.hidVATInvoiceDays         = (HtmlInputHidden)this.FindControl("hidVATInvoiceDays");
            this.litAfterSaleDays          = (Literal)this.FindControl("litAfterSaleDays");
            this.litInvoiceSendDays        = (Literal)this.FindControl("litInvoiceSendDays");
            this.hidInvoiceId              = (HtmlInputHidden)this.FindControl("hidInvoiceId");
            this.hidIsPersonal             = (HtmlInputHidden)this.FindControl("hidIsPersonal");
            this.hidInvoiceType            = (HtmlInputHidden)this.FindControl("hidInvoiceType");
            this.hidInvoiceJson            = (HtmlInputHidden)this.FindControl("hidInvoiceJson");
            this.hidInvoiceTitle           = (HtmlInputHidden)this.FindControl("hidInvoiceTitle");
            this.hidInvoiceTaxpayerNumber  = (HtmlInputHidden)this.FindControl("hidInvoiceTaxpayerNumber");
            this.hidOpenBalancePay.Value   = masterSettings.OpenBalancePay.ToNullString().ToLower();
            HtmlInputHidden htmlInputHidden = this.hidEnableETax;
            bool            flag            = masterSettings.EnableTax;

            htmlInputHidden.Value = flag.ToString().ToLower();
            HtmlInputHidden htmlInputHidden2 = this.hidEnableTax;

            flag = masterSettings.EnableE_Invoice;
            htmlInputHidden2.Value = flag.ToString().ToLower();
            HtmlInputHidden htmlInputHidden3 = this.hidEnableVATTax;

            flag = masterSettings.EnableVATInvoice;
            htmlInputHidden3.Value       = flag.ToString().ToLower();
            this.hidVATTaxRate.Value     = masterSettings.VATTaxRate.ToNullString();
            this.hidTaxRate.Value        = masterSettings.TaxRate.ToNullString();
            this.hidVATInvoiceDays.Value = masterSettings.VATInvoiceDays.ToNullString();
            this.litAfterSaleDays.SetWhenIsNotNull(masterSettings.EndOrderDays.ToNullString());
            this.litInvoiceSendDays.SetWhenIsNotNull((masterSettings.EndOrderDays + masterSettings.VATInvoiceDays).ToNullString());
            this.hidOpenBalancePay.Value = masterSettings.OpenBalancePay.ToNullString().ToLower();
            this.hidIsPreSale            = (HtmlInputHidden)this.FindControl("hidIsPreSale");
            this.lblAmount           = (HtmlGenericControl)this.FindControl("lblAmount");
            this.lblDepositMoney     = (HtmlGenericControl)this.FindControl("lblDepositMoney");
            this.lblRetainage        = (HtmlGenericControl)this.FindControl("lblRetainage");
            this.hidHasTradePassword = (HtmlInputHidden)this.FindControl("hidHasTradePassword");
            this.hidIsGeneralMuti    = (HtmlInputHidden)this.FindControl("hidIsGeneralMuti");
            if (this.hidPointRate != null)
            {
                this.hidPointRate.Value = HiContext.Current.SiteSettings.PointsRate.F2ToString("f2");
            }
            this.buyAmount                = this.Page.Request.QueryString["buyAmount"].ToInt(0);
            this.productSku               = this.Page.Request.QueryString["productSku"].ToNullString();
            this.groupBuyId               = this.Page.Request.QueryString["groupBuyId"].ToInt(0);
            this.countDownId              = this.Page.Request.QueryString["countdownId"].ToInt(0);
            this.fightGroupActivityId     = this.Page.Request.QueryString["fightGroupActivityId"].ToInt(0);
            this.fightGroupId             = this.Page.Request.QueryString["fightGroupId"].ToInt(0);
            this.hidHasStoresInCity.Value = "false";
            if (this.buyAmount > 0 && !string.IsNullOrEmpty(this.productSku) && !string.IsNullOrEmpty(this.from) && (this.from == "signbuy" || this.from == "groupbuy" || this.from == "countdown" || this.from == "fightgroup" || this.from == "presale"))
            {
                if (this.isGroupBuy)
                {
                    this.groupbuyHiddenBox.SetWhenIsNotNull(this.groupBuyId.ToString());
                    this.cart = ShoppingCartProcessor.GetGroupBuyShoppingCart(this.productSku, this.buyAmount);
                }
                else if (this.isCountDown)
                {
                    this.countdownHiddenBox.SetWhenIsNotNull(this.countDownId.ToString());
                }
                else if (this.isFightGroup)
                {
                    this.fightGroupHiddenBox.SetWhenIsNotNull(this.fightGroupId.ToString());
                    this.fightGroupActivityHiddenBox.SetWhenIsNotNull(this.fightGroupActivityId.ToString());
                }
                else if (this.isPreSale)
                {
                    this.hidIsPreSale.Value = "1";
                    this.FindControl("ulpresale").Visible = true;
                }
                this.hdCurrentckIds.Value = this.productSku;
            }
            else
            {
                string value = string.Empty;
                if (string.IsNullOrEmpty(this.productSku))
                {
                    HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["ckids"];
                    if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                    {
                        value = Globals.UrlDecode(httpCookie.Value);
                    }
                }
                else
                {
                    value = this.productSku;
                }
                this.hdCurrentckIds.Value = value;
            }
            if (this.cart != null && ((this.cart.LineItems != null && this.cart.LineItems.Count > 0) || (this.cart.LineGifts != null && this.cart.LineGifts.Count > 0)))
            {
                if (!TradeHelper.CheckShoppingStock(this.cart, out empty, this.storeId))
                {
                    this.ShowWapMessage("订单中有商品(" + empty + ")库存不足", "ShoppingCart.aspx");
                }
                this.hidOnlinePayCount.Value = TradeHelper.WapPaymentTypeCount(base.ClientType, this.isFightGroup).ToNullString();
                this.bindShippingPaymentInfo();
                this.divTax.Visible = false;
                Label   label = this.litTaxRate;
                decimal num   = masterSettings.TaxRate;
                label.Text = num.ToString(CultureInfo.InvariantCulture);
                this.spanTaxRate.Visible = (masterSettings.TaxRate > decimal.Zero);
                this.hidOrderRate.Value  = ((masterSettings.TaxRate > decimal.Zero) ? (this.cart.GetTotal(this.storeId > 0) * masterSettings.TaxRate / 100m).F2ToString("f2") : "0.00");
                MemberInfo user = Users.GetUser(HiContext.Current.UserId);
                this.hidHasTradePassword.Value = (string.IsNullOrWhiteSpace(user.TradePassword) ? "0" : "1");
                this.hidBalanceAmount.Value    = (user.Balance - user.RequestBalance).F2ToString("f2");
                this.lblBalance.Text           = (user.Balance - user.RequestBalance).F2ToString("f2");
                this.bindCouponInfo();
                this.rptCartProducts.RegionId = this.userRegionId;
                var dataSource = (from i in (from i in this.cart.LineItems
                                             select new
                {
                    i.SupplierId,
                    i.SupplierName
                }).Distinct()
                                  orderby i.SupplierId
                                  select i).ToList();
                this.rptCartProducts.DataSource   = dataSource;
                this.rptCartProducts.ShoppingCart = this.cart;
                this.rptCartProducts.StoreId      = this.storeId;
                this.rptCartProducts.DataBind();
                if ((from i in this.cart.LineItems
                     where i.SupplierId == 0
                     select i).Count() <= 0)
                {
                    this.divTax.Visible = false;
                }
                if ((from i in this.cart.LineItems
                     where i.SupplierId > 0
                     select i).Count() > 0)
                {
                    this.hidHasSupplierProduct.Value = "1";
                }
                if (this.isPreSale)
                {
                    decimal            num2 = default(decimal);
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.PresaleId);
                    if (this.cart != null)
                    {
                        num2 = ((productPreSaleInfo.Deposit == decimal.Zero) ? (this.cart.LineItems[0].MemberPrice * (decimal)productPreSaleInfo.DepositPercent / 100m) : productPreSaleInfo.Deposit) * (decimal)this.cart.LineItems[0].Quantity;
                    }
                    this.lblTotalPrice.InnerHtml = this.cart.GetAmount(false).F2ToString("f2");
                    HtmlGenericControl htmlGenericControl = this.lblTotalPrice1;
                    Label  label2 = this.lblOrderTotal;
                    string text3  = htmlGenericControl.InnerText = (label2.Text = num2.F2ToString("f2"));
                    this.lblDepositMoney.InnerText = num2.F2ToString("f2");
                    decimal num3 = this.cart.GetTotal(false) - num2;
                    if (num3 < decimal.Zero)
                    {
                        num3 = default(decimal);
                    }
                    this.lblRetainage.InnerText = num3.F2ToString("f2");
                    this.lblAmount.InnerText    = (num2 + num3).F2ToString("f2");
                    HtmlInputHidden htmlInputHidden4 = this.hidTotalPrice;
                    num = this.cart.GetTotal(false);
                    htmlInputHidden4.Value = num.ToString();
                }
                else
                {
                    HtmlInputHidden    htmlInputHidden5    = this.hidTotalPrice;
                    Label              label3              = this.lblOrderTotal;
                    string             text3               = htmlInputHidden5.Value = (label3.Text = this.cart.GetTotal(this.storeId > 0).F2ToString("f2"));
                    HtmlGenericControl htmlGenericControl2 = this.lblTotalPrice1;
                    HtmlGenericControl htmlGenericControl3 = this.lblTotalPrice;
                    text3 = (htmlGenericControl2.InnerText = (htmlGenericControl3.InnerHtml = this.cart.GetAmount(this.storeId > 0).F2ToString("f2")));
                }
                if (this.cart != null)
                {
                    this.BindSendGifts();
                    if (this.storeId <= 0)
                    {
                        this.BindPointGifts();
                    }
                }
                this.hidCanPointUseWithCoupon.Value = "false";
                this.hidCanUsePoint.Value           = "false";
                bool flag2 = true;
                if (this.isGroupBuy || this.isCountDown || this.cart.LineItems.Count == 0 || this.isFightGroup)
                {
                    flag2 = false;
                }
                if (flag2 && user != null && masterSettings.ShoppingDeduction > 0 && user.Points > 0)
                {
                    int     shoppingDeductionRatio = masterSettings.ShoppingDeductionRatio;
                    decimal num4 = (decimal)shoppingDeductionRatio * this.cart.GetTotal(this.storeId > 0) * (decimal)masterSettings.ShoppingDeduction / 100m;
                    int     num5 = ((decimal)user.Points > num4) ? ((int)num4) : user.Points;
                    decimal d2   = Math.Round((decimal)num5 / (decimal)masterSettings.ShoppingDeduction, 2);
                    if (d2 > decimal.Zero && num5 > 0)
                    {
                        HtmlInputHidden htmlInputHidden6 = this.hidShoppingDeduction;
                        int             num6             = masterSettings.ShoppingDeduction;
                        htmlInputHidden6.Value               = num6.ToString();
                        this.lblMaxPoints.Text               = num5.ToString();
                        this.lblMaxPointsToPrice.Text        = (num5 / masterSettings.ShoppingDeduction).F2ToString("f2");
                        this.hidCanPointUseWithCoupon.Value  = (masterSettings.CanPointUseWithCoupon ? "true" : "false");
                        this.hidShoppingDeductionRatio.Value = shoppingDeductionRatio.ToString();
                        HtmlInputHidden htmlInputHidden7 = this.hidMyPoints;
                        num6 = user.Points;
                        htmlInputHidden7.Value    = num6.ToString();
                        this.hidCanUsePoint.Value = "true";
                    }
                }
                this.bindPromtionsInfo();
                this.BindLastInvoiceInfo();
                ShoppingCartItemInfo shoppingCartItemInfo = this.cart.LineItems.FirstOrDefault();
                int         productId          = shoppingCartItemInfo.ProductId;
                ProductInfo productBaseDetails = ProductHelper.GetProductBaseDetails(productId);
                IList <ProductInputItemInfo> productInputItemList = ProductHelper.GetProductInputItemList(productId);
                this.hidIsGeneralMuti.Value = productBaseDetails.IsGenerateMore.ToNullString().ToLower();
                string value2 = JsonConvert.SerializeObject(new
                {
                    list = from d in productInputItemList
                           select new
                    {
                        d.Id,
                        d.InputFieldTitle,
                        d.InputFieldType,
                        d.IsRequired,
                        d.InputFileValues
                    }
                });
                this.hidInputItemsJson.Value = value2;
                PageTitle.AddSiteNameTitle("订单确认");
            }
            else if (!this.hasError)
            {
                this.ShowWapMessage("该订单没有任何商品,请重新选择", "default.aspx");
            }
        }
Exemplo n.º 7
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            string value  = this.hdorderId.Value;
            int    modeId = 0;

            int.TryParse(this.dropPayType.SelectedValue, out modeId);
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(modeId);
            OrderInfo       orderInfo   = TradeHelper.GetOrderInfo(value);
            string          msg         = "";

            if (!TradeHelper.CheckOrderStock(orderInfo, out msg))
            {
                this.ShowMessage(msg, false, "", 1);
            }
            else
            {
                IList <string> list = new List <string>();
                list.Add("hishop.plugins.payment.podrequest");
                list.Add("hishop.plugins.payment.bankrequest");
                if (orderInfo.CountDownBuyId > 0)
                {
                    if (list.Contains(paymentMode.Gateway.ToLower().Trim()))
                    {
                        msg = "限购的订单不支持货到付款和线下支付";
                        this.ShowMessage(msg, false, "", 1);
                        return;
                    }
                    foreach (LineItemInfo value2 in orderInfo.LineItems.Values)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(value2.ProductId, orderInfo.CountDownBuyId, value2.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out msg, orderInfo.StoreId);
                        if (countDownInfo == null)
                        {
                            this.ShowMessage(msg, false, "", 1);
                            return;
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    if (paymentMode == null || (!TradeHelper.GatewayIsCanBackReturn(paymentMode.Gateway) && paymentMode.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1)))
                    {
                        this.ShowMessage("火拼团订单不支付该支付方式进行支付", false, "", 1);
                        return;
                    }
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem.Value.Quantity, out msg);
                        if (fightGroupActivityInfo == null)
                        {
                            this.ShowMessage(msg, false, "", 1);
                            return;
                        }
                    }
                }
                if (orderInfo.GroupBuyId > 0 && list.Contains(paymentMode.Gateway.ToLower().Trim()))
                {
                    msg = "团购的订单不支持货到付款和线下支付";
                    this.ShowMessage(msg, false, "", 1);
                }
                else
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        if (paymentMode.Gateway.ToLower().Trim() == "hishop.plugins.payment.podrequest")
                        {
                            this.ShowMessage("预售订单不支持货到付款", false, "", 1);
                            return;
                        }
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo == null)
                        {
                            this.ShowMessage("预售活动不存在,不能支付", false, "", 1);
                            return;
                        }
                        if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.ShowMessage("您支付晚了,预售活动已经结束", false, "", 1);
                            return;
                        }
                        if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                        {
                            if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                            {
                                this.ShowMessage("尾款支付尚未开始", false, "", 1);
                                return;
                            }
                            DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                            DateTime date     = dateTime.Date;
                            dateTime = DateTime.Now;
                            if (date < dateTime.Date)
                            {
                                this.ShowMessage("尾款支付已结束", false, "", 1);
                                return;
                            }
                        }
                    }
                    if (paymentMode != null)
                    {
                        orderInfo.PaymentTypeId = paymentMode.ModeId;
                        orderInfo.PaymentType   = paymentMode.Name;
                        orderInfo.Gateway       = paymentMode.Gateway;
                        TradeHelper.UpdateOrderPaymentType(orderInfo);
                    }
                    this.Page.Response.Redirect(base.GetRouteUrl("sendPayment", new
                    {
                        orderId = value
                    }));
                }
            }
        }
Exemplo n.º 8
0
        private DataGridViewModel <Dictionary <string, object> > GetDataList(OrderQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                DbQueryResult orders = OrderHelper.GetOrders(query);
                dataGridViewModel.rows  = DataHelper.DataTableToDictionary(orders.Data);
                dataGridViewModel.total = orders.TotalRecords;
                string[] orderIds = (from d in dataGridViewModel.rows
                                     select d["OrderId"].ToString()).ToArray();
                List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds);
                foreach (Dictionary <string, object> row in dataGridViewModel.rows)
                {
                    OrderInfo order = TradeHelper.GetOrderInfo(row["OrderId"].ToString());
                    row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, OrderType.NormalOrder));
                    row.Add("CanConfirmOrder", order.CanConfirmOrder());
                    row.Add("canCheckTake", order.CanConfirmTakeCode());
                    row.Add("canCloseOrder", this.CanClose(order, base.CurrentSiteSetting.OpenMultStore));
                    row.Add("canOfflineReceipt", OrderHelper.CanConfirmOfflineReceipt(order, false));
                    row.Add("CanEditPrice", this.CanEditPrice(order));
                    row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                    bool flag = order.CanSendGoods(base.CurrentSiteSetting.OpenMultStore);
                    if (base.CurrentSiteSetting.OpenMultStore && order.StoreId != 0)
                    {
                        flag = false;
                    }
                    row.Add("canSendGoods", flag);
                    row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                    bool flag2 = false;
                    if (base.CurrentSiteSetting.OpenMultStore && order.CountDownBuyId == 0 && order.BundlingId == 0 && order.ItemStatus == OrderItemStatus.Nomarl && (order.OrderStatus == OrderStatus.BuyerAlreadyPaid || (order.OrderStatus == OrderStatus.WaitBuyerPay && order.Gateway == "hishop.plugins.payment.podrequest")))
                    {
                        if (order.StoreId == -1)
                        {
                            flag2 = (order.LineItems.Count > 0);
                        }
                        else if (order.StoreId > 0)
                        {
                            flag2 = !order.IsConfirm;
                        }
                        else if (order.StoreId == 0)
                        {
                            flag2 = (order.ShippingModeId != -2 && order.LineItems.Count > 0);
                        }
                    }
                    row.Add("CanAllotStore", flag2);
                    RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                    if (refundInfo != null)
                    {
                        row.Add("IsCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && !order.IsStoreCollect);
                        row.Add("RefundId", refundInfo.RefundId);
                    }
                    bool   flag3  = false;
                    string value  = string.Empty;
                    string value2 = string.Empty;
                    if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null && order.OrderStatus == OrderStatus.ApplyForRefund)
                        {
                            flag3  = true;
                            value2 = "订单已申请退款";
                            value  = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                        else
                        {
                            int            num            = 0;
                            AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                            int            num2           = 0;
                            foreach (LineItemInfo value4 in order.LineItems.Values)
                            {
                                if (value4.ReturnInfo != null || value4.ReplaceInfo != null)
                                {
                                    ReturnInfo  returnInfo  = value4.ReturnInfo;
                                    ReplaceInfo replaceInfo = value4.ReplaceInfo;
                                    if (num == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                    {
                                        if (value4.ReturnInfo != null)
                                        {
                                            afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                            num2           = value4.ReturnInfo.ReturnId;
                                        }
                                        else
                                        {
                                            afterSaleTypes = AfterSaleTypes.Replace;
                                            num2           = value4.ReplaceInfo.ReplaceId;
                                        }
                                    }
                                    num++;
                                }
                            }
                            if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                            {
                                value2 = "订单中有商品正在退货/换货中";
                            }
                            else if (order.ReturnedCount > 0)
                            {
                                value2 = "订单中有商品已退货完成";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReplace)
                            {
                                value2 = "订单中有商品正在进行换货操作";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReturn)
                            {
                                value2 = "订单中有商品正在进行退货操作";
                            }
                            if (num > 0)
                            {
                                flag3 = true;
                                value = ((afterSaleTypes != AfterSaleTypes.ReturnAndRefund) ? ("ReplaceApplyDetail?ReplaceId=" + num2) : ("ReturnApplyDetail?ReturnId=" + num2));
                            }
                        }
                    }
                    row.Add("IsShowRefundIcon", flag3);
                    row.Add("RefundOperUrl", value);
                    row.Add("RefundTips", value2);
                    bool flag4 = false;
                    if (order.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId);
                        if (fightGroup != null)
                        {
                            row.Add("FightGroupActivityId", fightGroup.FightGroupActivityId);
                            if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed)
                            {
                                flag4 = true;
                            }
                        }
                    }
                    row.Add("FightGrouping", flag4);
                    if (order.StoreId > 0)
                    {
                        row.Add("StoreName", this.GetStoreName(order.StoreId));
                    }
                    if (order.LineItems.Count <= 0)
                    {
                        if (order.UserAwardRecordsId > 0)
                        {
                            row.Add("IsAwardOrder", true);
                        }
                        else
                        {
                            row.Add("IsGiftOrder", true);
                        }
                    }
                    if (order.PreSaleId > 0 && order.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
                        if (productPreSaleInfo != null)
                        {
                            string   value3 = "";
                            DateTime dateTime;
                            if (productPreSaleInfo.DeliveryDate.HasValue)
                            {
                                dateTime = productPreSaleInfo.DeliveryDate.Value;
                                value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                            else
                            {
                                DateTime payDate = order.PayDate;
                                if (order.PayDate != DateTime.MinValue)
                                {
                                    dateTime = order.PayDate;
                                    dateTime = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                    value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                                }
                            }
                            row.Add("SendGoodsTips", value3);
                        }
                    }
                }
            }
            return(dataGridViewModel);
        }
Exemplo n.º 9
0
 private void BindOrderBase(OrderInfo order)
 {
     this.litBalanceAmount.Text = "-" + order.BalanceAmount.F2ToString("f2");
     this.hidPreSaleId.Value    = order.PreSaleId.ToString();
     this.litOrderId.Text       = order.OrderId;
     this.lbltotalPrice.Money   = order.GetAmount(false);
     this.litAddDate.Time       = order.OrderDate;
     this.litAddOrderDate.Time  = order.OrderDate;
     if (order.PreSaleId > 0)
     {
         this.lblDeposit.Money      = order.Deposit;
         this.lblFinalPayment.Money = order.FinalPayment;
         if (order.DepositDate.HasValue)
         {
             this.hidIsPayDeposit.Value  = "1";
             this.litDepositPayDate.Time = order.DepositDate;
             ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
             int num;
             if (!(order.PayDate == DateTime.MinValue))
             {
                 DateTime payDate = order.PayDate;
                 num = 0;
             }
             else
             {
                 num = 1;
             }
             DateTime dateTime;
             if (num != 0)
             {
                 if (order.OrderStatus != OrderStatus.Closed)
                 {
                     if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                     {
                         Literal literal = this.litFinalPamentPayDate;
                         dateTime     = productPreSaleInfo.PaymentStartDate;
                         literal.Text = dateTime.ToString("yyyy.MM.dd") + "后开始尾款支付";
                     }
                     else
                     {
                         Literal literal2 = this.litFinalPamentPayDate;
                         dateTime      = productPreSaleInfo.PaymentEndDate;
                         literal2.Text = dateTime.ToString("yyyy.MM.dd") + "后终止交易";
                     }
                 }
             }
             else
             {
                 Literal literal3 = this.litFinalPamentPayDate;
                 dateTime      = order.PayDate;
                 literal3.Text = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
             }
         }
     }
     else
     {
         this.litPayDate.Time = order.PayDate;
     }
     this.litShipDate.Time               = order.ShippingDate;
     this.litResultDate.Time             = order.FinishDate;
     this.lblOrderStatus.OrderStatusCode = order.OrderStatus;
     this.lblOrderStatus.OrderItemStatus = order.ItemStatus;
     this.lblOrderStatus.ShipmentModelId = order.ShippingModeId;
     this.lblOrderStatus.IsConfirm       = order.IsConfirm;
     this.lblOrderStatus.Gateway         = order.Gateway;
     this.lblOrderStatus.PaymentTypeId   = order.PaymentTypeId;
     this.lblOrderStatus.PreSaleId       = order.PreSaleId;
     this.lblOrderStatus.DepositDate     = order.DepositDate;
     if (order.OrderStatus == OrderStatus.Closed)
     {
         this.lbCloseReason.Visible = true;
         this.litCloseReason.Text   = order.CloseReason;
     }
     if (order.RefundAmount > decimal.Zero)
     {
         this.lbRefundMoney.Visible = true;
         this.lblRefundTotal.Money  = order.RefundAmount;
     }
     else
     {
         this.lbRefundMoney.Visible = false;
     }
     this.litRemark.Text = order.Remark;
     this.JudgeOrderStatus(order);
 }
Exemplo n.º 10
0
        private void BindOrderInfo()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.order.BalanceAmount > decimal.Zero)
            {
                this.litBalanceAmount.Text = this.order.BalanceAmount.F2ToString("f2");
            }
            else
            {
                this.liBalanceAmount.Visible = false;
            }
            DateTime?nullable;
            DateTime dateTime;

            if (this.order.PreSaleId > 0)
            {
                this.litDeposit.Text = this.order.Deposit.F2ToString("f2");
                this.litFinal.Text   = this.order.FinalPayment.F2ToString("f2");
                nullable             = this.order.DepositDate;
                if (nullable.HasValue)
                {
                    Literal literal = this.litDepositDate;
                    nullable     = this.order.DepositDate;
                    literal.Text = nullable.ToString();
                }
                DateTime payDate = this.order.PayDate;
                if (this.order.PayDate != DateTime.MinValue)
                {
                    Literal literal2 = this.litFinalDate;
                    dateTime      = this.order.PayDate;
                    literal2.Text = dateTime.ToString();
                }
            }
            if (this.order.OrderStatus == OrderStatus.SellerAlreadySent && this.order.ItemStatus == OrderItemStatus.Nomarl)
            {
                this.ensureRecieved.Visible = true;
            }
            else
            {
                this.ensureRecieved.Visible = false;
            }
            if (this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished)
            {
                this.divOrderBtn.Visible = false;
            }
            if (string.IsNullOrEmpty(this.order.TakeCode) || string.IsNullOrEmpty(masterSettings.HiPOSAppId) || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.Closed)
            {
                this.lookupQRCode.Visible = false;
            }
            ProductPreSaleInfo productPreSaleInfo = null;
            int paymentTypeId;

            if (this.order.OrderStatus == OrderStatus.WaitBuyerPay && this.order.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1) && this.order.PaymentTypeId != -3)
            {
                if (this.order.PreSaleId > 0)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                    nullable           = this.order.DepositDate;
                    if (!nullable.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate > DateTime.Now)
                        {
                            this.btnToPay.Visible = true;
                            AttributeCollection attributes = this.btnToPay.Attributes;
                            paymentTypeId = this.order.PaymentTypeId;
                            attributes.Add("PaymentTypeId", paymentTypeId.ToString());
                            this.btnToPay.Attributes.Add("OrderId", this.orderId);
                            this.btnToPay.Attributes.Add("orderTotal", (this.order.Deposit - this.order.BalanceAmount).F2ToString("f2"));
                        }
                    }
                    else if (!(productPreSaleInfo.PaymentStartDate > DateTime.Now) && !(productPreSaleInfo.PaymentEndDate < DateTime.Now))
                    {
                        this.btnToPay.Visible = true;
                        AttributeCollection attributes2 = this.btnToPay.Attributes;
                        paymentTypeId = this.order.PaymentTypeId;
                        attributes2.Add("PaymentTypeId", paymentTypeId.ToString());
                        this.btnToPay.Attributes.Add("OrderId", this.orderId);
                        this.btnToPay.Attributes.Add("orderTotal", this.order.FinalPayment.F2ToString("f2"));
                    }
                }
                else
                {
                    AttributeCollection attributes3 = this.btnToPay.Attributes;
                    paymentTypeId = this.order.PaymentTypeId;
                    attributes3.Add("PaymentTypeId", paymentTypeId.ToString());
                    this.btnToPay.Visible = true;
                    this.btnToPay.Attributes.Add("OrderId", this.orderId);
                    this.btnToPay.Attributes.Add("orderTotal", this.order.GetTotal(true).F2ToString("f2"));
                    if (HiContext.Current.SiteSettings.OpenMultStore && this.order.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                    {
                        StoresInfo storeById = StoresHelper.GetStoreById(this.order.StoreId);
                        dateTime = DateTime.Now;
                        string str = dateTime.ToString("yyyy-MM-dd");
                        dateTime = storeById.OpenStartDate;
                        nullable = (str + " " + dateTime.ToString("HH:mm")).ToDateTime();
                        DateTime value = nullable.Value;
                        dateTime = DateTime.Now;
                        string str2 = dateTime.ToString("yyyy-MM-dd");
                        dateTime = storeById.OpenEndDate;
                        nullable = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime();
                        DateTime dateTime2 = nullable.Value;
                        if (dateTime2 <= value)
                        {
                            dateTime2 = dateTime2.AddDays(1.0);
                        }
                        if (DateTime.Now < value || DateTime.Now > dateTime2)
                        {
                            this.btnToPay.Attributes.Add("NeedNotInTimeTip", "1");
                        }
                    }
                }
                if (this.order.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.OfflinePay, 1))
                {
                    this.btnToPay.InnerText = "线下支付帮助";
                    this.btnToPay.HRef      = "FinishOrder.aspx?OrderId=" + this.order.OrderId + "&onlyHelp=true";
                }
            }
            if (this.order.ReducedPromotionAmount <= decimal.Zero)
            {
                this.liFullReduction.Visible = false;
            }
            LineItemInfo value2 = this.order.LineItems.FirstOrDefault().Value;
            string       text   = "长期有效";
            int          num;

            if (!value2.IsValid)
            {
                nullable = value2.ValidStartDate;
                if (nullable.HasValue)
                {
                    nullable = value2.ValidEndDate;
                    num      = (nullable.HasValue ? 1 : 0);
                    goto IL_06a5;
                }
            }
            num = 0;
            goto IL_06a5;
IL_06a5:
            if (num != 0)
            {
                nullable = value2.ValidStartDate;
                dateTime = nullable.Value;
                string arg = dateTime.ToString("yyyy-MM-dd");
                nullable = value2.ValidEndDate;
                dateTime = nullable.Value;
                text     = string.Format("有效期&nbsp;&nbsp;{0} ~ {1}", arg, dateTime.ToString("yyyy-MM-dd"));
            }
            this.lit_ValidDate.Text = text;
            IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(this.order.OrderId);
            ServiceOrderStatus serviceOrderStatus = this.GetOrderStatus(this.order, orderVerificationItems);

            this.litOrderStatus.Text = ((Enum)(object)serviceOrderStatus).ToDescription();
            this.CreateVerificationCodeQRCode(orderVerificationItems);
            this.rptVerCode.DataSource     = orderVerificationItems;
            this.rptVerCode.ItemDataBound += this.rptVerCode_ItemDataBound;
            this.rptVerCode.DataBind();
            this.litOrderId.Text = this.orderId;
            Literal literal3 = this.litOrderDate;

            dateTime      = this.order.OrderDate;
            literal3.Text = dateTime.ToString();
            this.litTotalPrice.SetWhenIsNotNull(this.order.GetAmount(false).F2ToString("f2"));
            Literal control = this.litPayTime;
            object  value3;

            if (!(this.order.PayDate != DateTime.MinValue))
            {
                value3 = "";
            }
            else
            {
                dateTime = this.order.PayDate;
                value3   = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            }
            control.SetWhenIsNotNull((string)value3);
            HtmlInputHidden control2 = this.orderStatus;

            paymentTypeId = (int)this.order.OrderStatus;
            control2.SetWhenIsNotNull(paymentTypeId.ToString());
            this.hidOrderId.SetWhenIsNotNull(this.orderId.ToString());
            this.litPaymentMode.SetWhenIsNotNull(this.order.PaymentType);
            this.litShipToDate.SetWhenIsNotNull(this.order.ShipToDate);
            if (this.order.PreSaleId > 0)
            {
                this.litBuildPrice.SetWhenIsNotNull((this.order.Deposit + this.order.FinalPayment).F2ToString("f2"));
            }
            else
            {
                this.litBuildPrice.SetWhenIsNotNull(this.order.GetPayTotal().F2ToString("f2"));
            }
            this.litRemark.SetWhenIsNotNull(this.order.Remark);
            this.litTakeCode.SetWhenIsNotNull((this.order.ShippingModeId == -2) ? this.order.TakeCode : "");
            this.litFreight.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.litFreight2.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.litFullCapacityReduction.SetWhenIsNotNull("-" + this.order.ReducedPromotionAmount.F2ToString("f2"));
            if (this.order.PreSaleId > 0)
            {
                if (productPreSaleInfo == null)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                }
                nullable = this.order.DepositDate;
                if (!nullable.HasValue)
                {
                    this.hidpresaleStaut.Value = "1";
                    if (this.order.OrderStatus == OrderStatus.Closed)
                    {
                        this.hidpresaleStaut.Value = "6";
                    }
                }
                else if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                {
                    this.hidpresaleStaut.Value = "2";
                }
                else if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                {
                    if (this.order.PayDate == DateTime.MinValue)
                    {
                        this.hidpresaleStaut.Value = "5";
                    }
                    else
                    {
                        this.hidpresaleStaut.Value = "4";
                    }
                }
                else if (this.order.PayDate == DateTime.MinValue)
                {
                    this.hidpresaleStaut.Value = "3";
                }
                else
                {
                    this.hidpresaleStaut.Value = "4";
                }
            }
        }
Exemplo n.º 11
0
        public void LoadOrderInfo()
        {
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay));

            if (paymentMode != null)
            {
                this.litOfflinePayContent.SetWhenIsNotNull(paymentMode.Description);
            }
            this.hidOrderid.Value = this.orderId;
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null || (orderInfo.UserId != 0 && orderInfo.UserId != HiContext.Current.UserId))
            {
                base.GotoResourceNotFound();
                return;
            }
            MemberInfo user = Users.GetUser(HiContext.Current.UserId);

            this.hidHasTradePassword.Value = (string.IsNullOrWhiteSpace(user.TradePassword) ? "0" : "1");
            if (orderInfo.ParentOrderId == "-1")
            {
                this.orderLink.HRef = base.GetRouteUrl("user_OrderList", new
                {
                    ParentOrderId = this.orderId
                });
                this.litOrderId.Text = OrderHelper.GetOrderIdsByParent(orderInfo.OrderId).Replace(",", "&nbsp;&nbsp;&nbsp;&nbsp;");
            }
            else
            {
                this.orderLink.HRef = base.GetRouteUrl("user_OrderDetails", new
                {
                    OrderId = this.orderId
                });
                this.litOrderId.Text = orderInfo.OrderId;
            }
            IList <string> paymentTypes = new List <string>();

            paymentTypes.Add("hishop.plugins.payment.podrequest");
            paymentTypes.Add("hishop.plugins.payment.bankrequest");
            paymentTypes.Add("hishop.plugins.payment.advancerequest");
            if (orderInfo.PreSaleId > 0)
            {
                this.litOrderPrice.Money = orderInfo.Deposit + orderInfo.FinalPayment;
            }
            else
            {
                this.litOrderPrice.Money = orderInfo.GetTotal(false);
            }
            if (orderInfo.PreSaleId > 0)
            {
                this.hidIsPreSale.Value = "1";
                if (!orderInfo.DepositDate.HasValue)
                {
                    this.litDeposittxt.Text = "定金:";
                    this.litDeposit.Money   = orderInfo.Deposit;
                }
                else
                {
                    this.litDeposittxt.Text = "尾款:";
                    this.litDeposit.Money   = orderInfo.FinalPayment;
                }
            }
            this.onlinePayPanel.Visible  = false;
            this.offlinePayPanel.Visible = false;
            int num;

            if ((orderInfo.PaymentTypeId != -3 || orderInfo.PaymentTypeId != -2) && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentType != "到店支付" && orderInfo.Gateway != "hishop.plugins.payment.podrequest")
            {
                num = ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) ? 1 : 0);
                goto IL_02ea;
            }
            num = 0;
            goto IL_02ea;
IL_02ea:
            if (num != 0)
            {
                this.onlinePayPanel.Visible = true;
            }
            else if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest")
            {
                this.offlinePayPanel.Visible = true;
            }
            string text = "";

            text = ((orderInfo.CountDownBuyId <= 0) ? (HiContext.Current.SiteSettings.CloseOrderDays + "天") : (HiContext.Current.SiteSettings.CountDownTime + "分钟"));
            PaymentModeInfo paymentMode2 = TradeHelper.GetPaymentMode("hishop.plugins.payment.podrequest");
            bool            flag         = false;

            if ((orderInfo.Gateway == "hishop.plugins.payment.podrequest" || (paymentMode2 != null && paymentMode2.ModeId == orderInfo.PaymentTypeId)) && orderInfo.PreSaleId <= 0)
            {
                flag = true;
            }
            switch (orderInfo.OrderStatus)
            {
            case OrderStatus.WaitBuyerPay:
                if (base.GetParameter("t", false).ToNullString() == "1")
                {
                    this.promptMsg.InnerHtml     = "银行系统可能会出现延时,如您已经支付,请耐心等待或者联系商家客服!";
                    this.msgTitle.InnerHtml      = "付款不成功,请重新支付!";
                    this.divfinish.Visible       = true;
                    this.onlinePayPanel.Visible  = false;
                    this.divOrderPayInfo.Visible = false;
                    this.imgPayResult.Src        = "/templates/pccommon/images/cart/ordererror.png";
                }
                if (orderInfo.PreSaleId > 0)
                {
                    if (orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        this.msgTitle.InnerHtml  = "恭喜您,您的定金已支付成功!";
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "请支付定金。";
                        this.msgTitle.InnerHtml  = "订单提交成功,请您尽快支付定金!";
                    }
                    this.divfinish.Visible = true;
                }
                if (flag)
                {
                    this.msgTitle.InnerHtml = "货到付款订单提交成功,平台将及时给您发货";
                }
                break;

            case OrderStatus.BuyerAlreadyPaid:
                if (orderInfo.PaymentType == "上门自提")
                {
                    this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您备货。";
                    this.msgTitle.InnerHtml  = "恭喜您,您的订单已支付成功!";
                }
                else
                {
                    this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您发货。";
                    this.msgTitle.InnerHtml  = "恭喜您,您的订单已支付成功!";
                }
                this.divfinish.Visible = true;
                break;

            case OrderStatus.Closed:
                this.promptMsg.InnerHtml = "您的订单已关闭,关闭原因:" + orderInfo.CloseReason + "。";
                this.msgTitle.InnerHtml  = "您的订单已关闭!";
                this.divfinish.Visible   = true;
                break;

            case OrderStatus.Finished:
                this.promptMsg.InnerHtml = "您的订单已完成.";
                this.msgTitle.InnerHtml  = "恭喜您,您的订单已完成!";
                this.divfinish.Visible   = true;
                break;

            case OrderStatus.SellerAlreadySent:
                this.promptMsg.InnerHtml = "您的订单已发货,请注意收货。";
                this.msgTitle.InnerHtml  = "恭喜您,您的订单已发货!";
                this.divfinish.Visible   = true;
                break;

            default:
                this.promptMsg.InnerHtml = "您的订单已提交成功。";
                this.divfinish.Visible   = true;
                break;
            }
            if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
            {
                this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您发货。";
            }
            else if (orderInfo.PaymentTypeId != -3 && !flag && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
            {
                DateTime dateTime;
                if (base.GetParameter("t", false).ToNullString() == "1")
                {
                    if (orderInfo.PreSaleId > 0 && orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            HtmlGenericControl htmlGenericControl = this.promptMsg;
                            string[]           obj = new string[5]
                            {
                                "定金支付成功,请您在",
                                null,
                                null,
                                null,
                                null
                            };
                            dateTime = productPreSaleInfo.PaymentStartDate;
                            obj[1]   = dateTime.ToString("yyyy-MM-dd");
                            obj[2]   = "至";
                            dateTime = productPreSaleInfo.PreSaleEndDate;
                            obj[3]   = dateTime.ToString("yyyy-MM-dd");
                            obj[4]   = "之间支付尾款,过期定金将不予以退还,请您谅解!";
                            htmlGenericControl.InnerHtml = string.Concat(obj);
                            this.onlinePayPanel.Visible  = false;
                        }
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "银行系统可能会出现延时,如您已经支付,请耐心等待或者联系商家客服!";
                    }
                }
                else if (orderInfo.PreSaleId > 0)
                {
                    if (orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        ProductPreSaleInfo productPreSaleInfo2 = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo2.PaymentStartDate > DateTime.Now)
                        {
                            HtmlGenericControl htmlGenericControl2 = this.promptMsg;
                            string[]           obj2 = new string[5]
                            {
                                "定金支付成功,请您在",
                                null,
                                null,
                                null,
                                null
                            };
                            dateTime = productPreSaleInfo2.PaymentStartDate;
                            obj2[1]  = dateTime.ToString("yyyy-MM-dd");
                            obj2[2]  = "至";
                            dateTime = productPreSaleInfo2.PaymentStartDate;
                            obj2[3]  = dateTime.ToString("yyyy-MM-dd");
                            obj2[4]  = "之间支付尾款,过期定金将不予以退还,请您谅解!";
                            htmlGenericControl2.InnerHtml = string.Concat(obj2);
                            this.onlinePayPanel.Visible   = false;
                        }
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "请您在订单提交后 <em>" + text + "</em>内完成定金支付,否则订单自动取消。";
                    }
                }
                else
                {
                    this.promptMsg.InnerHtml = "请您在订单提交后 <em>" + text + "</em>内完成支付,否则订单自动取消。";
                }
            }
            else if (flag)
            {
                this.promptMsg.InnerHtml = "您的订单选择了货到付款,平台将及时给您发货。";
            }
            else if (orderInfo.PaymentTypeId == -3)
            {
                this.promptMsg.InnerHtml = "您的订单选择了上门自提,门店正在备货中。";
            }
            if (this.onlinePayPanel.Visible)
            {
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add(new DataColumn("ModeId"));
                dataTable.Columns.Add(new DataColumn("Name"));
                dataTable.Columns.Add(new DataColumn("GateWay"));
                dataTable.Columns.Add(new DataColumn("Description"));
                dataTable.Columns.Add(new DataColumn("OutHtml"));
                IList <PaymentModeInfo> paymentModes = ShoppingProcessor.GetPaymentModes(PayApplicationType.payOnPC);
                paymentModes = (from item in paymentModes
                                where !paymentTypes.Contains(item.Gateway)
                                select item).ToList();
                if (HiContext.Current.UserId != 0 && HiContext.Current.User.IsOpenBalance)
                {
                    PaymentModeInfo paymentMode3 = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.advancerequest");
                    if (paymentMode3 != null)
                    {
                        this.AdvanceId.Value = paymentMode3.ModeId.ToString();
                        paymentModes.Add(paymentMode3);
                    }
                }
                if (paymentModes.Count == 0)
                {
                    this.ShowMessage("商城暂未配置支付方式,请稍后支付。", false, "", 1);
                    this.onlinePayPanel.Visible = false;
                }
                else
                {
                    decimal num2 = default(decimal);
                    if (HiContext.Current.User != null && HiContext.Current.User.UserId > 0)
                    {
                        num2 = HiContext.Current.User.Balance - HiContext.Current.User.RequestBalance;
                    }
                    string format  = "<a class=\"pic\"><b><img src=\"/pay/images/{0}.png\" alt=\"{1}\"></b> <span>{1}</span></a>";
                    string text2   = "<a class=\"name\"><em>{0}</em> <b>可用余额 ¥{1}</b> <span><a href=\"/user/RechargeRequest.aspx\" target=\"_blank\" style=\"line-height:4.5\">去充值</a></span></a>";
                    string format2 = "<a class=\"name\"><em>{0}</em></a>";
                    int    num3    = 0;
                    foreach (PaymentModeInfo item in paymentModes)
                    {
                        if (!(item.Gateway.ToLower() == "hishop.plugins.payment.advancerequest") && (orderInfo.FightGroupActivityId <= 0 || TradeHelper.GatewayIsCanBackReturn(item.Gateway) || !(item.Gateway.ToLower() != "hishop.plugins.payment.advancerequest")))
                        {
                            DataRow dataRow = dataTable.NewRow();
                            dataRow["ModeId"]      = item.ModeId;
                            dataRow["Name"]        = item.Name;
                            dataRow["Gateway"]     = item.Gateway;
                            dataRow["Description"] = item.Description;
                            if (!(item.Gateway.ToLower() == "hishop.plugins.payment.advancerequest"))
                            {
                                if (File.Exists(this.Page.Server.MapPath("/pay/images/" + item.Gateway + ".png")))
                                {
                                    dataRow["OutHtml"] = string.Format(format, item.Gateway, item.Name);
                                }
                                else
                                {
                                    dataRow["OutHtml"] = string.Format(format2, item.Name);
                                }
                                dataTable.Rows.Add(dataRow);
                                num3++;
                            }
                        }
                    }
                    this.paymentModeList.DataSource = dataTable;
                    this.paymentModeList.DataBind();
                }
            }
        }
Exemplo n.º 12
0
 private void rptOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         HtmlAnchor         htmlAnchor           = (HtmlAnchor)e.Item.FindControl("lkbtnCouponCode");
         HtmlAnchor         htmlAnchor2          = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
         HtmlAnchor         htmlAnchor3          = (HtmlAnchor)e.Item.FindControl("lnkClose");
         HtmlAnchor         htmlAnchor4          = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
         HtmlAnchor         htmlAnchor5          = (HtmlAnchor)e.Item.FindControl("lkbtnProductReview");
         Literal            literal              = (Literal)e.Item.FindControl("ltlOrderItems");
         Literal            literal2             = (Literal)e.Item.FindControl("ltlOrderGifts");
         HtmlGenericControl htmlGenericControl   = e.Item.FindControl("panelOperaters") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl2  = e.Item.FindControl("divToDetail") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl3  = e.Item.FindControl("divOrderStatus") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl4  = e.Item.FindControl("divOrderError") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl5  = e.Item.FindControl("divOrderGifts") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl6  = e.Item.FindControl("divOrderItems") as HtmlGenericControl;
         HtmlGenericControl htmlGenericControl7  = (HtmlGenericControl)e.Item.FindControl("OrderIdSpan");
         HtmlGenericControl htmlGenericControl8  = (HtmlGenericControl)e.Item.FindControl("PayMoneySpan");
         HtmlGenericControl htmlGenericControl9  = (HtmlGenericControl)e.Item.FindControl("TakeCodeDIV");
         HtmlAnchor         htmlAnchor6          = (HtmlAnchor)e.Item.FindControl("lnkViewLogistics");
         HtmlAnchor         htmlAnchor7          = (HtmlAnchor)e.Item.FindControl("lnkToPay");
         HtmlAnchor         htmlAnchor8          = (HtmlAnchor)e.Item.FindControl("lnkHelpLink");
         HtmlAnchor         htmlAnchor9          = (HtmlAnchor)e.Item.FindControl("lnkFinishOrder");
         HtmlAnchor         htmlAnchor10         = (HtmlAnchor)e.Item.FindControl("lnkViewTakeCodeQRCode");
         HtmlAnchor         htmlAnchor11         = (HtmlAnchor)e.Item.FindControl("lnkCertification");
         HtmlGenericControl htmlGenericControl10 = (HtmlGenericControl)e.Item.FindControl("divSendRedEnvelope");
         OrderStatus        orderStatus          = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
         Repeater           repeater             = (Repeater)e.Item.FindControl("Repeater1");
         Repeater           repeater2            = (Repeater)e.Item.FindControl("rptPointGifts");
         this.paymenttypeselect = (Common_WAPPaymentTypeSelect)this.FindControl("paymenttypeselect");
         Literal   literal3  = (Literal)e.Item.FindControl("litGiftTitle");
         string    text      = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
         OrderInfo orderInfo = TradeHelper.GetOrderInfo(text);
         if (orderInfo != null)
         {
             if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
             {
                 WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                 bool visible = false;
                 if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                 {
                     visible = true;
                 }
                 if (htmlGenericControl10 != null)
                 {
                     htmlGenericControl10.Visible = visible;
                     if (this.isVShop)
                     {
                         htmlGenericControl10.InnerHtml = "<a href=\"/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId + "\"></a>";
                     }
                     else
                     {
                         htmlGenericControl10.InnerHtml = "";
                         string text2 = Globals.HttpsFullPath("/vshop/SendRedEnvelope.aspx?OrderId=" + orderInfo.OrderId);
                         htmlGenericControl10.Attributes.Add("onclick", string.Format("ShowMsg('{0}','{1}')", "代金红包请前往微信端领取!", "false"));
                     }
                 }
             }
             this.paymenttypeselect.ClientType = base.ClientType;
             htmlGenericControl4.Visible       = (orderInfo.IsError && orderInfo.CloseReason != "订单已退款完成");
             htmlGenericControl3.Visible       = !orderInfo.IsError;
             htmlGenericControl5.Visible       = (orderInfo.LineItems.Count() == 0);
             htmlGenericControl6.Visible       = (orderInfo.LineItems.Count() > 0);
             htmlAnchor2.HRef   = "ApplyRefund.aspx?OrderId=" + text;
             htmlAnchor.Visible = false;
             htmlAnchor.HRef    = "MemberOrdersVCode?OrderId=" + text;
             HtmlGenericControl htmlGenericControl11 = (HtmlGenericControl)e.Item.FindControl("OrderSupplierH3");
             string             text3 = string.Empty;
             if (htmlGenericControl11 != null)
             {
                 text3 = htmlGenericControl11.Attributes["class"];
                 text3 = ((!string.IsNullOrEmpty(text3)) ? text3.Replace(" ztitle", "").Replace("stitle", "") : "");
             }
             if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
             {
                 if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                 {
                     htmlGenericControl7.InnerText = orderInfo.StoreName;
                     text3 += " mtitle";
                 }
                 else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                 {
                     htmlGenericControl7.InnerText = orderInfo.ShipperName;
                     text3 += " stitle";
                 }
                 else
                 {
                     htmlGenericControl7.InnerText = "平台";
                     text3 += " ztitle";
                 }
                 htmlGenericControl11.Attributes["class"] = text3;
                 if (orderInfo.LineItems.Count <= 0)
                 {
                     literal3.Text = "(礼)";
                 }
             }
             else
             {
                 htmlGenericControl7.InnerText            = orderInfo.OrderId;
                 htmlGenericControl11.Attributes["class"] = text3;
             }
             if (orderInfo.PreSaleId > 0)
             {
                 htmlGenericControl8.InnerText = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
             }
             else
             {
                 htmlGenericControl8.InnerText = Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem, "OrderTotal")).F2ToString("f2");
             }
             if (htmlGenericControl2 != null)
             {
                 if (orderInfo.OrderType == OrderType.ServiceOrder)
                 {
                     htmlGenericControl2.Attributes.Add("onclick", "window.location.href='ServiceMemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'");
                 }
                 else
                 {
                     htmlGenericControl2.Attributes.Add("onclick", "window.location.href='MemberOrderDetails.aspx?orderId=" + orderInfo.OrderId + "'");
                 }
             }
             if (htmlAnchor6 != null)
             {
                 if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent || orderInfo.OrderStatus == OrderStatus.Finished)
                 {
                     if (!string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber))
                     {
                         htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text;
                     }
                     else if (orderInfo.ExpressCompanyName == "同城物流配送")
                     {
                         htmlAnchor6.HRef = "MyLogistics.aspx?OrderId=" + text;
                     }
                     else
                     {
                         htmlAnchor6.Visible = false;
                     }
                 }
                 else
                 {
                     htmlAnchor6.Visible = false;
                 }
             }
             if (htmlAnchor10 != null)
             {
                 htmlAnchor10.HRef = "ViewQRCode.aspx?orderId=" + orderInfo.OrderId;
             }
             int num4;
             if (htmlAnchor5 != null && ((orderStatus == OrderStatus.Finished && orderInfo.LineItems.Count > 0) || (orderStatus == OrderStatus.Closed && orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count && orderInfo.LineItems.Count > 0)))
             {
                 htmlAnchor5.Visible = true;
                 htmlAnchor5.HRef    = "MemberSubmitProductReview.aspx?orderId=" + text;
                 DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(text);
                 LineItemInfo lineItemInfo     = new LineItemInfo();
                 int          num  = 0;
                 int          num2 = 0;
                 int          num3 = 0;
                 bool         flag = false;
                 foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                 {
                     flag         = false;
                     lineItemInfo = lineItem.Value;
                     for (int i = 0; i < productReviewAll.Rows.Count; i++)
                     {
                         num4 = lineItemInfo.ProductId;
                         if (num4.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                         {
                             flag = true;
                         }
                     }
                     if (!flag)
                     {
                         num2++;
                     }
                     else
                     {
                         num3++;
                     }
                 }
                 if (num + num2 == orderInfo.LineItems.Count)
                 {
                     htmlAnchor5.InnerText = "查看评论";
                 }
                 else
                 {
                     SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                     if (masterSettings != null)
                     {
                         if (masterSettings.ProductCommentPoint <= 0)
                         {
                             htmlAnchor5.InnerText = "评价";
                         }
                         else
                         {
                             htmlAnchor5.InnerText = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                         }
                     }
                 }
             }
             if (htmlAnchor3 != null && orderStatus == OrderStatus.WaitBuyerPay)
             {
                 if (orderInfo.PreSaleId == 0 || (orderInfo.PreSaleId > 0 && !orderInfo.DepositDate.HasValue))
                 {
                     htmlAnchor3.Visible = true;
                 }
                 htmlAnchor3.Attributes.Add("onclick", $"closeOrder('{text}')");
             }
             DateTime dateTime;
             if (htmlAnchor7 != null)
             {
                 if (orderStatus == OrderStatus.WaitBuyerPay && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.PaymentTypeId != -3 && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.Gateway != "hishop.plugins.payment.podrequest")
                 {
                     htmlAnchor7.Attributes.Add("IsServiceOrder", (orderInfo.OrderType == OrderType.ServiceOrder).ToString().ToLower());
                     if (orderInfo.PreSaleId > 0)
                     {
                         ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                         if (!orderInfo.DepositDate.HasValue)
                         {
                             htmlGenericControl8.InnerText = orderInfo.Deposit.F2ToString("f2");
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥";
                             if (productPreSaleInfo.PreSaleEndDate > DateTime.Now)
                             {
                                 AttributeCollection attributes = htmlAnchor7.Attributes;
                                 num4 = orderInfo.PaymentTypeId;
                                 attributes.Add("PaymentTypeId", num4.ToString());
                                 htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                                 htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.Deposit.F2ToString("f2"));
                                 AttributeCollection attributes2 = htmlAnchor7.Attributes;
                                 num4 = orderInfo.FightGroupId;
                                 attributes2.Add("FightGroupId", num4.ToString());
                             }
                             else
                             {
                                 htmlAnchor7.Visible = false;
                                 (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "定金:¥";
                             }
                         }
                         else if (productPreSaleInfo.PaymentStartDate > DateTime.Now || productPreSaleInfo.PaymentEndDate < DateTime.Now)
                         {
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥";
                             htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2");
                             htmlAnchor7.Visible           = false;
                             htmlAnchor3.Visible           = false;
                             if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                             {
                                 (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款支付结束";
                                 htmlGenericControl8.Visible = false;
                             }
                         }
                         else
                         {
                             AttributeCollection attributes3 = htmlAnchor7.Attributes;
                             num4 = orderInfo.PaymentTypeId;
                             attributes3.Add("PaymentTypeId", num4.ToString());
                             htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                             htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.FinalPayment.F2ToString("f2"));
                             AttributeCollection attributes4 = htmlAnchor7.Attributes;
                             num4 = orderInfo.FightGroupId;
                             attributes4.Add("FightGroupId", num4.ToString());
                             htmlGenericControl8.InnerText = orderInfo.FinalPayment.F2ToString("f2");
                             (e.Item.FindControl("sptotal") as HtmlGenericControl).InnerText = "尾款:¥";
                             htmlAnchor3.Visible = false;
                         }
                     }
                     else
                     {
                         AttributeCollection attributes5 = htmlAnchor7.Attributes;
                         num4 = orderInfo.PaymentTypeId;
                         attributes5.Add("PaymentTypeId", num4.ToString());
                         htmlAnchor7.Attributes.Add("OrderId", orderInfo.OrderId);
                         htmlAnchor7.Attributes.Add("OrderTotal", orderInfo.GetTotal(false).F2ToString("f2"));
                         AttributeCollection attributes6 = htmlAnchor7.Attributes;
                         num4 = orderInfo.FightGroupId;
                         attributes6.Add("FightGroupId", num4.ToString());
                         if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                         {
                             StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId);
                             dateTime = DateTime.Now;
                             string str = dateTime.ToString("yyyy-MM-dd");
                             dateTime = storeById.OpenStartDate;
                             DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                             dateTime = DateTime.Now;
                             string str2 = dateTime.ToString("yyyy-MM-dd");
                             dateTime = storeById.OpenEndDate;
                             DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                             if (dateTime2 <= value)
                             {
                                 dateTime2 = dateTime2.AddDays(1.0);
                             }
                             if (DateTime.Now < value || DateTime.Now > dateTime2)
                             {
                                 htmlAnchor7.Attributes.Add("NeedNotInTimeTip", "1");
                             }
                         }
                     }
                 }
                 else
                 {
                     htmlAnchor7.Visible = false;
                 }
             }
             if (htmlAnchor8 != null)
             {
                 if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest" && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                 {
                     htmlAnchor8.HRef = "FinishOrder.aspx?OrderId=" + text + "&onlyHelp=true";
                 }
                 else
                 {
                     htmlAnchor8.Visible = false;
                 }
             }
             if (htmlAnchor9 != null)
             {
                 if (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                 {
                     htmlAnchor9.Attributes.Add("onclick", $"FinishOrder('{text}','{orderInfo.PaymentType}',{orderInfo.LineItems.Count})");
                 }
                 else
                 {
                     htmlAnchor9.Visible = false;
                 }
             }
             if (htmlAnchor11 != null)
             {
                 if (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods)
                 {
                     htmlAnchor11.Attributes.Add("orderId", orderInfo.OrderId);
                     htmlAnchor11.Attributes.Add("onclick", "Certification(this)");
                     htmlAnchor11.Visible = true;
                 }
                 else
                 {
                     htmlAnchor11.Visible = false;
                 }
             }
             if (literal != null)
             {
                 Literal literal4 = literal;
                 num4          = this.GetGoodsNum(orderInfo);
                 literal4.Text = num4.ToString();
             }
             if (literal2 != null)
             {
                 Literal literal5 = literal2;
                 num4          = this.GetGiftsNum(orderInfo);
                 literal5.Text = num4.ToString();
             }
             if (orderInfo.OrderType == OrderType.ServiceOrder)
             {
                 Label label = (Label)e.Item.FindControl("OrderStatusLabel2");
                 IList <OrderVerificationItemInfo> orderVerificationItems = TradeHelper.GetOrderVerificationItems(orderInfo.OrderId);
                 ServiceOrderStatus orderStatus2 = this.GetOrderStatus(orderInfo, orderVerificationItems);
                 label.Text    = ((Enum)(object)orderStatus2).ToDescription();
                 label.Visible = true;
             }
             else
             {
                 OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("OrderStatusLabel1");
                 orderStatusLabel.OrderItemStatus    = ((orderInfo.ItemStatus != 0) ? OrderItemStatus.HasReturnOrReplace : OrderItemStatus.Nomarl);
                 orderStatusLabel.Gateway            = orderInfo.Gateway;
                 orderStatusLabel.OrderStatusCode    = orderInfo.OrderStatus;
                 orderStatusLabel.ShipmentModelId    = orderInfo.ShippingModeId;
                 orderStatusLabel.IsConfirm          = orderInfo.IsConfirm;
                 orderStatusLabel.ShipmentModelId    = orderInfo.ShippingModeId;
                 orderStatusLabel.PaymentTypeId      = orderInfo.PaymentTypeId;
                 orderStatusLabel.PreSaleId          = orderInfo.PreSaleId;
                 orderStatusLabel.DepositDate        = orderInfo.DepositDate;
                 orderStatusLabel.OrderType          = orderInfo.OrderType;
                 orderStatusLabel.ExpressCompanyName = orderInfo.ExpressCompanyName;
                 orderStatusLabel.DadaStatus         = orderInfo.DadaStatus;
                 orderStatusLabel.Visible            = true;
             }
             Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
             foreach (string key in lineItems.Keys)
             {
                 lineItems[key].IsValid = (orderInfo.OrderType == OrderType.ServiceOrder);
             }
             repeater.DataSource     = lineItems.Values;
             repeater.ItemDataBound += this.Repeater1_ItemDataBound;
             repeater.DataBind();
             if (orderInfo.LineItems.Count == 0)
             {
                 IEnumerable <OrderGiftInfo> enumerable = from a in orderInfo.Gifts
                                                          where a.PromoteType == 0 || a.PromoteType == 15
                                                          select a;
                 foreach (OrderGiftInfo item in enumerable)
                 {
                     item.NeedPoint = ((orderInfo.OrderType == OrderType.ServiceOrder) ? 1 : 0);
                 }
                 repeater2.DataSource     = enumerable;
                 repeater2.ItemDataBound += this.rptPointGifts_ItemDataBound;
                 repeater2.DataBind();
             }
             OrderItemStatus itemStatus = orderInfo.ItemStatus;
             DateTime        obj;
             if (DataBinder.Eval(e.Item.DataItem, "FinishDate") != DBNull.Value)
             {
                 obj = (DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate");
             }
             else
             {
                 dateTime = DateTime.Now;
                 obj      = dateTime.AddYears(-1);
             }
             DateTime dateTime3 = obj;
             string   text4     = "";
             if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
             {
                 text4 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
             }
             RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
             if (htmlAnchor2 != null)
             {
                 if (orderInfo.OrderType == OrderType.ServiceOrder)
                 {
                     htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0);
                     if (htmlAnchor2.Visible)
                     {
                         LineItemInfo value2 = orderInfo.LineItems.FirstOrDefault().Value;
                         if (value2.IsRefund)
                         {
                             if (value2.IsOverRefund)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else if (value2.IsValid)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else if (DateTime.Now >= value2.ValidStartDate.Value && DateTime.Now <= value2.ValidEndDate.Value)
                             {
                                 htmlAnchor2.Visible = true;
                             }
                             else
                             {
                                 htmlAnchor2.Visible = false;
                             }
                         }
                         else
                         {
                             htmlAnchor2.Visible = false;
                         }
                     }
                 }
                 else
                 {
                     htmlAnchor2.Visible = (orderStatus == OrderStatus.BuyerAlreadyPaid && orderInfo.ItemStatus == OrderItemStatus.Nomarl && orderInfo.LineItems.Count != 0 && orderInfo.GetPayTotal() > decimal.Zero);
                 }
             }
             if (htmlAnchor != null)
             {
                 htmlAnchor.Visible = (orderInfo.OrderType == OrderType.ServiceOrder && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
             }
             SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
             if (!string.IsNullOrEmpty(orderInfo.TakeCode) && (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.WaitBuyerPay))
             {
                 htmlAnchor10.Visible = true;
             }
             if (!htmlAnchor2.Visible && !htmlAnchor4.Visible && !htmlAnchor10.Visible && !htmlAnchor6.Visible && !htmlAnchor3.Visible && !htmlAnchor7.Visible && !htmlAnchor8.Visible && !htmlAnchor9.Visible && !htmlAnchor5.Visible && !htmlAnchor.Visible)
             {
                 htmlGenericControl.Visible = false;
             }
             if (orderInfo.FightGroupId > 0)
             {
                 FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                 if (fightGroup != null)
                 {
                     htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                 }
             }
         }
     }
 }
Exemplo n.º 13
0
        private DataGridViewModel <Dictionary <string, object> > GetDataList(OrderQuery query)
        {
            DateTime now  = DateTime.Now;
            DateTime now2 = DateTime.Now;
            PageModel <OrderModel> pageModel = null;
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();
            TimeSpan timeSpan;
            double   totalMilliseconds;

            if (query != null)
            {
                now               = DateTime.Now;
                pageModel         = OrderHelper.GetOrderList(query);
                now2              = DateTime.Now;
                timeSpan          = now2 - now;
                totalMilliseconds = timeSpan.TotalMilliseconds;
                Globals.AppendLog("数据库查询花费时间", totalMilliseconds.ToString(), "", "GetDataList");
                now = DateTime.Now;
                string[] orderIds = (from d in pageModel.Models
                                     select d.OrderId).ToArray();
                List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds);
                dataGridViewModel.rows = DataHelper.ListToDictionary(pageModel.rows);
                now2 = DateTime.Now;
                dataGridViewModel.total = pageModel.total;
                int num = 0;
                now = DateTime.Now;
                foreach (Dictionary <string, object> row in dataGridViewModel.rows)
                {
                    OrderModel order = (from o in pageModel.rows
                                        where o.OrderId == row["OrderId"].ToNullString()
                                        select o).FirstOrDefault();
                    row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, order.OrderType));
                    row.Add("canCheckTake", order.CanConfirmTakeCode());
                    row.Add("canCloseOrder", order.CanClose(base.CurrentSiteSetting.OpenMultStore, false));
                    row.Add("canOfflineReceipt", this.CanConfirmOfflineReceipt(order, false));
                    row.Add("CanEditPrice", this.CanEditPrice(order));
                    row.Add("canCancelSendGoods", order.OrderStatus == OrderStatus.SellerAlreadySent && (order.DadaStatus == DadaStatus.WaitOrder || order.DadaStatus == DadaStatus.WaitTake));
                    row.Add("dadaState", (order.DadaStatus != 0) ? ((Enum)(object)order.DadaStatus).ToDescription() : "");
                    row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                    bool flag = this.CanSendGoods(order, base.CurrentSiteSetting.OpenMultStore);
                    if (base.CurrentSiteSetting.OpenMultStore && order.StoreId != 0)
                    {
                        flag = false;
                    }
                    row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                    bool flag2 = false;
                    if (base.CurrentSiteSetting.OpenMultStore && order.CountDownBuyId == 0 && order.BundlingId == 0 && order.GroupBuyId == 0 && order.FightGroupId == 0 && order.PreSaleId == 0 && order.ItemStatus == OrderItemStatus.Nomarl && (order.OrderStatus == OrderStatus.BuyerAlreadyPaid || (order.OrderStatus == OrderStatus.WaitBuyerPay && order.Gateway == "hishop.plugins.payment.podrequest")))
                    {
                        if (order.StoreId == -1)
                        {
                            flag2 = (order.BuyQuantity > 0);
                        }
                        else if (order.StoreId > 0)
                        {
                            flag2 = !order.IsConfirm;
                        }
                        else if (order.StoreId == 0)
                        {
                            flag2 = (order.ShippingModeId != -2 && order.BuyQuantity > 0);
                        }
                    }
                    row.Add("CanAllotStore", flag2);
                    RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                    if (refundInfo != null)
                    {
                        row.Add("IsCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && !order.IsStoreCollect);
                        row.Add("RefundId", refundInfo.RefundId);
                    }
                    bool   flag3  = false;
                    string value  = string.Empty;
                    string value2 = string.Empty;
                    if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null && order.OrderStatus == OrderStatus.ApplyForRefund)
                        {
                            flag3  = true;
                            value2 = "订单已申请退款";
                            value  = "RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                        else
                        {
                            if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                            {
                                value2 = "订单中有商品正在退货/换货中";
                            }
                            else if (order.ReturnedCount > 0)
                            {
                                value2 = "订单中有商品已退货完成";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReplace)
                            {
                                value2 = "订单中有商品正在进行换货操作";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReturn)
                            {
                                value2 = "订单中有商品正在进行退货操作";
                            }
                            if (order.AfterSaleCount > 0)
                            {
                                flag3 = true;
                                value = ((order.ReturnId <= 0) ? ("ReplaceApplyDetail?ReplaceId=" + order.ReplaceId) : ("ReturnApplyDetail?ReturnId=" + order.ReturnId));
                            }
                        }
                    }
                    row.Add("IsShowRefundIcon", flag3);
                    row.Add("RefundOperUrl", value);
                    row.Add("RefundTips", value2);
                    bool flag4 = false;
                    if (order.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId);
                        if (fightGroup != null)
                        {
                            row["FightGroupActivityId"] = fightGroup.FightGroupActivityId;
                            if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed)
                            {
                                flag4 = true;
                            }
                        }
                    }
                    row.Add("FightGrouping", flag4);
                    row.Add("canSendGoods", flag);
                    if (order.BuyQuantity <= 0)
                    {
                        if (order.UserAwardRecordsId > 0)
                        {
                            row.Add("IsAwardOrder", true);
                        }
                        else
                        {
                            row.Add("IsGiftOrder", true);
                        }
                    }
                    if (order.PreSaleId > 0 && order.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
                        if (productPreSaleInfo != null)
                        {
                            string   value3 = "";
                            DateTime dateTime;
                            if (productPreSaleInfo.DeliveryDate.HasValue)
                            {
                                dateTime = productPreSaleInfo.DeliveryDate.Value;
                                value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                            else
                            {
                                DateTime payDate = order.PayDate;
                                if (order.PayDate != DateTime.MinValue)
                                {
                                    dateTime = order.PayDate;
                                    dateTime = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                    value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                                }
                            }
                            row.Add("SendGoodsTips", value3);
                        }
                    }
                    row.Add("IsOpenCertification", HiContext.Current.SiteSettings.IsOpenCertification && order.IsincludeCrossBorderGoods);
                    if (row["IDStatus"] != null)
                    {
                        row["IDStatus"] = order.IDStatus;
                    }
                    num++;
                }
            }
            now2              = DateTime.Now;
            timeSpan          = now2 - now;
            totalMilliseconds = timeSpan.TotalMilliseconds;
            Globals.AppendLog("数据计算花费时间", totalMilliseconds.ToString(), "", "GetDataList2");
            return(dataGridViewModel);
        }
Exemplo n.º 14
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(base.GetParameter("PreSaleId", false), out this.preSaleId))
            {
                base.GotoResourceNotFound();
            }
            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.preSaleId);

            if (productPreSaleInfo == null)
            {
                base.GotoResourceNotFound();
            }
            this.productId = productPreSaleInfo.ProductId;
            if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
            {
                this.Page.Response.Redirect("/ProductDetails.aspx?productId=" + this.productId);
                return;
            }
            this.hidSupName              = (HtmlInputHidden)this.FindControl("hidSupName");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.hiddenpid               = (HtmlInputHidden)this.FindControl("hiddenpid");
            this.hidCartQuantity         = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.hiddenpid.Value         = this.productId.ToString();
            this.common_Location         = (Common_Location)this.FindControl("common_Location");
            this.litProductName          = (Literal)this.FindControl("litProductName");
            this.lblStock                = (StockLabel)this.FindControl("lblStock");
            this.litUnit                 = (Literal)this.FindControl("litUnit");
            this.litSaleCounts           = (Literal)this.FindControl("litSaleCounts");
            this.lblBuyPrice             = (Label)this.FindControl("lblBuyPrice");
            this.lblTotalPrice           = (TotalLabel)this.FindControl("lblTotalPrice");
            this.lblSku                  = (SkuLabel)this.FindControl("lblSku");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.btnBuy                  = (BuyButton)this.FindControl("btnBuy");
            this.hpkProductConsultations = (HyperLink)this.FindControl("hpkProductConsultations");
            this.ltlSaleCount            = (Literal)this.FindControl("ltlSaleCount");
            this.ltlReviewCount          = (Literal)this.FindControl("ltlReviewCount");
            this.litReviewCount          = (Literal)this.FindControl("litReviewCount");
            this.ltlConsultation         = (Literal)this.FindControl("ltlConsultation");
            this.images                  = (Common_ProductImages)this.FindControl("common_ProductImages");
            this.rptExpandAttributes     = (ThemedTemplatedRepeater)this.FindControl("rptExpandAttributes");
            this.rptOnlineService        = (ThemedTemplatedRepeater)this.FindControl("rptOnlineService");
            this.skuSelector             = (SKUSelector)this.FindControl("SKUSelector");
            this.consultations           = (Common_ProductConsultations)this.FindControl("list_Common_ProductConsultations");
            this.correlative             = (Common_GoodsList_Correlative)this.FindControl("list_Common_GoodsList_Correlative");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.hidden_skuItem          = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidIsOpenMultiStore     = (HtmlInputHidden)this.FindControl("hidIsOpenMultiStore");
            this.aCountDownUrl           = (HyperLink)this.FindControl("aCountDownUrl");
            this.imgQrCode               = (Image)this.FindControl("imgQrCode");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divGift                 = (HtmlGenericControl)this.FindControl("divGift");
            this.ltlGiftName             = (Literal)this.FindControl("ltlGiftName");
            this.ltlGiftNum              = (Literal)this.FindControl("ltlGiftNum");
            this.aBrand                  = (HtmlAnchor)this.FindControl("aBrand");
            this.imgBrand                = (HiImage)this.FindControl("imgBrand");
            this.imgCustomerService      = (HtmlImage)this.FindControl("imgCustomerService");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.divOrderPromotions      = (HtmlGenericControl)this.FindControl("divOrderPromotions");
            this.divOrderPromotions2     = (HtmlGenericControl)this.FindControl("divOrderPromotions2");
            this.divOrderPromotions4     = (HtmlGenericControl)this.FindControl("divOrderPromotions4");
            this.divOrderPromotions3     = (HtmlGenericControl)this.FindControl("divOrderPromotions3");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litPhonePriceEndDate    = (Literal)this.FindControl("litPhonePriceEndDate");
            this.divCuxiao               = (HtmlGenericControl)this.FindControl("divCuxiao");
            this.ltlUnit                 = (Literal)this.FindControl("ltlUnit");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.ltlPromotionSendGifts   = (Literal)this.FindControl("ltlPromotionSendGifts");
            this.setDeliverRegion        = (Common_SetDeliveryRegion)this.FindControl("setDeliverRegion");
            this.divqq = (HtmlGenericControl)this.FindControl("divqq");
            this.lblPaymentStartDate    = (Label)this.FindControl("lblPaymentStartDate");
            this.lblPaymentEndDate      = (Label)this.FindControl("lblPaymentEndDate");
            this.lblDelivery            = (Label)this.FindControl("lblDelivery");
            this.lblDepositPercent      = (Label)this.FindControl("lblDepositPercent");
            this.lblDeposit             = (Label)this.FindControl("lblDeposit");
            this.lblFinalPaymentPercent = (Label)this.FindControl("lblFinalPaymentPercent");
            this.lblFinalPayment        = (Label)this.FindControl("lblFinalPayment");
            this.hidEndDate             = (HtmlInputHidden)this.FindControl("hidEndDate");
            this.hidNowDate             = (HtmlInputHidden)this.FindControl("hidNowDate");
            this.hidDepositPercent      = (HtmlInputHidden)this.FindControl("hidDepositPercent");
            this.hidDeposit             = (HtmlInputHidden)this.FindControl("hidDeposit");
            ThemedTemplatedRepeater themedTemplatedRepeater = (ThemedTemplatedRepeater)this.FindControl("rptOtherProducts");

            this.aCountDownUrl.Visible = false;
            if (this.Page.IsPostBack)
            {
                return;
            }
            if (this.imgQrCode != null)
            {
                string text = "/Storage/master/QRCode/" + HttpContext.Current.Request.Url.Host + "_" + this.productId + ".png";
                Globals.CreateQRCode(HttpContext.Current.Request.Url.ToString(), text, false, ImageFormats.Png);
                this.imgQrCode.ImageUrl = text;
            }
            ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(this.productId, null, this.sitesettings.OpenMultStore, -1);

            if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("/ProductDelete.aspx");
                return;
            }
            this.setDeliverRegion.ShippingTemplateId = productBrowseInfo.Product.ShippingTemplateId;
            this.setDeliverRegion.Volume             = productBrowseInfo.Product.Weight;
            this.setDeliverRegion.Weight             = productBrowseInfo.Product.Weight;
            this.ActivityBusiness();
            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(productBrowseInfo.Product.ProductId);
            }
            IEnumerable value = from item in productBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.Page.Response.Redirect(base.GetRouteUrl("unproductdetails", new
                {
                    ProductId = this.productId
                }));
            }
            if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
            {
                this.Page.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该商品已入库"));
                return;
            }
            this.hidden_productId.Value = this.productId.ToString();
            this.LoadPageSearch(productBrowseInfo.Product);
            if (this.lbUserProductRefer != null && this.sitesettings.OpenReferral == 1 && this.sitesettings.ShowDeductInProductPage)
            {
                this.lbUserProductRefer.product = productBrowseInfo.Product;
            }
            HyperLink hyperLink = this.hpkProductConsultations;
            int       num       = productBrowseInfo.ConsultationCount;

            hyperLink.Text = "查看全部" + num.ToString() + "条咨询";
            Literal literal = this.ltlConsultation;

            num          = productBrowseInfo.ConsultationCount;
            literal.Text = num.ToString();
            Literal literal2 = this.ltlSaleCount;

            num           = productBrowseInfo.SaleCount;
            literal2.Text = num.ToString();
            Literal literal3 = this.ltlReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal3.Text = num.ToString();
            Literal literal4 = this.litReviewCount;

            num           = productBrowseInfo.ReviewCount;
            literal4.Text = num.ToString();
            this.hpkProductConsultations.NavigateUrl = $"ProductConsultationsAndReplay.aspx?productId={this.productId}";
            this.LoadProductInfo(productBrowseInfo.Product, productBrowseInfo.BrandName);
            HtmlInputHidden htmlInputHidden = this.hidNowDate;
            DateTime        dateTime        = DateTime.Now;

            htmlInputHidden.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            HtmlInputHidden htmlInputHidden2 = this.hidEndDate;

            dateTime = productPreSaleInfo.PreSaleEndDate;
            htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            Label label = this.lblPaymentStartDate;

            dateTime   = productPreSaleInfo.PaymentStartDate;
            label.Text = dateTime.ToString("yyyy.MM.dd");
            Label label2 = this.lblPaymentEndDate;

            dateTime    = productPreSaleInfo.PaymentEndDate;
            label2.Text = dateTime.ToString("yyyy.MM.dd");
            Label  label3 = this.lblDelivery;
            object text2;

            if (productPreSaleInfo.DeliveryDays <= 0)
            {
                dateTime = productPreSaleInfo.DeliveryDate.Value;
                text2    = dateTime.ToString("yyyy.MM.dd") + "前发货";
            }
            else
            {
                text2 = "尾款支付后" + productPreSaleInfo.DeliveryDays + "天发货";
            }
            label3.Text = (string)text2;
            decimal d;

            if (productPreSaleInfo.DepositPercent > 0)
            {
                this.lblDepositPercent.Text      = "定金:" + productPreSaleInfo.DepositPercent + "%";
                this.lblFinalPaymentPercent.Text = "尾款:" + (100 - productPreSaleInfo.DepositPercent) + "%";
                decimal num2 = Math.Round(productBrowseInfo.Product.MinSalePrice * (decimal)productPreSaleInfo.DepositPercent / 100m, 2);
                this.lblDeposit.Text      = "¥" + num2;
                this.lblFinalPayment.Text = "¥" + Math.Round(productBrowseInfo.Product.MinSalePrice - num2, 2);
                HtmlInputHidden htmlInputHidden3 = this.hidDepositPercent;
                num = productPreSaleInfo.DepositPercent;
                htmlInputHidden3.Value = num.ToString();
            }
            else
            {
                this.lblDeposit.Text      = "定金:¥" + productPreSaleInfo.Deposit;
                this.lblFinalPayment.Text = "尾款:¥" + Math.Round(productBrowseInfo.Product.MinSalePrice - productPreSaleInfo.Deposit, 2);
                HtmlInputHidden htmlInputHidden4 = this.hidDeposit;
                d = productPreSaleInfo.Deposit;
                htmlInputHidden4.Value = d.ToString();
            }
            this.btnBuy.Stock  = (this.sitesettings.OpenMultStore ? productBrowseInfo.Product.DefaultSku.MaxStock : productBrowseInfo.Product.Stock);
            this.ltlUnit.Text  = productBrowseInfo.Product.Unit;
            this.divqq.Visible = (this.sitesettings.ServiceIsOpen == "1");
            MemberInfo user = HiContext.Current.User;

            if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productBrowseInfo.Product.SubMemberDeduct.HasValue))
            {
                if (!productBrowseInfo.Product.SubMemberDeduct.HasValue)
                {
                    goto IL_0d79;
                }
                decimal?subMemberDeduct = productBrowseInfo.Product.SubMemberDeduct;
                d = default(decimal);
                if (!(subMemberDeduct.GetValueOrDefault() <= d) || !subMemberDeduct.HasValue)
                {
                    goto IL_0d79;
                }
            }
            goto IL_0d9f;
IL_0da0:
            int num3;

            if (num3 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            BrowsedProductQueue.EnQueue(this.productId);
            this.images.ImageInfo = productBrowseInfo.Product;
            if (productBrowseInfo.DbAttribute != null)
            {
                this.rptExpandAttributes.DataSource = productBrowseInfo.DbAttribute;
                this.rptExpandAttributes.DataBind();
            }
            if (productBrowseInfo.DbSKUs != null)
            {
                this.skuSelector.ProductId  = this.productId;
                this.skuSelector.DataSource = productBrowseInfo.DbSKUs;
            }
            if (productBrowseInfo.Product.BrandId.HasValue)
            {
                BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                if (brandCategory != null && !string.IsNullOrEmpty(brandCategory.Logo))
                {
                    this.imgBrand.ImageUrl = brandCategory.Logo;
                    this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                    {
                        brandId = brandCategory.BrandId
                    });
                }
            }
            int supplierId = productBrowseInfo.Product.SupplierId;

            if (supplierId > 0)
            {
                SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                if (!string.IsNullOrEmpty(supplierById.Picture))
                {
                    this.imgBrand.ImageUrl = supplierById.Picture;
                }
                else if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory2 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory2 != null && !string.IsNullOrEmpty(brandCategory2.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory2.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory2.BrandId
                        });
                    }
                }
                else
                {
                    this.imgBrand.Visible = false;
                }
                this.litSupplierName.Text = supplierById.SupplierName;
                this.hidSupName.Value     = supplierById.SupplierName;
            }
            else
            {
                this.litSupplierName.Visible = false;
                if (productBrowseInfo.Product.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory3 = CatalogHelper.GetBrandCategory(productBrowseInfo.Product.BrandId.Value);
                    if (brandCategory3 != null && !string.IsNullOrEmpty(brandCategory3.Logo))
                    {
                        this.imgBrand.ImageUrl = brandCategory3.Logo;
                        this.aBrand.HRef       = base.GetRouteUrl("branddetails", new
                        {
                            brandId = brandCategory3.BrandId
                        });
                    }
                }
            }
            if (productBrowseInfo.DBConsultations != null)
            {
                this.consultations.DataSource = productBrowseInfo.DBConsultations;
                this.consultations.DataBind();
            }
            if (productBrowseInfo.DbCorrelatives != null)
            {
                this.correlative.DataSource = productBrowseInfo.DbCorrelatives;
                this.correlative.DataBind();
            }
            this.BindOrderPromotions();
            if (!this.divOrderPromotions.Visible && !this.divOrderPromotions2.Visible && !this.divOrderPromotions3.Visible)
            {
                this.divCuxiao.Style.Add("display", "none");
            }
            if (this.rptOnlineService != null)
            {
                IList <OnlineServiceInfo> allOnlineService  = OnlineServiceHelper.GetAllOnlineService(0, 1);
                IList <OnlineServiceInfo> allOnlineService2 = OnlineServiceHelper.GetAllOnlineService(0, 2);
                if (allOnlineService2 != null)
                {
                    foreach (OnlineServiceInfo item in allOnlineService2)
                    {
                        allOnlineService.Add(item);
                    }
                }
                this.rptOnlineService.DataSource = allOnlineService;
                this.rptOnlineService.DataBind();
            }
            return;

IL_0d9f:
            num3 = 1;
            goto IL_0da0;
IL_0d79:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num3 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0da0;
            }
            goto IL_0d9f;
        }
Exemplo n.º 15
0
        private void BindOrderInfo()
        {
            if (this.order.BalanceAmount > decimal.Zero)
            {
                this.litBalanceAmount.Text = this.order.BalanceAmount.F2ToString("f2");
            }
            else
            {
                this.liBalanceAmount.Visible = false;
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            DateTime?    nullable;
            DateTime     dateTime;

            if (this.order.PreSaleId > 0)
            {
                this.litDeposit.Text = this.order.Deposit.F2ToString("f2");
                this.litFinal.Text   = this.order.FinalPayment.F2ToString("f2");
                nullable             = this.order.DepositDate;
                if (nullable.HasValue)
                {
                    Literal literal = this.litDepositDate;
                    nullable     = this.order.DepositDate;
                    literal.Text = nullable.ToString();
                }
                DateTime payDate = this.order.PayDate;
                if (this.order.PayDate != DateTime.MinValue)
                {
                    Literal literal2 = this.litFinalDate;
                    dateTime      = this.order.PayDate;
                    literal2.Text = dateTime.ToString();
                }
            }
            if (this.order.ShippingModeId == -2)
            {
                this.divStoreAddress.Visible = true;
                this.divLogists.Visible      = false;
                this.divShipAddress.Visible  = false;
            }
            else
            {
                this.divStoreAddress.Visible = false;
                this.divLogists.Visible      = (this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished);
                this.divShipAddress.Visible  = true;
            }
            if (this.order.OrderStatus == OrderStatus.SellerAlreadySent && this.order.ItemStatus == OrderItemStatus.Nomarl)
            {
                this.ensureRecieved.Visible = true;
            }
            else
            {
                this.ensureRecieved.Visible = false;
            }
            if ((this.order.OrderStatus == OrderStatus.SellerAlreadySent || this.order.OrderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(this.order.ExpressCompanyAbb) && !string.IsNullOrEmpty(this.order.ShipOrderNumber))
            {
                this.lookupTrans.Visible = true;
                this.lookupTrans.HRef    = "MyLogistics.aspx?orderId=" + this.order.OrderId;
            }
            else
            {
                this.lookupTrans.Visible = false;
            }
            if (string.IsNullOrEmpty(this.order.TakeCode) || string.IsNullOrEmpty(masterSettings.HiPOSAppId) || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.Closed)
            {
                this.lookupQRCode.Visible = false;
            }
            ProductPreSaleInfo productPreSaleInfo = null;
            int paymentTypeId;

            if (this.order.OrderStatus == OrderStatus.WaitBuyerPay && this.order.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1) && this.order.PaymentTypeId != -3)
            {
                if (this.order.PreSaleId > 0)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                    nullable           = this.order.DepositDate;
                    if (!nullable.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate > DateTime.Now)
                        {
                            this.btnToPay.Visible = true;
                            AttributeCollection attributes = this.btnToPay.Attributes;
                            paymentTypeId = this.order.PaymentTypeId;
                            attributes.Add("PaymentTypeId", paymentTypeId.ToString());
                            this.btnToPay.Attributes.Add("OrderId", this.orderId);
                            this.btnToPay.Attributes.Add("orderTotal", (this.order.Deposit - this.order.BalanceAmount).F2ToString("f2"));
                        }
                    }
                    else if (!(productPreSaleInfo.PaymentStartDate > DateTime.Now) && !(productPreSaleInfo.PaymentEndDate < DateTime.Now))
                    {
                        this.btnToPay.Visible = true;
                        AttributeCollection attributes2 = this.btnToPay.Attributes;
                        paymentTypeId = this.order.PaymentTypeId;
                        attributes2.Add("PaymentTypeId", paymentTypeId.ToString());
                        this.btnToPay.Attributes.Add("OrderId", this.orderId);
                        this.btnToPay.Attributes.Add("orderTotal", this.order.FinalPayment.F2ToString("f2"));
                    }
                }
                else
                {
                    AttributeCollection attributes3 = this.btnToPay.Attributes;
                    paymentTypeId = this.order.PaymentTypeId;
                    attributes3.Add("PaymentTypeId", paymentTypeId.ToString());
                    this.btnToPay.Visible = true;
                    this.btnToPay.Attributes.Add("OrderId", this.orderId);
                    this.btnToPay.Attributes.Add("orderTotal", this.order.GetTotal(true).F2ToString("f2"));
                    if (HiContext.Current.SiteSettings.OpenMultStore && this.order.StoreId > 0 && !SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                    {
                        StoresInfo storeById = StoresHelper.GetStoreById(this.order.StoreId);
                        dateTime = DateTime.Now;
                        string str = dateTime.ToString("yyyy-MM-dd");
                        dateTime = storeById.OpenStartDate;
                        nullable = (str + " " + dateTime.ToString("HH:mm")).ToDateTime();
                        DateTime value = nullable.Value;
                        dateTime = DateTime.Now;
                        string str2 = dateTime.ToString("yyyy-MM-dd");
                        dateTime = storeById.OpenEndDate;
                        nullable = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime();
                        DateTime dateTime2 = nullable.Value;
                        if (dateTime2 <= value)
                        {
                            dateTime2 = dateTime2.AddDays(1.0);
                        }
                        if (DateTime.Now < value || DateTime.Now > dateTime2)
                        {
                            this.btnToPay.Attributes.Add("NeedNotInTimeTip", "1");
                        }
                    }
                }
                if (this.order.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.OfflinePay, 1))
                {
                    this.btnToPay.InnerText = "线下支付帮助";
                    this.btnToPay.HRef      = "FinishOrder.aspx?OrderId=" + this.order.OrderId + "&onlyHelp=true";
                }
            }
            if (this.order.ReducedPromotionAmount <= decimal.Zero)
            {
                this.liFullReduction.Visible = false;
            }
            this.litShipTo.Text  = this.order.ShipTo;
            this.litPhone.Text   = this.order.CellPhone;
            this.litAddress.Text = this.order.ShippingRegion + this.order.Address;
            this.litOrderId.Text = this.orderId;
            Literal literal3 = this.litOrderDate;

            dateTime      = this.order.OrderDate;
            literal3.Text = dateTime.ToString();
            this.litTotalPrice.SetWhenIsNotNull(this.order.GetAmount(false).F2ToString("f2"));
            this.litOrderStatus.OrderStatusCode = this.order.OrderStatus;
            this.litOrderStatus.OrderItemStatus = this.order.ItemStatus;
            this.litOrderStatus.ShipmentModelId = this.order.ShippingModeId;
            this.litOrderStatus.IsConfirm       = this.order.IsConfirm;
            this.litOrderStatus.Gateway         = this.order.Gateway;
            this.litOrderStatus.PaymentTypeId   = this.order.PaymentTypeId;
            this.litOrderStatus.PreSaleId       = this.order.PreSaleId;
            this.litOrderStatus.DepositDate     = this.order.DepositDate;
            Literal control = this.litPayTime;
            object  value2;

            if (!(this.order.PayDate != DateTime.MinValue))
            {
                value2 = "";
            }
            else
            {
                dateTime = this.order.PayDate;
                value2   = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            }
            control.SetWhenIsNotNull((string)value2);
            HtmlInputHidden control2 = this.orderStatus;

            paymentTypeId = (int)this.order.OrderStatus;
            control2.SetWhenIsNotNull(paymentTypeId.ToString());
            this.hidOrderId.SetWhenIsNotNull(this.orderId.ToString());
            this.litPaymentMode.SetWhenIsNotNull(this.order.PaymentType);
            this.litShipToDate.SetWhenIsNotNull(this.order.ShipToDate);
            bool flag = false;

            if (this.order.OrderStatus == OrderStatus.BuyerAlreadyPaid || this.order.OrderStatus == OrderStatus.Finished || this.order.OrderStatus == OrderStatus.WaitReview || this.order.OrderStatus == OrderStatus.History)
            {
                WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= this.order.GetPayTotal() && this.order.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && this.order.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                {
                    flag = true;
                }
            }
            this.hidShowRedEnvelope.SetWhenIsNotNull(flag ? "true" : "false");
            if (this.order.PreSaleId > 0)
            {
                this.litBuildPrice.SetWhenIsNotNull((this.order.Deposit + this.order.FinalPayment).F2ToString("f2"));
            }
            else
            {
                this.litBuildPrice.SetWhenIsNotNull(this.order.GetPayTotal().F2ToString("f2"));
            }
            this.litRemark.SetWhenIsNotNull(this.order.Remark);
            this.litTakeCode.SetWhenIsNotNull((this.order.ShippingModeId == -2) ? this.order.TakeCode : "");
            this.litFreight.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.litFreight2.SetWhenIsNotNull(this.order.AdjustedFreight.F2ToString("f2"));
            this.giftFreight.Visible = (this.order.LineItems.Count == 0);
            this.litFullCapacityReduction.SetWhenIsNotNull("-" + this.order.ReducedPromotionAmount.F2ToString("f2"));
            if (this.order.PreSaleId > 0)
            {
                if (productPreSaleInfo == null)
                {
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                }
                nullable = this.order.DepositDate;
                if (!nullable.HasValue)
                {
                    this.hidpresaleStaut.Value = "1";
                    if (this.order.OrderStatus == OrderStatus.Closed)
                    {
                        this.hidpresaleStaut.Value = "6";
                    }
                }
                else if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                {
                    this.hidpresaleStaut.Value = "2";
                }
                else if (productPreSaleInfo.PaymentEndDate < DateTime.Now)
                {
                    if (this.order.PayDate == DateTime.MinValue)
                    {
                        this.hidpresaleStaut.Value = "5";
                    }
                    else
                    {
                        this.hidpresaleStaut.Value = "4";
                    }
                }
                else if (this.order.PayDate == DateTime.MinValue)
                {
                    this.hidpresaleStaut.Value = "3";
                }
                else
                {
                    this.hidpresaleStaut.Value = "4";
                }
            }
        }
Exemplo n.º 16
0
        private void ConfirmPayOrder(HttpContext context)
        {
            SiteSettings currentSiteSetting = base.CurrentSiteSetting;
            string       text = context.Request.Form["orderId"];

            if (string.IsNullOrWhiteSpace(text))
            {
                throw new HidistroAshxException("异常的参数:订单编号");
            }
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(text);

            if (orderInfo == null)
            {
                throw new HidistroAshxException("异常的参数:订单编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                return;
            }
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest");

            if (paymentMode != null)
            {
                orderInfo.Gateway       = paymentMode.Gateway;
                orderInfo.PaymentType   = paymentMode.Name;
                orderInfo.PaymentTypeId = paymentMode.ModeId;
            }
            else
            {
                orderInfo.Gateway       = "hishop.plugins.payment.bankrequest";
                orderInfo.PaymentType   = "线下支付";
                orderInfo.PaymentTypeId = 0;
            }
            orderInfo.IsStoreCollect = true;
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                string empty = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        throw new HidistroAshxException(empty);
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付");
                }
                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                num  = groupBuy.MaxCount;
                num3 = orderInfo.GetGroupBuyOerderNumber();
                if (num < num2 + num3)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付");
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    throw new HidistroAshxException("预售活动不存在");
                }
                if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款");
                }
            }
            if (OrderHelper.ConfirmPay(orderInfo))
            {
                if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                {
                    PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                }
                if (orderInfo.ParentOrderId == "-1")
                {
                    OrderQuery orderQuery = new OrderQuery();
                    orderQuery.ParentOrderId = orderInfo.OrderId;
                    IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                    foreach (OrderInfo item in listUserOrder)
                    {
                        OrderHelper.OrderConfirmPaySendMessage(item);
                    }
                }
                else
                {
                    OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                }
                base.ReturnResult(context, true, "成功的确认了订单收款", 0, true);
                return;
            }
            throw new HidistroAshxException("确认订单收款失败");
        }
Exemplo n.º 17
0
        protected override void Render(HtmlTextWriter writer)
        {
            int num;

            if (!this.ShowItemStatus || this.OrderItemStatus == OrderItemStatus.Nomarl)
            {
                if (this.ShipmentModelId == -2)
                {
                    if ((OrderStatus)this.OrderStatusCode == OrderStatus.WaitBuyerPay && this.PaymentTypeId == -3)
                    {
                        goto IL_004d;
                    }
                    if ((OrderStatus)this.OrderStatusCode == OrderStatus.BuyerAlreadyPaid)
                    {
                        goto IL_004d;
                    }
                }
                num = 0;
                goto IL_0059;
            }
            if (this.OrderItemStatus == OrderItemStatus.HasReplace)
            {
                base.Text = "换货中";
            }
            if (this.OrderItemStatus == OrderItemStatus.HasReturn)
            {
                base.Text = "退货中";
            }
            if (this.OrderItemStatus == OrderItemStatus.HasReturnOrReplace)
            {
                if ((OrderStatus)this.OrderStatusCode == OrderStatus.BuyerAlreadyPaid)
                {
                    base.Text = "退款中";
                }
                else
                {
                    base.Text = "售后中";
                }
            }
            goto IL_025b;
IL_025b:
            base.Render(writer);
            return;

IL_0059:
            if (num != 0)
            {
                if (!this.IsConfirm)
                {
                    base.Text = "门店配货中";
                }
                else
                {
                    base.Text = "待上门自提";
                }
            }
            else
            {
                if (((OrderStatus)this.OrderStatusCode == OrderStatus.WaitBuyerPay || (OrderStatus)this.OrderStatusCode == OrderStatus.BuyerAlreadyPaid) && this.Gateway == "hishop.plugins.payment.podrequest")
                {
                    base.Text = "等待发货";
                }
                else if ((OrderStatus)this.OrderStatusCode == OrderStatus.WaitBuyerPay)
                {
                    if (this.PreSaleId > 0)
                    {
                        if (!this.DepositDate.HasValue)
                        {
                            base.Text = "等待支付定金";
                        }
                        else
                        {
                            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.PreSaleId);
                            if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                            {
                                base.Text = "等待尾款支付开始";
                            }
                            else
                            {
                                base.Text = "等待支付尾款";
                            }
                        }
                    }
                    else
                    {
                        base.Text = OrderInfo.GetOrderStatusName((OrderStatus)this.OrderStatusCode, this.OrderType);
                    }
                }
                else
                {
                    base.Text = OrderInfo.GetOrderStatusName((OrderStatus)this.OrderStatusCode, this.OrderType);
                }
                if (this.ExpressCompanyName == "同城物流配送")
                {
                    base.Text = EnumDescription.GetEnumDescription((Enum)(object)this.DadaStatus, 0);
                }
            }
            goto IL_025b;
IL_004d:
            num = ((this.OrderItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
            goto IL_0059;
        }
Exemplo n.º 18
0
        protected override void AttachChildControls()
        {
            this.orderId = base.GetParameter("orderId", false);
            if (base.GetParameter("isCallback", false).ToBool())
            {
                HiContext.Current.Context.Response.Clear();
                HiContext.Current.Context.Response.ContentType = "application/json";
                string parameter = base.GetParameter("action", false);
                if (parameter.Equals("ToPay"))
                {
                    string    empty     = string.Empty;
                    OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);
                    if (orderInfo != null || orderInfo.UserId != HiContext.Current.UserId)
                    {
                        if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                        {
                            HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"当前订单不是等待付款状态\"}");
                            return;
                        }
                        if (orderInfo.CountDownBuyId > 0)
                        {
                            foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                            {
                                CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                                if (countDownInfo == null)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"" + empty + "\"}");
                                    return;
                                }
                            }
                        }
                        if (orderInfo.FightGroupId > 0)
                        {
                            foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                            {
                                FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty);
                                if (fightGroupActivityInfo == null)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"" + empty + "\"}");
                                    return;
                                }
                            }
                        }
                        if (orderInfo.PreSaleId > 0)
                        {
                            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                            if (productPreSaleInfo == null)
                            {
                                HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"预售活动不存在不能支付\"}");
                                return;
                            }
                            if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                            {
                                HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"您支付晚了,预售活动已经结束\"}");
                                return;
                            }
                            if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                            {
                                if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"尾款支付尚未开始\"}");
                                    return;
                                }
                                DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                                DateTime date     = dateTime.Date;
                                dateTime = DateTime.Now;
                                if (date < dateTime.Date)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"尾款支付已结束\"}");
                                    return;
                                }
                            }
                        }
                        int             modeId      = base.GetParameter("paymentModeId", false).ToInt(0);
                        PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                        if (paymentMode == null)
                        {
                            HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"请选择支付方式\"}");
                            return;
                        }
                        orderInfo.PaymentTypeId = paymentMode.ModeId;
                        orderInfo.Gateway       = paymentMode.Gateway;
                        orderInfo.PaymentType   = paymentMode.Name;
                        if (TradeHelper.UpdateOrderPaymentType(orderInfo))
                        {
                            string empty2 = string.Empty;
                            empty2 = ((!(orderInfo.Gateway.ToLower() != "hishop.plugins.payment.advancerequest")) ? ("{\"Status\":1,\"Msg\":\"" + $"/user/pay.aspx?OrderId={this.orderId}" + "\"}") : ((!(orderInfo.Gateway.ToLower() == "hishop.plugins.payment.bankrequest")) ? ("{\"Status\":1,\"Msg\":\"" + base.GetRouteUrl("sendPayment", new
                            {
                                this.orderId
                            }) + "\"}") : ("{\"Status\":1,\"Msg\":\"" + Globals.FullPath(base.GetRouteUrl("bank_pay", new
                            {
                                orderInfo.OrderId
                            })) + "\"}")));
                            HttpContext.Current.Response.Write(empty2);
                            HttpContext.Current.Response.End();
                            return;
                        }
                        goto IL_058f;
                    }
                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"错误的订单信息\"}");
                    HttpContext.Current.Response.End();
                    return;
                }
            }
            goto IL_058f;
IL_058f:
            if (string.IsNullOrEmpty(this.orderId))
            {
                base.GotoResourceNotFound();
            }
            this.litOrderId           = (Literal)this.FindControl("litOrderId");
            this.litOrderPrice        = (FormatedMoneyLabel)this.FindControl("litOrderPrice");
            this.promptMsg            = (HtmlGenericControl)this.FindControl("promptMsg");
            this.onlinePayPanel       = (HtmlGenericControl)this.FindControl("onlinePayPanel");
            this.btnOrderPay          = ButtonManager.Create(this.FindControl("btnOrderPay"));
            this.paymentModeList      = (Common_PaymentModeList)this.FindControl("grd_Common_PaymentModeList");
            this.paymentModeId        = (HtmlInputHidden)this.FindControl("paymentModeId");
            this.AdvanceId            = (HtmlInputHidden)this.FindControl("AdvanceId");
            this.hidOrderid           = (HtmlInputHidden)this.FindControl("hidOrderid");
            this.msgTitle             = (HtmlGenericControl)this.FindControl("msgTitle");
            this.hidIspop             = (HiddenField)this.FindControl("hidIspop");
            this.userLink             = (HtmlAnchor)this.FindControl("userLink");
            this.orderLink            = (HtmlAnchor)this.FindControl("orderLink");
            this.divfinish            = (HtmlGenericControl)this.FindControl("divfinish");
            this.userLink.HRef        = "/User/UserDefault";
            this.divOrderPayInfo      = (HtmlGenericControl)this.FindControl("divOrderPayInfo");
            this.imgPayResult         = (HtmlImage)this.FindControl("imgPayResult");
            this.hidIsPreSale         = (HiddenField)this.FindControl("hidIsPreSale");
            this.litDeposit           = (FormatedMoneyLabel)this.FindControl("litDeposit");
            this.litDeposittxt        = (Literal)this.FindControl("litDeposittxt");
            this.demodiv              = (HtmlGenericControl)this.FindControl("demodiv");
            this.demodiv.Visible      = SettingsManager.GetMasterSettings().IsDemoSite;
            this.hidHasTradePassword  = (HtmlInputHidden)this.FindControl("hidHasTradePassword");
            this.litOfflinePayContent = (Literal)this.FindControl("litOfflinePayContent");
            this.offlinePayPanel      = (HtmlGenericControl)this.FindControl("offlinePayPanel");
            if (!this.Page.IsPostBack)
            {
                this.LoadOrderInfo();
            }
        }
Exemplo n.º 19
0
        private void GotoPay()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       text           = "";
            string       text2          = HttpContext.Current.Request.UserAgent;

            if (string.IsNullOrEmpty(text2))
            {
                text2 = "";
            }
            text2 = text2.ToLower();
            string str = "";

            if (this.order == null)
            {
                this.litErrorMsg.Text = "订单数据错误";
            }
            else
            {
                DateTime dateTime;
                if (this.order.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        this.litErrorMsg.Text = "预售活动不存在不能支付";
                        return;
                    }
                    if (!this.order.DepositDate.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                            return;
                        }
                        if (!TradeHelper.CheckOrderStockBeforePay(this.order, out str))
                        {
                            this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                            return;
                        }
                    }
                    if (this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付尚未开始";
                            return;
                        }
                        dateTime = productPreSaleInfo.PaymentEndDate;
                        DateTime t = dateTime.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(this.order, out str))
                {
                    this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                    return;
                }
                string getClientPath = HiContext.Current.GetClientPath;
                this.litErrorMsg.Text = "";
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(this.order.Gateway);
                if (string.IsNullOrEmpty(text))
                {
                    text = this.order.Gateway;
                }
                if (this.order.CountDownBuyId > 0)
                {
                    string empty = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in this.order.LineItems)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, this.order.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, out empty, this.order.StoreId);
                        if (countDownInfo == null)
                        {
                            this.litErrorMsg.Text = empty;
                            return;
                        }
                    }
                }
                if (this.order.FightGroupId > 0)
                {
                    string empty2 = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem2 in this.order.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, this.order.FightGroupActivityId, this.order.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, lineItem2.Value.Quantity, out empty2);
                        if (fightGroupActivityInfo == null)
                        {
                            this.litErrorMsg.Text = empty2;
                            return;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(text))
                {
                    text = text.ToLower();
                }
                string  text3 = this.order.OrderId;
                decimal num   = this.order.GetTotal(true);
                text3 = this.order.PayOrderId;
                if (this.order.PreSaleId > 0)
                {
                    if (!this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        num = this.order.Deposit - this.order.BalanceAmount;
                    }
                    if (this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        num = this.order.FinalPayment;
                    }
                }
                if (this.order.Gateway == "hishop.plugins.payment.advancerequest")
                {
                    this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + num.F2ToString("f2"));
                }
                if (text == "hishop.plugins.payment.shengpaymobile.shengpaymobilerequest")
                {
                    if (!masterSettings.EnableWapShengPay)
                    {
                        this.litErrorMsg.Text = "未开启盛付通手机网页支付";
                    }
                    else
                    {
                        string     text4  = "\"outMemberId\":\"{0}\",\"outMemberRegisterTime\":\"{1}\",\"outMemberRegisterIP\":\"{2}\",\"outMemberVerifyStatus\":{3},\"outMemberName\":\"{4}\",\"outMemberMobile\":\"{5}\",\"attach\":\"{6}\"";
                        MemberInfo user   = HiContext.Current.User;
                        string     format = text4;
                        object[]   obj    = new object[7]
                        {
                            user.UserId,
                            null,
                            null,
                            null,
                            null,
                            null,
                            null
                        };
                        dateTime = user.CreateDate;
                        obj[1]   = dateTime.ToString("yyyyMMddHHmmss");
                        obj[2]   = "";
                        obj[3]   = 0;
                        obj[4]   = (string.IsNullOrEmpty(user.NickName) ? user.UserName : user.NickName);
                        obj[5]   = (string.IsNullOrEmpty(user.CellPhone) ? "13566778899" : user.CellPhone);
                        obj[6]   = "";
                        string         attach         = "{" + string.Format(format, obj) + "}";
                        string         text5          = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/default";
                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, text5, text5, Globals.FullPath("/pay/wap_sheng_return_url"), attach);
                        paymentRequest.SendRequest();
                    }
                }
                else if (text == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                {
                    if ((!masterSettings.EnableWeixinWapAliPay && base.ClientType == ClientType.VShop) || (!masterSettings.EnableWapAliPay && (base.ClientType == ClientType.WAP || base.ClientType == ClientType.AliOH)))
                    {
                        this.litErrorMsg.Text = "未开启支付宝网页支付";
                    }
                    else if (text2.IndexOf("micromessenger") > -1)
                    {
                        this.loadPanel.Visible  = false;
                        this.sharePanel.Visible = true;
                    }
                    else
                    {
                        this.loadPanel.Visible  = true;
                        this.sharePanel.Visible = false;
                        string         attach2         = "";
                        string         showUrl         = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach2);
                        paymentRequest2.SendRequest();
                    }
                }
                else if (this.order.Gateway == "hishop.plugins.payment.alipaycrossbordermobilepayment.alipaycrossbordermobilepaymentrequest")
                {
                    if (!masterSettings.EnableWapAliPayCrossBorder || base.ClientType != ClientType.WAP)
                    {
                        this.litErrorMsg.Text = "未开启支付宝跨境网页支付";
                    }
                    else
                    {
                        string attach3  = "";
                        string showUrl2 = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        text3 = this.order.OrderId;
                        text3 = this.order.PayOrderId;
                        PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "OrderPay", "Order_No-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl2, Globals.FullPath("/pay/wap_alipay_cross_border_return_url"), Globals.FullPath("/pay/wap_alipay_cross_border_notify_url"), attach3);
                        paymentRequest3.SendRequest();
                    }
                }
                else if (base.ClientType == ClientType.VShop)
                {
                    if (text == "hishop.plugins.payment.weixinrequest")
                    {
                        if (!masterSettings.EnableWeiXinRequest && this.order.OrderType == OrderType.ServiceOrder && !masterSettings.OpenWxAppletWxPay)
                        {
                            this.litErrorMsg.Text = "未开启支微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/wx_Submit?orderId=" + this.order.OrderId);
                    }
                    if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                    {
                        if (!masterSettings.EnableBankUnionPay)
                        {
                            this.litErrorMsg.Text = "未开启银联全渠道支付";
                        }
                        else
                        {
                            string         attach4         = "";
                            string         showUrl3        = $"http://{HttpContext.Current.Request.Url.Host}/vshop/";
                            PaymentRequest paymentRequest4 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl3, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach4);
                            paymentRequest4.SendRequest();
                        }
                    }
                    else
                    {
                        if (text == "hishop.plugins.payment.alipaywx.alipaywxrequest")
                        {
                            if (!masterSettings.EnableWeixinWapAliPay)
                            {
                                this.litErrorMsg.Text = "未开启微信端支付宝支付";
                                return;
                            }
                            HttpContext.Current.Response.Redirect("~/vshop/WXAliPay?orderId=" + this.order.OrderId);
                        }
                        if (paymentMode == null)
                        {
                            this.litErrorMsg.Text = "错误的支付方式";
                        }
                        else
                        {
                            this.litErrorMsg.Text = "微信商城不支持使用" + paymentMode.Name + "进行支付";
                        }
                    }
                }
                else if (base.ClientType == ClientType.AliOH)
                {
                    if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                    {
                        this.litErrorMsg.Text = "生活号不支持银联全渠道支付";
                    }
                    else
                    {
                        if (text == "hishop.plugins.payment.weixinrequest")
                        {
                            if (!masterSettings.EnableWapWeiXinPay)
                            {
                                this.litErrorMsg.Text = "未开启支微信支付";
                                return;
                            }
                            HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit.aspx?orderId=" + this.order.OrderId);
                        }
                        if (paymentMode == null)
                        {
                            this.litErrorMsg.Text = "错误的支付方式";
                        }
                        else
                        {
                            this.litErrorMsg.Text = "生活号不支持使用" + paymentMode.Name + "进行支付";
                        }
                    }
                }
                else if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                {
                    if (!masterSettings.EnableBankUnionPay)
                    {
                        this.litErrorMsg.Text = "未开启银联全渠道支付";
                    }
                    else
                    {
                        string         attach5         = "";
                        string         showUrl4        = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        PaymentRequest paymentRequest5 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl4, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach5);
                        paymentRequest5.SendRequest();
                    }
                }
                else
                {
                    if (text == "hishop.plugins.payment.weixinrequest")
                    {
                        if (!masterSettings.EnableWapWeiXinPay)
                        {
                            this.litErrorMsg.Text = "未开启支微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit.aspx?orderId=" + this.order.OrderId);
                    }
                    if (paymentMode == null)
                    {
                        this.litErrorMsg.Text = "错误的支付方式";
                    }
                    else
                    {
                        this.litErrorMsg.Text = "触屏版不支持使用" + paymentMode.Name + "进行支付";
                    }
                }
            }
        }
        protected override void AttachChildControls()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (!int.TryParse(this.Page.Request.QueryString["PreSaleId"], out this.presaleId))
            {
                this.ShowWapMessage("错误的活动ID", "Default.aspx");
                return;
            }
            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.presaleId);

            if (productPreSaleInfo == null)
            {
                this.ShowWapMessage("错误的活动ID", "Default.aspx");
                return;
            }
            if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
            {
                this.Page.Response.Redirect("ProductDetails.aspx?ProductId = " + productPreSaleInfo.ProductId);
                return;
            }
            this.productId               = productPreSaleInfo.ProductId;
            this.hidSupplier             = (HtmlInputHidden)this.FindControl("hidSupplier");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.rptCouponList           = (WapTemplatedRepeater)this.FindControl("rptCouponList");
            this.rp_guest                = (WapTemplatedRepeater)this.FindControl("rp_guest");
            this.rp_com                  = (WapTemplatedRepeater)this.FindControl("rp_com");
            this.litProdcutName          = (Literal)this.FindControl("litProdcutName");
            this.litShortDescription     = (Literal)this.FindControl("litShortDescription");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.ltlcombinamaininfo      = (Literal)this.FindControl("ltlcombinamaininfo");
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.expandAttr              = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount            = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount         = (Literal)this.FindControl("litReviewsCount");
            this.litHasCollected         = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.hidden_skus             = (HtmlInputHidden)this.FindControl("hidden_skus");
            this.ltlOrderPromotion       = (Literal)this.FindControl("ltlOrderPromotion");
            this.ltlOrderPromotion2      = (Literal)this.FindControl("ltlOrderPromotion2");
            this.ltlProductSendGifts     = (Literal)this.FindControl("ltlProductSendGifts");
            this.ltlProductSendGifts2    = (Literal)this.FindControl("ltlProductSendGifts2");
            this.liOrderPromotions       = (HtmlGenericControl)this.FindControl("liOrderPromotions");
            this.liOrderPromotions2      = (HtmlGenericControl)this.FindControl("liOrderPromotions2");
            this.liProductSendGifts      = (HtmlGenericControl)this.FindControl("liProductSendGifts");
            this.liProductSendGifts2     = (HtmlGenericControl)this.FindControl("liProductSendGifts2");
            this.liOrderPromotions_free2 = (HtmlGenericControl)this.FindControl("liOrderPromotions_free2");
            this.liOrderPromotions_free  = (HtmlGenericControl)this.FindControl("liOrderPromotions_free");
            this.ltlOrderPromotion_free2 = (Literal)this.FindControl("ltlOrderPromotion_free2");
            this.ltlOrderPromotion_free  = (Literal)this.FindControl("ltlOrderPromotion_free");
            this.lbUserProductRefer      = (UserProductReferLabel)this.FindControl("lbUserProductRefer");
            this.divshiptoregion         = (HtmlGenericControl)this.FindControl("divshiptoregion");
            this.divwaplocateaddress     = (HtmlGenericControl)this.FindControl("divwaplocateaddress");
            this.productFreight          = (ProductFreightLiteral)this.FindControl("productFreight");
            this.promote                 = (ProductPromote)this.FindControl("ProductPromote");
            this.hdAppId                 = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle                 = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc                  = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl                = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink                  = (HtmlInputHidden)this.FindControl("hdLink");
            this.hidCombinaid            = (HtmlInputHidden)this.FindControl("hidCombinaid");
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.ulConsultations         = (HtmlGenericControl)this.FindControl("ulConsultations");
            this.divShortDescription     = (HtmlGenericControl)this.FindControl("divShortDescription");
            this.hidRegionId             = (HtmlInputHidden)this.FindControl("hidRegionId");
            this.divProductReferral      = (HtmlGenericControl)this.FindControl("divProductReferral");
            this.hidden_productId        = (HtmlInputHidden)this.FindControl("hidden_productId");
            this.hidCouponCount          = (HtmlInputHidden)this.FindControl("hidCouponCount");
            this.hidHasStores            = (HtmlInputHidden)this.FindControl("hidHasStores");
            this.divPodrequest           = (HtmlGenericControl)this.FindControl("divPodrequest");
            this.divGuest                = (HtmlGenericControl)this.FindControl("divGuest");
            this.divcombina              = (HtmlGenericControl)this.FindControl("divcombina");
            this.hidUnOnSale             = (HtmlInputHidden)this.FindControl("hidUnOnSale");
            this.divPhonePrice           = (HtmlGenericControl)this.FindControl("divPhonePrice");
            this.litPhonePrice           = (Literal)this.FindControl("litPhonePrice");
            this.litpresaleprice         = (Literal)this.FindControl("litpresaleprice");
            this.litsaleprice            = (Literal)this.FindControl("litsaleprice");
            this.litRetainage            = (Literal)this.FindControl("litRetainage");
            this.litDeliverGood          = (Literal)this.FindControl("litDeliverGood");
            this.hidEndDate              = (HtmlInputHidden)this.FindControl("hidEndDate");
            this.hidNowDate              = (HtmlInputHidden)this.FindControl("hidNowDate");
            this.hdAppId.Value           = masterSettings.WeixinAppId;
            HtmlInputHidden htmlInputHidden = this.hidRegionId;
            int             num             = HiContext.Current.DeliveryScopRegionId;

            htmlInputHidden.Value = num.ToString();
            this.hidden_skuItem   = (HtmlInputHidden)this.FindControl("hidden_skuItem");
            this.hidCartQuantity  = (HtmlInputHidden)this.FindControl("txCartQuantity");
            this.lblStock         = (StockLabel)this.FindControl("lblStock");
            this.litUnit          = (Literal)this.FindControl("litUnit");
            ProductBrowseInfo productPreSaleBrowseInfo = ProductBrowser.GetProductPreSaleBrowseInfo(this.productId, true);

            if (productPreSaleBrowseInfo.Product == null || productPreSaleBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
            {
                this.Page.Response.Redirect("ProductDelete.aspx");
                return;
            }
            if (productPreSaleBrowseInfo.Product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.hidUnOnSale.Value = "1";
            }
            this.litpresaleprice.Text = ((productPreSaleInfo.DepositPercent == 0) ? productPreSaleInfo.Deposit.F2ToString("f2") : ((decimal)productPreSaleInfo.DepositPercent * productPreSaleBrowseInfo.Product.MinSalePrice / 100m).F2ToString("f2"));
            if (productPreSaleBrowseInfo.Product.MinSalePrice < productPreSaleBrowseInfo.Product.MaxSalePrice)
            {
                this.litsaleprice.Text = "¥" + productPreSaleBrowseInfo.Product.MinSalePrice.F2ToString("f2") + "~ ¥" + productPreSaleBrowseInfo.Product.MaxSalePrice.F2ToString("f2");
            }
            else
            {
                this.litsaleprice.Text = "¥" + productPreSaleBrowseInfo.Product.MinSalePrice.F2ToString("f2");
            }
            Literal  literal  = this.litRetainage;
            DateTime dateTime = productPreSaleInfo.PaymentStartDate;
            string   str      = dateTime.ToString("yyyy/MM/dd");

            dateTime     = productPreSaleInfo.PaymentEndDate;
            literal.Text = str + "~" + dateTime.ToString("yyyy/MM/dd");
            Literal literal2 = this.litDeliverGood;
            object  text;

            if (!productPreSaleInfo.DeliveryDate.HasValue)
            {
                text = $"尾款支付后{productPreSaleInfo.DeliveryDays}天内发货";
            }
            else
            {
                dateTime = productPreSaleInfo.DeliveryDate.Value;
                text     = dateTime.ToString("yyyy年MM月dd日") + "发货";
            }
            literal2.Text = (string)text;
            HtmlInputHidden htmlInputHidden2 = this.hidNowDate;

            dateTime = DateTime.Now;
            htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            HtmlInputHidden htmlInputHidden3 = this.hidEndDate;

            dateTime = productPreSaleInfo.PreSaleEndDate;
            htmlInputHidden3.Value                 = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            this.skuSubmitOrder.ProductInfo        = productPreSaleBrowseInfo.Product;
            this.skuSubmitOrder.OrderBusiness      = 4;
            this.skuSubmitOrder.PreSaleId          = this.presaleId;
            this.skuSubmitOrder.productPreSaleInfo = productPreSaleInfo;
            this.lbUserProductRefer.product        = productPreSaleBrowseInfo.Product;
            this.productFreight.ShippingTemplateId = productPreSaleBrowseInfo.Product.ShippingTemplateId;
            this.productFreight.Volume             = productPreSaleBrowseInfo.Product.Weight;
            this.productFreight.Weight             = productPreSaleBrowseInfo.Product.Weight;
            this.hdTitle.Value = Globals.StripAllTags(string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.Title) ? productPreSaleBrowseInfo.Product.ProductName : productPreSaleBrowseInfo.Product.Title);
            this.hdDesc.Value  = Globals.StripAllTags(string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ShortDescription) ? this.hdTitle.Value : productPreSaleBrowseInfo.Product.ShortDescription);
            string local = string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl1) ? SettingsManager.GetMasterSettings().DefaultProductImage : productPreSaleBrowseInfo.Product.ImageUrl1;

            this.hdImgUrl.Value = Globals.FullPath(local);
            this.hdLink.Value   = Globals.FullPath(HttpContext.Current.Request.Url.ToString());
            IEnumerable enumerable = from item in productPreSaleBrowseInfo.Product.Skus
                                     select item.Value;

            if (this.hidCartQuantity != null)
            {
                this.hidCartQuantity.Value = ShoppingCartProcessor.GetQuantity_Product(this.productId);
            }
            IEnumerable value = from item in productPreSaleBrowseInfo.Product.Skus
                                select item.Value;

            if (JsonConvert.SerializeObject(productPreSaleBrowseInfo.DbSKUs) != null)
            {
                this.hidden_skuItem.Value = JsonConvert.SerializeObject(productPreSaleBrowseInfo.DbSKUs);
            }
            if (this.hidden_skus != null)
            {
                this.hidden_skus.Value = JsonConvert.SerializeObject(value);
            }
            if (this.hidden_productId != null)
            {
                this.hidden_productId.Value = this.productId.ToString();
            }
            if (this.promote != null)
            {
                this.promote.ProductId = this.productId;
            }
            int supplierId = productPreSaleBrowseInfo.Product.SupplierId;

            if (supplierId > 0)
            {
                SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                if (supplierById != null)
                {
                    this.hidSupplier.Value    = "true";
                    this.litSupplierName.Text = supplierById.SupplierName;
                }
            }
            else
            {
                this.hidSupplier.Value = "false";
            }
            MemberInfo user = HiContext.Current.User;

            if (user != null && user.IsReferral() && (!(this.sitesettings.SubMemberDeduct <= decimal.Zero) || productPreSaleBrowseInfo.Product.SubMemberDeduct.HasValue))
            {
                if (!productPreSaleBrowseInfo.Product.SubMemberDeduct.HasValue)
                {
                    goto IL_0c63;
                }
                decimal?subMemberDeduct = productPreSaleBrowseInfo.Product.SubMemberDeduct;
                if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue)
                {
                    goto IL_0c63;
                }
            }
            goto IL_0c89;
IL_0c89:
            int num2 = 1;

            goto IL_0c8a;
IL_0c8a:
            if (num2 != 0)
            {
                this.divProductReferral.Visible = false;
            }
            if (this.rptProductImages != null)
            {
                string locationUrl = "javascript:;";
                if (string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl1) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl2) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl3) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl4) && string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ImageUrl5))
                {
                    productPreSaleBrowseInfo.Product.ImageUrl1 = masterSettings.DefaultProductImage;
                }
                List <SlideImage> list = new List <SlideImage>();
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl1, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl2, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl3, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl4, locationUrl));
                list.Add(new SlideImage(productPreSaleBrowseInfo.Product.ImageUrl5, locationUrl));
                this.rptProductImages.DataSource = from item in list
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.Text         = productPreSaleBrowseInfo.Product.ProductName;
            this.litShortDescription.Text    = productPreSaleBrowseInfo.Product.ShortDescription;
            this.divShortDescription.Visible = !string.IsNullOrEmpty(productPreSaleBrowseInfo.Product.ShortDescription);
            if (this.litDescription != null)
            {
                string text2 = "";
                Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                if (!string.IsNullOrWhiteSpace(productPreSaleBrowseInfo.Product.MobbileDescription))
                {
                    text2 = regex.Replace(productPreSaleBrowseInfo.Product.MobbileDescription, "");
                }
                else if (!string.IsNullOrWhiteSpace(productPreSaleBrowseInfo.Product.Description))
                {
                    text2 = regex.Replace(productPreSaleBrowseInfo.Product.Description, "");
                }
                text2 = text2.Replace("src", "data-url");
                this.litDescription.Text = text2;
            }
            Literal control = this.litSoldCount;

            num = productPreSaleBrowseInfo.Product.ShowSaleCounts;
            control.SetWhenIsNotNull(num.ToString());
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            Literal control2 = this.litConsultationsCount;

            num = productPreSaleBrowseInfo.ConsultationCount;
            control2.SetWhenIsNotNull(num.ToString());
            Literal control3 = this.litReviewsCount;

            num = productPreSaleBrowseInfo.ReviewCount;
            control3.SetWhenIsNotNull(num.ToString());
            MemberInfo user2 = HiContext.Current.User;
            bool       flag  = false;

            if (user2 != null)
            {
                flag = ProductBrowser.CheckHasCollect(user2.UserId, this.productId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            this.BindCouponList();
            PageTitle.AddSiteNameTitle(productPreSaleBrowseInfo.Product.ProductName);
            this.BindPromotionInfo();
            this.BindGuestProducts();
            DataTable dBConsultations = productPreSaleBrowseInfo.DBConsultations;

            for (int i = 0; i < dBConsultations.Rows.Count; i++)
            {
                dBConsultations.Rows[i]["UserName"] = DataHelper.GetHiddenUsername(dBConsultations.Rows[i]["UserName"].ToNullString());
            }
            this.rptProductConsultations.DataSource = dBConsultations;
            this.rptProductConsultations.DataBind();
            this.divConsultationEmpty.Visible = dBConsultations.IsNullOrEmpty();
            this.ulConsultations.Visible      = !dBConsultations.IsNullOrEmpty();
            return;

IL_0c63:
            if (HiContext.Current.SiteSettings.OpenReferral == 1)
            {
                num2 = ((!HiContext.Current.SiteSettings.ShowDeductInProductPage) ? 1 : 0);
                goto IL_0c8a;
            }
            goto IL_0c89;
        }
Exemplo n.º 21
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("交易密码");
            HtmlInputHidden htmlInputHidden = (HtmlInputHidden)this.FindControl("hidkey");
            Literal         literal         = (Literal)this.FindControl("OrderId");
            Literal         literal2        = (Literal)this.FindControl("litOrderTotal");
            string          orderId         = literal.Text = this.Page.Request.QueryString["orderId"].ToNullString();
            OrderInfo       orderInfo       = ShoppingProcessor.GetOrderInfo(orderId);
            string          str             = "";

            if (orderInfo == null)
            {
                base.GotoResourceNotFound("数据错误!");
            }
            else
            {
                if (orderInfo.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        base.GotoResourceNotFound("预售活动不存在不能支付");
                        return;
                    }
                    if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                    {
                        base.GotoResourceNotFound("您支付晚了,预售活动已经结束");
                        return;
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            base.GotoResourceNotFound("尾款支付尚未开始");
                            return;
                        }
                        DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            base.GotoResourceNotFound("尾款支付已结束");
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                {
                    base.GotoResourceNotFound(str + ",库存不足,不能进行支付");
                    return;
                }
                HtmlInputHidden htmlInputHidden2 = (HtmlInputHidden)this.FindControl("txtIsFightGroup");
                if (htmlInputHidden2 != null)
                {
                    htmlInputHidden2.Value = ((orderInfo.FightGroupId > 0) ? "true" : "false");
                }
                decimal num = default(decimal);
                if (decimal.TryParse(this.Page.Request.QueryString["totalAmount"], out num))
                {
                    literal2.Text = num.F2ToString("f2");
                }
                else
                {
                    base.GotoResourceNotFound("传入值有误");
                }
            }
        }
Exemplo n.º 22
0
        private void dlstOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                string       a = "";
                if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                {
                    a = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                }
                string          text             = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo       orderInfo        = TradeHelper.GetOrderInfo(text);
                OrderStatus     orderStatus      = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                int             num              = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnPayOrder");
                Literal         literal          = (Literal)e.Item.FindControl("litCloseOrder");
                HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("lkbtnEditPrice");
                int             num2             = (int)((DataBinder.Eval(e.Item.DataItem, "GroupBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "GroupBuyId"));
                int             num3             = (int)((DataBinder.Eval(e.Item.DataItem, "CountDownBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "CountDownBuyId"));
                int             num4             = (int)((DataBinder.Eval(e.Item.DataItem, "BundlingId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "BundlingId"));
                int             num5             = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                Literal         literal2         = (Literal)e.Item.FindControl("litDivideStore");
                Literal         literal3         = (Literal)e.Item.FindControl("isGiftOrder");
                LinkButton      linkButton       = (LinkButton)e.Item.FindControl("lbtnFightGroup");
                Image           image            = (Image)e.Item.FindControl("imgError");
                HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
                HtmlInputHidden htmlInputHidden  = (HtmlInputHidden)e.Item.FindControl("hidFightGroup");
                HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("aftersaleImg");
                image.Visible = orderInfo.IsError;
                if (orderInfo.IsError)
                {
                    image.Attributes.Add("title", orderInfo.ErrorMessage);
                    image.ImageUrl = "\\Admin\\images\\orderError.png";
                }
                ProductPreSaleInfo productPreSaleInfo = null;
                if (orderInfo.PreSaleId > 0)
                {
                    Literal            literal4           = (Literal)e.Item.FindControl("litPreSale");
                    Literal            literal5           = (Literal)e.Item.FindControl("litSendGoods");
                    FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("lblOrderTotals");
                    e.Item.FindControl("lblAmount").Visible = true;
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    literal4.Text      = "<font>定金:" + orderInfo.Deposit.F2ToString("f2") + "</font>";
                    Literal literal6 = literal4;
                    literal6.Text            = literal6.Text + "<font>尾款:" + orderInfo.FinalPayment.F2ToString("f2") + "</font>";
                    literal4.Visible         = true;
                    formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                    formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).ToString();
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        literal5.Visible = true;
                        DateTime dateTime;
                        if (productPreSaleInfo.DeliveryDate.HasValue)
                        {
                            Literal literal7 = literal5;
                            dateTime      = productPreSaleInfo.DeliveryDate.Value;
                            literal7.Text = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                        }
                        else
                        {
                            DateTime payDate = orderInfo.PayDate;
                            if (orderInfo.PayDate != DateTime.MinValue)
                            {
                                Literal literal8 = literal5;
                                dateTime      = orderInfo.PayDate;
                                dateTime      = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                literal8.Text = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                        }
                    }
                }
                RefundInfo refundInfo = TradeHelper.GetRefundInfo(orderInfo.OrderId);
                if (orderInfo.ItemStatus != 0 || orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                {
                    if (orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null)
                        {
                            htmlAnchor2.Visible = true;
                            htmlAnchor2.Title   = "订单已申请退款";
                            htmlAnchor2.HRef    = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                    }
                    else
                    {
                        int            num6           = 0;
                        AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                        int            num7           = 0;
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.ReturnInfo != null || value.ReplaceInfo != null)
                            {
                                ReturnInfo  returnInfo  = value.ReturnInfo;
                                ReplaceInfo replaceInfo = value.ReplaceInfo;
                                if (num6 == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                {
                                    if (value.ReturnInfo != null)
                                    {
                                        afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                        num7           = value.ReturnInfo.ReturnId;
                                    }
                                    else
                                    {
                                        afterSaleTypes = AfterSaleTypes.Replace;
                                        num7           = value.ReplaceInfo.ReplaceId;
                                    }
                                }
                                num6++;
                            }
                        }
                        if (orderInfo.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                        {
                            htmlAnchor2.Title = "订单中有商品正在退货/换货中";
                        }
                        else if (orderInfo.ReturnedCount > 0)
                        {
                            htmlAnchor2.Title = "订单中有商品已退货完成";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReplace)
                        {
                            htmlAnchor2.Title = "订单中有商品正在进行换货操作";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReturn)
                        {
                            htmlAnchor2.Title = "订单中有商品正在进行退货操作";
                        }
                        if (num6 > 0)
                        {
                            htmlAnchor2.Visible = true;
                            if (afterSaleTypes == AfterSaleTypes.ReturnAndRefund)
                            {
                                htmlAnchor2.HRef = "ReturnApplyDetail?ReturnId=" + num7;
                            }
                            else
                            {
                                htmlAnchor2.HRef = "ReplaceApplyDetail?ReplaceId=" + num7;
                            }
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                    if (fightGroup != null)
                    {
                        linkButton.PostBackUrl = "/Admin/promotion/FightGroupDetails.aspx?fightGroupActivityId=" + fightGroup.FightGroupActivityId;
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && orderInfo.OrderStatus != OrderStatus.WaitBuyerPay && orderInfo.OrderStatus != OrderStatus.Closed)
                        {
                            htmlInputHidden.Value = "1";
                        }
                        else
                        {
                            htmlInputHidden.Value = "0";
                        }
                    }
                }
                else
                {
                    linkButton.Visible = false;
                }
                OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                if (orderStatusLabel != null)
                {
                    orderStatusLabel.OrderItemStatus = orderInfo.ItemStatus;
                    if (orderInfo.PreSaleId > 0)
                    {
                        orderStatusLabel.PreSaleId   = orderInfo.PreSaleId;
                        orderStatusLabel.DepositDate = orderInfo.DepositDate;
                    }
                }
                HtmlAnchor htmlAnchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnToDetail");
                int        num8        = (int)((DataBinder.Eval(e.Item.DataItem, "StoreId") == DBNull.Value) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "StoreId"));
                bool       flag        = (bool)((DataBinder.Eval(e.Item.DataItem, "IsStoreCollect") == DBNull.Value) ? ((object)false) : DataBinder.Eval(e.Item.DataItem, "IsStoreCollect"));
                bool       flag2       = false;
                if (refundInfo != null)
                {
                    htmlAnchor.HRef = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId.ToString();
                    flag2           = true;
                }
                if (orderInfo.LineItems.Count <= 0)
                {
                    literal3.Text = "(礼)";
                }
                Literal literal9 = (Literal)e.Item.FindControl("group");
                if (literal9 != null)
                {
                    if (num2 > 0)
                    {
                        literal9.Text = "(团)";
                    }
                    if (num3 > 0)
                    {
                        literal9.Text = "(抢)";
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        literal9.Text = "(预)";
                    }
                }
                if (orderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        if (!orderInfo.DepositDate.HasValue)
                        {
                            hyperLink.NavigateUrl = "javascript:DialogFrame('/Admin/sales/EditOrder.aspx?OrderId=" + text + "','修改订单价格',null,null,function(e){location.reload();})";
                            hyperLink.Visible     = true;
                            literal.Visible       = true;
                            if (a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                            {
                                imageLinkButton.Visible = true;
                            }
                        }
                        else if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now && a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                    else
                    {
                        hyperLink.NavigateUrl = "javascript:DialogFrame('/Admin/sales/EditOrder.aspx?OrderId=" + text + "','修改订单价格',null,null,function(e){location.reload();})";
                        hyperLink.Visible     = true;
                        if (a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0 && (orderInfo.ParentOrderId == "0" || orderInfo.ParentOrderId == "-1"))
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                }
                if (a == "hishop.plugins.payment.podrequest")
                {
                    int num9;
                    switch (orderStatus)
                    {
                    case OrderStatus.SellerAlreadySent:
                        num9 = ((orderInfo.ParentOrderId == "0" || orderInfo.ParentOrderId == "-1") ? 1 : 0);
                        break;

                    default:
                        num9 = 0;
                        break;

                    case OrderStatus.WaitBuyerPay:
                        num9 = 1;
                        break;
                    }
                    if (num9 != 0)
                    {
                        literal.Visible = true;
                    }
                }
                if (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.StoreId > 0 && masterSettings.OpenMultStore)
                {
                    literal.Visible = false;
                }
                if (orderStatus == OrderStatus.ApplyForRefund && !orderInfo.IsStoreCollect)
                {
                    htmlAnchor.Visible = true;
                }
                imageLinkButton2.Visible = (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
                if (masterSettings.OpenMultStore && num == -2 && orderStatus == OrderStatus.WaitBuyerPay)
                {
                    literal.Visible   = !orderInfo.IsConfirm;
                    hyperLink.Visible = true;
                    if (a != "hishop.plugins.payment.podrequest" && orderInfo.PaymentTypeId != -3 && orderInfo.FightGroupId == 0)
                    {
                        imageLinkButton.Visible = true;
                    }
                }
            }
        }
Exemplo n.º 23
0
        private void dlstOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }
            string      orderId     = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
            OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(orderId);
            OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
            HtmlAnchor  htmlAnchor  = (HtmlAnchor)e.Item.FindControl("lkbtnCheckTake");
            Literal     literal     = (Literal)e.Item.FindControl("litCloseOrder");
            int         num         = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
            string      text        = "";

            if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
            {
                text = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
            }
            int              num2             = (int)((DataBinder.Eval(e.Item.DataItem, "GroupBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "GroupBuyId"));
            int              num3             = (int)((DataBinder.Eval(e.Item.DataItem, "CountDownBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "CountDownBuyId"));
            Label            label            = (Label)e.Item.FindControl("lkbtnSendGoods");
            ImageLinkButton  imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnPayOrder");
            ImageLinkButton  imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
            HtmlAnchor       htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
            ImageLinkButton  imageLinkButton3 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirm");
            int              num4             = (int)((DataBinder.Eval(e.Item.DataItem, "StoreId") == DBNull.Value) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "StoreId"));
            bool             flag             = (bool)((DataBinder.Eval(e.Item.DataItem, "IsStoreCollect") == DBNull.Value) ? ((object)false) : DataBinder.Eval(e.Item.DataItem, "IsStoreCollect"));
            OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");

            if (orderStatusLabel != null)
            {
                orderStatusLabel.OrderItemStatus = orderInfo.ItemStatus;
                if (orderInfo.PreSaleId > 0)
                {
                    orderStatusLabel.PreSaleId   = orderInfo.PreSaleId;
                    orderStatusLabel.DepositDate = orderInfo.DepositDate;
                }
            }
            bool       flag2      = false;
            RefundInfo refundInfo = TradeHelper.GetRefundInfo(orderId);

            if (refundInfo != null && orderInfo.StoreId == this.UserStoreId)
            {
                htmlAnchor2.Attributes.Add("refundid", refundInfo.RefundId.ToString());
                flag2 = true;
            }
            Literal literal2 = (Literal)e.Item.FindControl("group");

            if (literal2 != null)
            {
                if (num2 > 0)
                {
                    literal2.Text = "(团)";
                }
                if (num3 > 0)
                {
                    literal2.Text = "(抢)";
                }
                if (orderInfo.PreSaleId > 0)
                {
                    literal2.Text = "(预)";
                }
            }
            if (orderStatus == OrderStatus.WaitBuyerPay)
            {
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue)
                    {
                        literal.Visible = true;
                        if (text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                    else
                    {
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now && text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                }
                else
                {
                    literal.Visible = true;
                    if (text != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                    {
                        imageLinkButton.Visible = true;
                    }
                }
            }
            if (text == "hishop.plugins.payment.podrequest" && (orderStatus == OrderStatus.WaitBuyerPay || orderStatus == OrderStatus.SellerAlreadySent))
            {
                literal.Visible = true;
            }
            if ((orderStatus == OrderStatus.ApplyForRefund && this.UserStoreId == num4) & flag)
            {
                htmlAnchor2.Visible = true;
            }
            if (num2 > 0)
            {
                string[] source = new string[1]
                {
                    "hishop.plugins.payment.podrequest"
                };
                GroupBuyStatus groupBuyStatus = (GroupBuyStatus)DataBinder.Eval(e.Item.DataItem, "GroupBuyStatus");
                Label          label2         = label;
                int            visible;
                switch (orderStatus)
                {
                case OrderStatus.WaitBuyerPay:
                    if (source.Contains(text))
                    {
                        goto case OrderStatus.BuyerAlreadyPaid;
                    }
                    goto default;

                case OrderStatus.BuyerAlreadyPaid:
                    if (groupBuyStatus == GroupBuyStatus.Success)
                    {
                        visible = ((orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                        break;
                    }
                    goto default;

                default:
                    visible = 0;
                    break;
                }
                label2.Visible = ((byte)visible != 0);
            }
            else
            {
                Label label3 = label;
                int   visible2;
                switch (orderStatus)
                {
                case OrderStatus.WaitBuyerPay:
                    if (text == "hishop.plugins.payment.podrequest")
                    {
                        goto case OrderStatus.BuyerAlreadyPaid;
                    }
                    goto default;

                case OrderStatus.BuyerAlreadyPaid:
                    visible2 = ((orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                    break;

                default:
                    visible2 = 0;
                    break;
                }
                label3.Visible = ((byte)visible2 != 0);
            }
            imageLinkButton2.Visible = (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
            HtmlAnchor htmlAnchor3;
            int        visible3;

            if (num == -2)
            {
                htmlAnchor3 = htmlAnchor;
                if ((orderStatus == OrderStatus.BuyerAlreadyPaid || orderStatus == OrderStatus.WaitBuyerPay) && orderInfo.ItemStatus == OrderItemStatus.Nomarl)
                {
                    visible3 = (orderInfo.IsConfirm ? 1 : 0);
                    goto IL_05d6;
                }
                visible3 = 0;
                goto IL_05d6;
            }
            goto IL_0644;
IL_0631:
            int visible4 = (orderInfo.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0;

            goto IL_063d;
IL_0644:
            LinkButton linkButton = (LinkButton)e.Item.FindControl("lbtnFightGroup");
            Image           image           = (Image)e.Item.FindControl("imgError");
            HtmlInputHidden htmlInputHidden = (HtmlInputHidden)e.Item.FindControl("hidFightGroup");

            image.Visible = orderInfo.IsError;
            if (orderInfo.IsError)
            {
                image.Attributes.Add("title", orderInfo.ErrorMessage);
                image.ImageUrl = "\\Admin\\images\\orderError.png";
            }
            if (orderInfo.FightGroupId > 0)
            {
                FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                if (fightGroup != null)
                {
                    if (fightGroup.Status == FightGroupStatus.FightGroupIn && orderInfo.OrderStatus != OrderStatus.WaitBuyerPay && orderInfo.OrderStatus != OrderStatus.Closed)
                    {
                        htmlInputHidden.Value = "1";
                    }
                    else
                    {
                        htmlInputHidden.Value = "0";
                    }
                }
            }
            else
            {
                linkButton.Visible = false;
            }
            return;

IL_05d6:
            htmlAnchor3.Visible = ((byte)visible3 != 0);
            literal.Visible     = (orderStatus == OrderStatus.WaitBuyerPay && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
            label.Visible       = false;
            ImageLinkButton imageLinkButton4 = imageLinkButton3;

            if (!orderInfo.IsConfirm)
            {
                if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && (text == "hishop.plugins.payment.podrequest" || orderInfo.PaymentTypeId == -3))
                {
                    goto IL_0631;
                }
                if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                {
                    goto IL_0631;
                }
            }
            visible4 = 0;
            goto IL_063d;
IL_063d:
            imageLinkButton4.Visible = ((byte)visible4 != 0);
            goto IL_0644;
        }
Exemplo n.º 24
0
        public void ConfirmPay(HttpContext context)
        {
            string text = context.Request["id"];

            if (string.IsNullOrWhiteSpace(text))
            {
                throw new HidistroAshxException("错误的编号");
            }
            OrderInfo orderInfo = new OrderDao().GetOrderInfo(text);

            if (orderInfo == null)
            {
                throw new HidistroAshxException("错误的编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                throw new HidistroAshxException("权限不足");
            }
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest");

            if (paymentMode != null)
            {
                orderInfo.Gateway       = paymentMode.Gateway;
                orderInfo.PaymentType   = paymentMode.Name;
                orderInfo.PaymentTypeId = paymentMode.ModeId;
            }
            else
            {
                orderInfo.Gateway       = "hishop.plugins.payment.bankrequest";
                orderInfo.PaymentType   = "线下支付";
                orderInfo.PaymentTypeId = 0;
            }
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                string empty = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        throw new HidistroAshxException(empty);
                    }
                }
            }
            if (orderInfo.FightGroupId > 0)
            {
                string empty2 = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                {
                    FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2);
                    if (fightGroupActivityInfo == null)
                    {
                        throw new HidistroAshxException(empty2);
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付");
                }
                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                num  = groupBuy.MaxCount;
                num3 = orderInfo.GetGroupBuyOerderNumber();
                if (num < num2 + num3)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付");
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    throw new HidistroAshxException("预售活动不存在");
                }
                if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款");
                }
            }
            string empty3 = string.Empty;

            switch (TradeHelper.CheckOrderBeforePay(orderInfo, out empty3))
            {
            case 1:
                throw new HidistroAshxException($"当前有商品{empty3}下架或者被删除,不能确认收款");

            case 2:
                if ((orderInfo.PreSaleId <= 0 || orderInfo.DepositDate.HasValue) && orderInfo.PreSaleId > 0)
                {
                    break;
                }
                throw new HidistroAshxException($"当前有商品{empty3}库存不足,不能确认收款");
            }
            if (OrderHelper.ConfirmPay(orderInfo))
            {
                if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                {
                    PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                }
                if (orderInfo.ParentOrderId == "-1")
                {
                    OrderQuery orderQuery = new OrderQuery();
                    orderQuery.ParentOrderId = orderInfo.OrderId;
                    IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                    foreach (OrderInfo item in listUserOrder)
                    {
                        OrderHelper.OrderConfirmPaySendMessage(item);
                    }
                }
                else
                {
                    OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                }
                base.ReturnSuccessResult(context, "成功的确认了订单收款", 0, true);
                return;
            }
            throw new HidistroAshxException("确认订单收款失败");
        }
Exemplo n.º 25
0
        private void GotoPay()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            OrderInfo    orderInfo      = ShoppingProcessor.GetOrderInfo(this.orderId);
            string       str            = "";

            if (orderInfo == null)
            {
                this.litErrorMsg.Text = "数据错误!";
            }
            else
            {
                if (orderInfo.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        this.litErrorMsg.Text = "预售活动不存在不能支付";
                        return;
                    }
                    if (!orderInfo.DepositDate.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                            return;
                        }
                        if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                        {
                            this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                            return;
                        }
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付尚未开始";
                            return;
                        }
                        DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                {
                    this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                    return;
                }
                if (orderInfo.CountDownBuyId > 0)
                {
                    string empty = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                        if (countDownInfo == null)
                        {
                            this.litErrorMsg.Text = empty;
                            return;
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    string empty2 = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2);
                        if (fightGroupActivityInfo == null)
                        {
                            this.litErrorMsg.Text = empty2;
                            return;
                        }
                    }
                }
                string  text   = orderInfo.OrderId;
                decimal amount = orderInfo.GetTotal(true);
                text = orderInfo.PayOrderId;
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        amount = orderInfo.Deposit;
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        amount = orderInfo.FinalPayment;
                    }
                }
                this.litErrorMsg.Text = "";
                if (orderInfo.Gateway == "hishop.plugins.payment.advancerequest")
                {
                    this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + orderInfo.GetTotal(false).F2ToString("f2"));
                }
                if (orderInfo.Gateway == "hishop.plugins.payment.ws_apppay.wswappayrequest")
                {
                    HttpContext.Current.Response.Redirect("~/pay/app_alipay_Submit?orderId=" + orderInfo.OrderId);
                }
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway);
                if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                {
                    if (!masterSettings.EnableAppWapAliPay)
                    {
                        this.litErrorMsg.Text = "未开启支付宝网页支付";
                    }
                    else
                    {
                        string         attach         = "";
                        string         showUrl        = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/MemberOrderDetails?orderId={orderInfo.OrderId}";
                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach);
                        paymentRequest.SendRequest();
                    }
                }
                else if (orderInfo.Gateway == "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest")
                {
                    if (!masterSettings.EnableAppShengPay)
                    {
                        this.litErrorMsg.Text = "未开启盛付通手机网页支付";
                    }
                    else
                    {
                        string         attach2         = "";
                        string         text2           = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/";
                        PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, text2, text2 + "MemberOrderDetails?orderId=" + orderInfo.OrderId, Globals.FullPath("/pay/wap_sheng_return_url"), attach2);
                        paymentRequest2.SendRequest();
                    }
                }
                else if (orderInfo.Gateway == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                {
                    if (!masterSettings.EnableAPPBankUnionPay)
                    {
                        this.litErrorMsg.Text = "未开启银联全渠道支付";
                    }
                    else
                    {
                        string         attach3         = "";
                        string         showUrl2        = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/";
                        PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl2, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach3);
                        paymentRequest3.SendRequest();
                    }
                }
                else
                {
                    if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest" || orderInfo.Gateway == "hishop.plugins.payment.appwxrequest")
                    {
                        if (!masterSettings.OpenAppWxPay || string.IsNullOrEmpty(masterSettings.AppWxAppId) || string.IsNullOrEmpty(masterSettings.AppWxAppSecret) || string.IsNullOrEmpty(masterSettings.AppWxMchId) || string.IsNullOrEmpty(masterSettings.AppWxPartnerKey))
                        {
                            this.litErrorMsg.Text = "APP未开通微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit?orderId=" + orderInfo.OrderId);
                    }
                    if (paymentMode == null)
                    {
                        this.litErrorMsg.Text = "错误的支付方式";
                    }
                    else
                    {
                        this.litErrorMsg.Text = "APP不支持使用" + paymentMode.Name + "进行支付";
                    }
                }
            }
        }
Exemplo n.º 26
0
        protected void listOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                OrderStatus orderStatus = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                string      text        = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(text);
                if (orderInfo != null)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        Literal literal = (Literal)e.Item.FindControl("litPresale");
                        literal.Text    = "(预售)";
                        literal.Visible = true;
                    }
                    OrderItemStatus itemStatus = orderInfo.ItemStatus;
                    DateTime        dateTime   = (DataBinder.Eval(e.Item.DataItem, "FinishDate") == DBNull.Value) ? DateTime.Now.AddYears(-1) : ((DateTime)DataBinder.Eval(e.Item.DataItem, "FinishDate"));
                    string          text2      = "";
                    if (DataBinder.Eval(e.Item.DataItem, "Gateway") != null && !(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                    {
                        text2 = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                    }
                    HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("hplinkorderreview");
                    HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("hlinkPay");
                    ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                    ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnCloseOrder");
                    HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("lkbtnApplyForRefund");
                    HtmlAnchor      htmlAnchor3      = (HtmlAnchor)e.Item.FindControl("lkbtnUserRealNameVerify");
                    HyperLink       hyperLink2       = (HyperLink)e.Item.FindControl("hlinkOrderDetails");
                    Repeater        repeater         = (Repeater)e.Item.FindControl("rpProduct");
                    Repeater        repeater2        = (Repeater)e.Item.FindControl("rpGift");
                    Label           label            = (Label)e.Item.FindControl("Logistics");
                    HtmlAnchor      htmlAnchor4      = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                    HtmlAnchor      htmlAnchor5      = (HtmlAnchor)e.Item.FindControl("lkbtnRefundDetail");
                    htmlAnchor2.Attributes.Add("OrderId", text);
                    htmlAnchor2.Attributes.Add("SkuId", "");
                    htmlAnchor2.Attributes.Add("GateWay", text2);
                    OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                    Literal          literal2         = (Literal)e.Item.FindControl("lblGiftTitle");
                    orderStatusLabel.order = orderInfo;
                    if (orderInfo.LineItems.Count <= 0)
                    {
                        Literal literal3 = literal2;
                        literal3.Text += "(礼)";
                    }
                    if (hyperLink != null)
                    {
                        if (orderInfo.GetGiftQuantity() > 0 && orderInfo.LineItems.Count() == 0)
                        {
                            hyperLink.Visible = false;
                        }
                        else
                        {
                            HyperLink hyperLink3 = hyperLink;
                            int       visible;
                            switch (orderStatus)
                            {
                            case OrderStatus.Closed:
                                visible = ((orderInfo.OnlyReturnedCount == orderInfo.LineItems.Count) ? 1 : 0);
                                break;

                            default:
                                visible = 0;
                                break;

                            case OrderStatus.Finished:
                                visible = 1;
                                break;
                            }
                            hyperLink3.Visible = ((byte)visible != 0);
                            if (hyperLink.Visible)
                            {
                                DataTable    productReviewAll = ProductBrowser.GetProductReviewAll(orderInfo.OrderId);
                                LineItemInfo lineItemInfo     = new LineItemInfo();
                                int          num  = 0;
                                int          num2 = 0;
                                int          num3 = 0;
                                bool         flag = false;
                                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                                {
                                    flag         = false;
                                    lineItemInfo = lineItem.Value;
                                    for (int i = 0; i < productReviewAll.Rows.Count; i++)
                                    {
                                        if (lineItemInfo.ProductId.ToString() == productReviewAll.Rows[i][0].ToString() && lineItemInfo.SkuId.ToString().Trim() == productReviewAll.Rows[i][1].ToString().Trim())
                                        {
                                            flag = true;
                                        }
                                    }
                                    if (!flag)
                                    {
                                        num2++;
                                    }
                                    else
                                    {
                                        num3++;
                                    }
                                }
                                if (num + num2 == orderInfo.LineItems.Count)
                                {
                                    hyperLink.Text = "查看评论";
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                    if (masterSettings != null)
                                    {
                                        if (masterSettings.ProductCommentPoint <= 0)
                                        {
                                            hyperLink.Text = "评价";
                                        }
                                        else
                                        {
                                            hyperLink.Text = $"评价得{num3 * masterSettings.ProductCommentPoint}积分";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("FormatedMoneyLabel2");
                        formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                        formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).F2ToString("f2");
                        if (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3)
                        {
                            if (!orderInfo.DepositDate.HasValue)
                            {
                                htmlAnchor.Visible = true;
                            }
                            else if (orderInfo.DepositDate.HasValue)
                            {
                                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                                if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && DateTime.Now <= productPreSaleInfo.PaymentEndDate)
                                {
                                    htmlAnchor.Visible = true;
                                }
                                else
                                {
                                    htmlAnchor.Visible = false;
                                }
                            }
                            else
                            {
                                htmlAnchor.Visible = false;
                            }
                        }
                        else
                        {
                            htmlAnchor.Visible = false;
                        }
                    }
                    else
                    {
                        htmlAnchor.Visible = (orderStatus == OrderStatus.WaitBuyerPay && text2 != "hishop.plugins.payment.podrequest" && text2 != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentTypeId != -3);
                    }
                    imageLinkButton.Visible = (orderStatus == OrderStatus.SellerAlreadySent && itemStatus == OrderItemStatus.Nomarl);
                    if (orderInfo.PreSaleId > 0)
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl && !orderInfo.DepositDate.HasValue);
                    }
                    else
                    {
                        imageLinkButton2.Visible = (orderStatus == OrderStatus.WaitBuyerPay && itemStatus == OrderItemStatus.Nomarl);
                    }
                    RefundInfo refundInfo = TradeHelper.GetRefundInfo(text);
                    htmlAnchor2.Visible = ((orderInfo.FightGroupId > 0 && VShopHelper.IsFightGroupCanRefund(orderInfo.FightGroupId) && orderInfo.IsCanRefund) || (orderInfo.FightGroupId <= 0 && orderInfo.IsCanRefund));
                    htmlAnchor3.Visible = (HiContext.Current.SiteSettings.IsOpenCertification && orderInfo.IDStatus == 0 && orderInfo.IsincludeCrossBorderGoods);
                    if (htmlAnchor3.Visible)
                    {
                        htmlAnchor3.Attributes.Add("OrderId", text);
                    }
                    if (repeater != null && repeater2 != null)
                    {
                        repeater.ItemDataBound += this.listProduct_ItemDataBound;
                        IList <NewLineItemInfo> list = new List <NewLineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            NewLineItemInfo newLineItemInfo = this.GetNewLineItemInfo(value, orderInfo.OrderId);
                            list.Add(newLineItemInfo);
                        }
                        if (list == null || list.Count == 0)
                        {
                            repeater.Visible = false;
                            DataTable dataTable = (DataTable)(repeater2.DataSource = TradeHelper.GetOrderGiftsThumbnailsUrl(((DataRowView)e.Item.DataItem).Row["OrderId"].ToString()));
                            repeater2.DataBind();
                            repeater2.Visible = true;
                        }
                        else
                        {
                            repeater.DataSource = list;
                            repeater.DataBind();
                            repeater2.Visible = false;
                            repeater.Visible  = true;
                        }
                    }
                    if (refundInfo != null && orderInfo.ItemStatus == OrderItemStatus.Nomarl && (orderInfo.OrderStatus == OrderStatus.ApplyForRefund || orderInfo.OrderStatus == OrderStatus.RefundRefused || orderInfo.OrderStatus == OrderStatus.Closed))
                    {
                        htmlAnchor5.HRef    = "/user/UserRefundApplyDetails/" + refundInfo.RefundId;
                        htmlAnchor5.Visible = true;
                    }
                    hyperLink2.NavigateUrl = "/user/OrderDetails/" + orderInfo.OrderId;
                    if ((orderStatus == OrderStatus.SellerAlreadySent || orderStatus == OrderStatus.Finished) && !string.IsNullOrEmpty(orderInfo.ExpressCompanyAbb) && !string.IsNullOrEmpty(orderInfo.ShipOrderNumber) && orderInfo.ShippingModeId != -2)
                    {
                        label.Attributes.Add("action", "order");
                        label.Attributes.Add("orderId", text);
                        label.Visible = true;
                    }
                    if (orderInfo.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                        htmlAnchor2.Visible = (fightGroup.Status != 0 && orderInfo.GetPayTotal() > decimal.Zero && (refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid);
                    }
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid || orderInfo.OrderStatus == OrderStatus.Finished || orderInfo.OrderStatus == OrderStatus.WaitReview || orderInfo.OrderStatus == OrderStatus.History)
                    {
                        WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
                        bool flag2 = false;
                        if (openedWeiXinRedEnvelope != null && openedWeiXinRedEnvelope.EnableIssueMinAmount <= orderInfo.GetPayTotal() && orderInfo.OrderDate >= openedWeiXinRedEnvelope.ActiveStartTime && orderInfo.OrderDate <= openedWeiXinRedEnvelope.ActiveEndTime)
                        {
                            flag2 = true;
                        }
                        if (flag2)
                        {
                            Image image = (Image)e.Item.FindControl("imgRedEnvelope");
                            image.ImageUrl = "../../../../common/images/SendRedEnvelope.png";
                            image.Attributes.Add("class", "ztitle_RedEnvelope");
                            image.Attributes.Add("onclick", "GetRedEnvelope(" + orderInfo.OrderId + ")");
                            image.Visible = true;
                        }
                    }
                    if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.ParentOrderId == "-1") || !orderInfo.OrderId.Contains("P"))
                    {
                        Label label2 = (Label)e.Item.FindControl("lblsupplier");
                        if (label2 != null)
                        {
                            string empty = string.Empty;
                            if (HiContext.Current.SiteSettings.OpenMultStore && orderInfo.StoreId > 0 && !string.IsNullOrWhiteSpace(orderInfo.StoreName))
                            {
                                label2.Text = orderInfo.StoreName;
                                empty       = "mtitle_1";
                            }
                            else if (orderInfo.StoreId == 0 && HiContext.Current.SiteSettings.OpenSupplier && orderInfo.SupplierId > 0)
                            {
                                label2.Text = orderInfo.ShipperName;
                                empty       = "stitle_1";
                            }
                            else
                            {
                                label2.Text = "平台";
                                empty       = "ztitle_1_new";
                            }
                            label2.Attributes.Add("style", string.IsNullOrWhiteSpace(label2.Text) ? "display:none" : "display:inline");
                            label2.Attributes.Add("class", empty);
                            label2.Visible = true;
                        }
                    }
                }
            }
        }
Exemplo n.º 27
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null || orderInfo.UserId != HiContext.Current.UserId)
            {
                base.GotoResourceNotFound("");
            }
            this.litOrderId          = (Literal)this.FindControl("litOrderId");
            this.litOrderTotal       = (Literal)this.FindControl("litOrderTotal");
            this.litPaymentType      = (HtmlInputHidden)this.FindControl("litPaymentType");
            this.litPaymentName      = (Literal)this.FindControl("litPaymentName");
            this.litPaymentName.Text = orderInfo.PaymentType;
            this.litErrorMsg         = (Literal)this.FindControl("litErrorMsg");
            this.litPaymentType.SetWhenIsNotNull(orderInfo.PaymentTypeId.ToString());
            this.litOrderId.SetWhenIsNotNull(this.orderId);
            this.litOrderTotal.SetWhenIsNotNull(orderInfo.GetTotal(false).F2ToString("f2"));
            this.divhelper = (HtmlGenericControl)this.FindControl("helper");
            this.btnToPay  = (HtmlAnchor)this.FindControl("btnToPay");
            Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;

            foreach (LineItemInfo value in lineItems.Values)
            {
                int          productId         = value.ProductId;
                SiteSettings masterSettings    = SettingsManager.GetMasterSettings();
                ProductInfo  productSimpleInfo = ProductBrowser.GetProductSimpleInfo(productId);
                if (productSimpleInfo == null || productSimpleInfo.SaleStatus == ProductSaleStatus.Delete)
                {
                    this.litErrorMsg.Text = "订单内商品已经被管理员删除";
                    this.btnToPay.Visible = false;
                }
                else if (productSimpleInfo.SaleStatus == ProductSaleStatus.OnStock)
                {
                    this.litErrorMsg.Text = "订单内商品已入库";
                    this.btnToPay.Visible = false;
                }
                else
                {
                    int num = 0;
                    if (productSimpleInfo.Skus.ContainsKey(value.SkuId))
                    {
                        SKUItem sKUItem = productSimpleInfo.Skus[value.SkuId];
                        num = sKUItem.MaxStock;
                        continue;
                    }
                    this.litErrorMsg.Text = "订单中有商品规格不存在,不能进行支付";
                    this.btnToPay.Visible = false;
                }
                return;
            }
            string str = "";

            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    this.litErrorMsg.Text = "预售活动不存在不能支付";
                    return;
                }
                if (!orderInfo.DepositDate.HasValue)
                {
                    if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                    {
                        this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                        return;
                    }
                    if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                    {
                        this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                        return;
                    }
                }
                if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                    {
                        this.litErrorMsg.Text = "尾款支付尚未开始";
                        return;
                    }
                    DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                    if (t <= DateTime.Now)
                    {
                        this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                        return;
                    }
                }
            }
            else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
            {
                this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                return;
            }
            if (orderInfo.Gateway != "hishop.plugins.payment.bankrequest")
            {
                this.divhelper.Visible = false;
            }
            else
            {
                this.divhelper.Visible = true;
                this.litHelperText     = (Literal)this.FindControl("litHelperText");
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay));
                if (paymentMode != null)
                {
                    this.litHelperText.SetWhenIsNotNull(paymentMode.Description);
                }
            }
            this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay");
            if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.btnToPay.Visible = false;
            }
            if (this.btnToPay != null)
            {
                this.btnToPay.HRef = "FinishOrder?orderId=" + this.orderId + "&action=topay";
            }
            else
            {
                this.GotoPay();
            }
            if (this.btnToPay != null && (orderInfo.Gateway == "hishop.plugins.payment.podrequest" || orderInfo.Gateway == "hishop.plugins.payment.bankrequest"))
            {
                this.btnToPay.Visible = false;
            }
            PageTitle.AddSiteNameTitle("下单成功");
            if (!this.Page.IsPostBack)
            {
                string text = HttpContext.Current.Request.QueryString["action"];
                if (!string.IsNullOrEmpty(text) && text == "topay")
                {
                    this.GotoPay();
                }
            }
        }
Exemplo n.º 28
0
        private void ProcessProductSkus(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int       num         = context.Request["sourceId"].ToInt(0);
            int       productId   = int.Parse(context.Request["productId"], NumberStyles.None);
            int       attributeId = int.Parse(context.Request["AttributeId"], NumberStyles.None);
            int       valueId     = int.Parse(context.Request["ValueId"], NumberStyles.None);
            int       num2        = context.Request["StoreId"].ToInt(0);
            DataTable skuItems    = ShoppingProcessor.GetUnUpUnUpsellingSkus(productId, attributeId, valueId);

            if (skuItems == null || skuItems.Rows.Count == 0)
            {
                context.Response.Write("{\"Status\":\"1\"}");
            }
            else
            {
                skuItems.Columns.Add(new DataColumn
                {
                    ColumnName = "SalePrice",
                    DataType   = typeof(decimal)
                });
                bool flag = false;
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("fightgroup".ToLower()) && num > 0)
                {
                    IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(num);
                    if (fightGroupSkus.Count > 0)
                    {
                        flag = true;
                        for (int j = 0; j < skuItems.Rows.Count; j++)
                        {
                            DataRow           row = skuItems.Rows[j];
                            FightGroupSkuInfo fightGroupSkuInfo = (from c in fightGroupSkus
                                                                   where c.SkuId == row["SkuId"].ToString()
                                                                   select c).FirstOrDefault();
                            if (fightGroupSkuInfo == null)
                            {
                                string    skuId  = skuItems.Rows[j]["skuId"].ToString();
                                DataTable theSku = new SkuDao().GetTheSku(skuId);
                                if (theSku != null && theSku.Rows.Count > 0)
                                {
                                    skuItems.Rows[j]["Stock"]     = 0;
                                    skuItems.Rows[j]["SalePrice"] = theSku.Rows[0]["SalePrice"].ToDecimal(0).F2ToString("f2");
                                }
                            }
                            else
                            {
                                int totalCount  = fightGroupSkuInfo.TotalCount;
                                int boughtCount = fightGroupSkuInfo.BoughtCount;
                                int num3        = totalCount - boughtCount;
                                if (num3 > fightGroupSkuInfo.Stock)
                                {
                                    num3 = fightGroupSkuInfo.Stock;
                                }
                                decimal salePrice = fightGroupSkuInfo.SalePrice;
                                skuItems.Rows[j]["Stock"]     = ((num3 >= 0) ? num3 : 0);
                                skuItems.Rows[j]["SalePrice"] = salePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("countdown"))
                {
                    CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, num2);
                    if (countDownInfo != null && countDownInfo.CountDownSkuInfo != null && countDownInfo.CountDownSkuInfo.Count > 0)
                    {
                        flag = true;
                        skuItems.Columns.Add(new DataColumn
                        {
                            ColumnName = "OldSalePrice",
                            DataType   = typeof(decimal)
                        });
                        List <CountDownSkuInfo> countDownSkuInfo = countDownInfo.CountDownSkuInfo;
                        int i;
                        for (i = 0; i < skuItems.Rows.Count; i++)
                        {
                            List <CountDownSkuInfo> list = (from s in countDownSkuInfo
                                                            where s.SkuId == skuItems.Rows[i]["SkuId"].ToNullString()
                                                            select s).ToList();
                            if (list == null || list.Count == 0)
                            {
                                string    skuId2  = list[0].SkuId.ToString();
                                DataTable theSku2 = new SkuDao().GetTheSku(skuId2);
                                if (theSku2 != null && theSku2.Rows.Count > 0)
                                {
                                    skuItems.Rows[i]["Stock"]        = 0;
                                    skuItems.Rows[i]["SalePrice"]    = theSku2.Rows[0]["SalePrice"].ToDecimal(0).F2ToString("f2");
                                    skuItems.Rows[i]["OldSalePrice"] = theSku2.Rows[0]["MarketPrice"].ToDecimal(0).F2ToString("f2");
                                }
                            }
                            else
                            {
                                int totalCount2  = list[0].TotalCount;
                                int boughtCount2 = list[0].BoughtCount;
                                int num4         = totalCount2 - boughtCount2;
                                skuItems.Rows[i]["Stock"] = ((num4 >= 0) ? num4 : 0);
                                decimal salePrice2   = list[0].SalePrice;
                                decimal oldSalePrice = list[0].OldSalePrice;
                                skuItems.Rows[i]["SalePrice"]    = salePrice2.F2ToString("f2");
                                skuItems.Rows[i]["OldSalePrice"] = oldSalePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("groupbuy"))
                {
                    GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num);
                    if (groupBuy != null)
                    {
                        flag = true;
                        skuItems.Columns.Add(new DataColumn
                        {
                            ColumnName = "OldSalePrice",
                            DataType   = typeof(decimal)
                        });
                        Dictionary <string, SKUItem> productSkuSaleInfo = ProductBrowser.GetProductSkuSaleInfo(productId, 0);
                        int soldCount = PromoteHelper.GetSoldCount(groupBuy.GroupBuyId);
                        for (int k = 0; k < skuItems.Rows.Count; k++)
                        {
                            DataRow dataRow = skuItems.Rows[k];
                            if (productSkuSaleInfo.ContainsKey(dataRow["SkuId"].ToNullString()))
                            {
                                SKUItem sKUItem = productSkuSaleInfo[dataRow["SkuId"].ToNullString()];
                                int     num5    = skuItems.Rows[k]["Stock"].ToInt(0);
                                int     num6    = groupBuy.MaxCount - soldCount;
                                if (num5 < num6)
                                {
                                    skuItems.Rows[k]["Stock"] = num5;
                                }
                                else
                                {
                                    skuItems.Rows[k]["Stock"] = num6;
                                }
                                skuItems.Rows[k]["SalePrice"]    = groupBuy.Price.F2ToString("f2");
                                skuItems.Rows[k]["OldSalePrice"] = sKUItem.SalePrice.F2ToString("f2");
                            }
                        }
                    }
                }
                if (context.Request.UrlReferrer.AbsoluteUri.ToLower().Contains("presaleproductdetails") && num > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(num);
                    if (productPreSaleInfo != null)
                    {
                        flag = true;
                        Dictionary <string, SKUItem> preSaleProductSkuSaleInfo = ProductBrowser.GetPreSaleProductSkuSaleInfo(productId);
                        foreach (DataRow row2 in skuItems.Rows)
                        {
                            if (preSaleProductSkuSaleInfo.ContainsKey(row2["SkuId"].ToString()))
                            {
                                SKUItem sKUItem2 = preSaleProductSkuSaleInfo[row2["SkuId"].ToString()];
                                row2["SalePrice"] = sKUItem2.SalePrice;
                                row2["Stock"]     = sKUItem2.Stock;
                            }
                        }
                    }
                }
                if (!flag)
                {
                    Dictionary <string, SKUItem> productSkuSaleInfo2 = ProductBrowser.GetProductSkuSaleInfo(productId, num2);
                    string text = "";
                    if (num2 == 0)
                    {
                        text = PromoteHelper.GetPhonePriceByProductId(productId);
                    }
                    foreach (DataRow row3 in skuItems.Rows)
                    {
                        if (productSkuSaleInfo2.ContainsKey(row3["SkuId"].ToString()))
                        {
                            SKUItem sKUItem3 = productSkuSaleInfo2[row3["SkuId"].ToString()];
                            if (!string.IsNullOrEmpty(text))
                            {
                                string  s2   = text.Split(',')[0];
                                decimal num7 = (sKUItem3.SalePrice - decimal.Parse(s2) > decimal.Zero) ? (sKUItem3.SalePrice - decimal.Parse(s2)) : decimal.Zero;
                                row3["SalePrice"] = num7.F2ToString("f2");
                            }
                            else
                            {
                                row3["SalePrice"] = sKUItem3.SalePrice;
                            }
                            row3["Stock"] = sKUItem3.Stock;
                        }
                        else
                        {
                            row3["Stock"]     = "0";
                            row3["SalePrice"] = "0.00";
                        }
                    }
                }
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("{");
                stringBuilder.Append("\"Status\":\"OK\",");
                stringBuilder.Append("\"SkuItems\":[");
                foreach (DataRow row4 in skuItems.Rows)
                {
                    stringBuilder.Append("{");
                    if (skuItems.Columns.Contains("SkuId"))
                    {
                        stringBuilder.AppendFormat("\"SkuId\":\"{0}\",", row4["SkuId"].ToString());
                    }
                    if (skuItems.Columns.Contains("SalePrice"))
                    {
                        stringBuilder.AppendFormat("\"SalePrice\":\"{0}\",", row4["SalePrice"].ToDecimal(0).F2ToString("f2"));
                    }
                    if (skuItems.Columns.Contains("OldSalePrice"))
                    {
                        stringBuilder.AppendFormat("\"OldSalePrice\":\"{0}\",", row4["OldSalePrice"].ToDecimal(0).F2ToString("f2"));
                    }
                    if (skuItems.Columns.Contains("Stock"))
                    {
                        stringBuilder.AppendFormat("\"Stock\":\"{0}\",", row4["Stock"].ToString());
                    }
                    stringBuilder.AppendFormat("\"AttributeId\":\"{0}\",", row4["AttributeId"].ToString());
                    stringBuilder.AppendFormat("\"ValueId\":\"{0}\"", row4["ValueId"].ToString());
                    stringBuilder.Append("},");
                }
                stringBuilder.Remove(stringBuilder.Length - 1, 1);
                stringBuilder.Append("]");
                stringBuilder.Append("}");
                context.Response.Write(stringBuilder.ToString());
            }
        }
Exemplo n.º 29
0
        protected void btnPay_Click(object sender, EventArgs e)
        {
            MemberInfo user = HiContext.Current.User;

            if (string.IsNullOrEmpty(user.TradePassword))
            {
                this.Page.Response.Redirect("/user/OpenBalance.aspx");
            }
            string    empty     = string.Empty;
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId);
            int       num       = 0;
            int       num2      = 0;
            int       num3      = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        this.ShowMessage(empty, false, "", 1);
                        return;
                    }
                }
            }
            if (orderInfo.FightGroupId > 0)
            {
                foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                {
                    FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty);
                    if (fightGroupActivityInfo == null)
                    {
                        this.ShowMessage(empty, false, "", 1);
                        return;
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    this.ShowMessage("当前的订单为团购订单,此团购活动已结束,所以不能支付", false, "", 1);
                    return;
                }
                num2 = TradeHelper.GetOrderCount(orderInfo.GroupBuyId);
                num3 = orderInfo.GetGroupBuyOerderNumber();
                num  = groupBuy.MaxCount;
                if (num < num2 + num3)
                {
                    this.ShowMessage("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false, "", 1);
                    return;
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    this.ShowMessage("预售活动不存在不能支付", false, "", 1);
                    return;
                }
                if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    this.ShowMessage("您支付晚了,预售活动已经结束", false, "", 1);
                    return;
                }
                if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                    {
                        this.ShowMessage("尾款支付尚未开始", false, "", 1);
                        return;
                    }
                    DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                    DateTime date     = dateTime.Date;
                    dateTime = DateTime.Now;
                    if (date < dateTime.Date)
                    {
                        this.ShowMessage("尾款支付已结束", false, "", 1);
                        return;
                    }
                }
            }
            if (!orderInfo.CheckAction(OrderActions.BUYER_PAY))
            {
                this.ShowMessage("当前的订单订单状态不是等待付款,所以不能支付", false, "", 1);
            }
            else if (HiContext.Current.UserId != orderInfo.UserId)
            {
                this.ShowMessage("预付款只能为自己下的订单付款,查一查该订单是不是你的", false, "", 1);
            }
            else if ((decimal)this.litUseableBalance.Money < orderInfo.GetTotal(false))
            {
                this.ShowMessage("预付款余额不足,支付失败", false, "", 1);
            }
            else if (MemberProcessor.ValidTradePassword(this.txtPassword.Text))
            {
                string str = "";
                if (!TradeHelper.CheckOrderStock(orderInfo, out str))
                {
                    this.ShowMessage("订单中有商品(" + str + ")库存不足", false, "", 1);
                }
                else
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    foreach (LineItemInfo value in lineItems.Values)
                    {
                        int skuStock = ShoppingCartProcessor.GetSkuStock(value.SkuId, 0);
                        if (skuStock < value.ShipmentQuantity)
                        {
                            this.ShowMessage("订单中商品库存不足,禁止支付!", false, "", 1);
                            return;
                        }
                    }
                    if (TradeHelper.UserPayOrder(orderInfo, true, false))
                    {
                        if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                        {
                            TradeHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                        }
                        if (orderInfo.ParentOrderId == "-1")
                        {
                            OrderQuery orderQuery = new OrderQuery();
                            orderQuery.ParentOrderId = orderInfo.OrderId;
                            IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                            foreach (OrderInfo item in listUserOrder)
                            {
                                OrderHelper.OrderConfirmPaySendMessage(item);
                            }
                        }
                        else
                        {
                            OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                        }
                        this.Page.Response.Redirect("/user/PaySucceed.aspx?orderId=" + this.orderId);
                    }
                    else
                    {
                        this.ShowMessage($"对订单{orderInfo.OrderId} 支付失败", false, "", 1);
                    }
                }
            }
            else
            {
                this.ShowMessage("交易密码有误,请重试", false, "", 1);
            }
        }