Esempio n. 1
0
        protected void shoppingCartProductList_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            int     num;
            Control control  = e.Item.Controls[0];
            TextBox box      = (TextBox)control.FindControl("txtBuyNum");
            Literal literal  = (Literal)control.FindControl("litProductId");
            Literal literal2 = (Literal)control.FindControl("litSkuId");

            if (!int.TryParse(box.Text, out num) || (box.Text.IndexOf(".") != -1))
            {
                this.ShowMessage("购买数量必须为整数", false);
            }
            else if (num <= 0)
            {
                this.ShowMessage("购买数量必须为大于0的整数", false);
            }
            else
            {
                if (e.CommandName == "updateBuyNum")
                {
                    if (ShoppingCartProcessor.GetSkuStock(literal2.Text.Trim()) < num)
                    {
                        this.ShowMessage("该商品库存不够", false);
                        return;
                    }
                    ShoppingCartProcessor.UpdateLineItemQuantity(Convert.ToInt32(literal.Text), literal2.Text, num);
                }
                if (e.CommandName == "delete")
                {
                    ShoppingCartProcessor.RemoveLineItem(literal2.Text);
                }
                this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("shoppingCart"), true);
            }
        }
Esempio n. 2
0
        protected void shoppingCartProductList_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            System.Web.UI.Control             control = e.Item.Controls[0];
            System.Web.UI.WebControls.TextBox textBox = (System.Web.UI.WebControls.TextBox)control.FindControl("txtBuyNum");
            System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal)control.FindControl("litSkuId");
            int num;

            if (!int.TryParse(textBox.Text, out num) || textBox.Text.IndexOf(".") != -1)
            {
                this.ShowMessage("购买数量必须为整数", false);
                return;
            }
            if (num <= 0)
            {
                this.ShowMessage("购买数量必须为大于0的整数", false);
                return;
            }
            if (e.CommandName == "updateBuyNum")
            {
                if (ShoppingCartProcessor.GetSkuStock(literal.Text.Trim()) < num)
                {
                    this.ShowMessage("该商品库存不够", false);
                    this.btnCheckout.Visible = false;
                    return;
                }
                ShoppingCartProcessor.UpdateLineItemQuantity(literal.Text, num);
            }
            if (e.CommandName == "delete")
            {
                ShoppingCartProcessor.RemoveLineItem(literal.Text);
            }
            this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("shoppingCart") + "?productSkuId=" + literal.Text, true);
        }
Esempio n. 3
0
        protected void btnClearCart_Click(object sender, EventArgs e)
        {
            string str = this.Page.Request.Form["ck_productId"];

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMessage("请选择要清除的商品", false);
            }
            else
            {
                foreach (string str2 in str.Split(new char[] { ',' }))
                {
                    ShoppingCartProcessor.RemoveLineItem(str2);
                }
                this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("shoppingCart"), true);
            }
        }
Esempio n. 4
0
        protected void btnClearCart_Click(object sender, EventArgs e)
        {
            string text = this.Page.Request.Form["ck_productId"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMessage("请选择要清除的商品", false, "", 1);
            }
            else
            {
                string[] array = text.Split(',');
                foreach (string skuId in array)
                {
                    ShoppingCartProcessor.RemoveLineItem(skuId, 0);
                }
            }
            this.Page.Response.Redirect("ShoppingCart.aspx", true);
        }
Esempio n. 5
0
        protected void btnClearCart_Click(object sender, System.EventArgs e)
        {
            string text = this.Page.Request.Form["ck_productId"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMessage("请选择要清除的商品", false);
                return;
            }
            string[] array = text.Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                string skuId = array[i];
                ShoppingCartProcessor.RemoveLineItem(skuId);
            }
            this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("shoppingCart"), true);
        }
        protected override void AttachChildControls()
        {
            this.objRadio             = new HtmlInputRadioButton[3];
            this.objRadio[0]          = (HtmlInputRadioButton)this.FindControl("OS1");
            this.objRadio[1]          = (HtmlInputRadioButton)this.FindControl("OS2");
            this.objRadio[2]          = (HtmlInputRadioButton)this.FindControl("OS3");
            this.objRadio[1].Disabled = true;
            this.objRadio[2].Disabled = true;
            this.dtGeadeInfo          = MemberProcessor.dtGetGradeInfofromUserId();
            if (this.dtGeadeInfo.Rows.Count > 0)
            {
                if ((bool)this.dtGeadeInfo.Rows[0]["IsDaifa"] == false && (bool)this.dtGeadeInfo.Rows[0]["IsPifa"] == false)
                {
                    this.objRadio[0].Disabled = false;
                    this.objRadio[0].Checked  = true;
                    this.objRadio[1].Checked  = false;
                    this.objRadio[2].Checked  = false;
                }
                if ((bool)this.dtGeadeInfo.Rows[0]["IsDaifa"] == true)
                {
                    this.objRadio[0].Disabled = true;
                    this.objRadio[1].Disabled = false;
                    this.objRadio[0].Checked  = false;
                    this.objRadio[1].Checked  = true;
                    this.objRadio[2].Checked  = false;
                }
                else
                {
                    this.objRadio[1].Disabled = true;
                }
                if ((bool)this.dtGeadeInfo.Rows[0]["IsPifa"] == true)
                {
                    this.objRadio[0].Disabled = true;
                    this.objRadio[2].Disabled = false;
                    this.objRadio[0].Checked  = false;
                    this.objRadio[1].Checked  = false;
                    this.objRadio[2].Checked  = true;
                }
                else
                {
                    this.objRadio[2].Disabled = true;
                }
            }
            switch (this.Page.Request.QueryString["GSO"])
            {
            case "0":
                this.objRadio[0].Checked = true;
                this.objRadio[1].Checked = false;
                this.objRadio[2].Checked = false;
                break;

            case "1":
                this.objRadio[0].Checked = false;
                this.objRadio[1].Checked = true;
                this.objRadio[2].Checked = false;
                break;

            case "2":
                this.objRadio[0].Checked = false;
                this.objRadio[1].Checked = false;
                this.objRadio[2].Checked = true;
                break;
            }
            this.litShipTo       = (Literal)this.FindControl("litShipTo");
            this.litIsUseBalance = (Literal)this.FindControl("litIsUseBalance");
            this.litCellPhone    = (Literal)this.FindControl("litCellPhone");
            this.litAddress      = (Literal)this.FindControl("litAddress");
            this.litShowMes      = (Literal)this.FindControl("litShowMes");
            this.GetUserCoupons  = MemberProcessor.GetUserCoupons();
            this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.litOrderTotal          = (Literal)this.FindControl("litOrderTotal");
            this.litPointNumber         = (Literal)this.FindControl("litPointNumber");
            this.litUseMembersPointShow = (Literal)this.FindControl("litUseMembersPointShow");
            this.litDisplayPointNumber  = (Literal)this.FindControl("litDisplayPointNumber");
            this.litDisplayPoint        = (Literal)this.FindControl("litDisplayPoint");
            this.BalanceCanPayMoney     = (HtmlInputHidden)this.FindControl("BalanceCanPayMoney");
            this.groupbuyHiddenBox      = (HtmlInputControl)this.FindControl("groupbuyHiddenBox");
            this.rptAddress             = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            this.selectShipTo           = (HtmlInputHidden)this.FindControl("selectShipTo");
            this.MembersPointMoney      = (HtmlInputHidden)this.FindControl("MembersPointMoney");
            this.regionId             = (HtmlInputHidden)this.FindControl("regionId");
            this.litAddAddress        = (Literal)this.FindControl("litAddAddress");
            this.litServiceMoney      = (Literal)this.FindControl("litServiceMoney");
            this.litServiceMoney.Text = "0.00";
            IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();

            if (!this.objRadio[2].Checked == true)
            {
                this.rptAddress.DataSource = from item in shippingAddresses
                                             orderby item.IsDefault
                                             select item;
                this.rptAddress.DataBind();
                ShippingAddressInfo info = shippingAddresses.FirstOrDefault <ShippingAddressInfo>(item => item.IsDefault);
                if (info == null)
                {
                    info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null;
                }
                if (info != null)
                {
                    this.litShipTo.Text    = info.ShipTo;
                    this.litCellPhone.Text = info.CellPhone;
                    this.litAddress.Text   = info.Address;
                    this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString());
                    this.regionId.SetWhenIsNotNull(info.RegionId.ToString());
                }
                this.litAddAddress.Text = "<li><a href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "'>新增收货地址</a></li>";
            }
            else
            {
                MemberInfo          member = MemberHelper.GetMember(Globals.GetCurrentMemberUserId(false));
                ShippingAddressInfo sai    = new ShippingAddressInfo();
                sai.Address       = member.Address;
                sai.CellPhone     = member.CellPhone;
                sai.IsDefault     = true;
                sai.RegionId      = member.RegionId;
                sai.ShippingId    = 999;
                sai.ShipTo        = member.RealName;
                sai.TelPhone      = member.CellPhone;
                sai.UserId        = Globals.GetCurrentMemberUserId(false);
                sai.Zipcode       = "";
                shippingAddresses = new List <ShippingAddressInfo>();
                shippingAddresses.Add(sai);
                this.rptAddress.DataSource = from item in shippingAddresses
                                             orderby item.IsDefault
                                             select item;
                this.rptAddress.DataBind();
                ShippingAddressInfo info = shippingAddresses.FirstOrDefault <ShippingAddressInfo>(item => item.IsDefault);
                if (info == null)
                {
                    info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null;
                }
                if (info != null)
                {
                    this.litShipTo.Text    = info.ShipTo;
                    this.litCellPhone.Text = info.CellPhone;
                    this.litAddress.Text   = info.Address;
                    this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString());
                    this.regionId.SetWhenIsNotNull(info.RegionId.ToString());
                }
                this.litAddAddress.Text = "<li><a href='" + this.Page.Request.Url.ToString() + "'>批发订单不能指定收货地址,如需修改批发订单收货地址,请与管理员联系</a></li>";
            }
            if (((shippingAddresses == null) || (shippingAddresses.Count == 0)) && !this.objRadio[2].Checked == true)
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()));
            }
            else
            {
                List <ShoppingCartInfo> orderSummitCart = new List <ShoppingCartInfo>();
                if (((int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"])) && ((this.Page.Request.QueryString["from"] == "signBuy") || (this.Page.Request.QueryString["from"] == "groupBuy")))
                {
                    this.productSku = this.Page.Request.QueryString["productSku"];
                    if (this.isbargain)
                    {
                        int bargainDetialId = Globals.RequestQueryNum("bargainDetialId");
                        orderSummitCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0);
                    }
                    else
                    {
                        int buyAmount = this.buyAmount;
                        int id        = Globals.RequestQueryNum("limitedTimeDiscountId");
                        if (id > 0)
                        {
                            bool flag = true;
                            LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(id);
                            if (discountInfo == null)
                            {
                                flag = false;
                            }
                            if (flag)
                            {
                                if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, base.CurrentMemberInfo.UserId))
                                {
                                    if (discountInfo.LimitNumber != 0)
                                    {
                                        int num4 = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(id, this.productSku, 0, base.CurrentMemberInfo.UserId, false);
                                        if (this.buyAmount > (discountInfo.LimitNumber - num4))
                                        {
                                            buyAmount = discountInfo.LimitNumber - num4;
                                        }
                                    }
                                }
                                else
                                {
                                    id = 0;
                                }
                            }
                            else
                            {
                                id = 0;
                            }
                        }
                        if (id > 0)
                        {
                            ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, id);
                        }
                        if ((buyAmount == 0) && (id > 0))
                        {
                            buyAmount = this.buyAmount;
                            id        = 0;
                        }
                        orderSummitCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, buyAmount, 0, id);
                    }
                }
                else
                {
                    orderSummitCart = ShoppingCartProcessor.GetOrderSummitCart();
                }
                if (orderSummitCart == null)
                {
                    HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>");
                }
                else
                {
                    if (orderSummitCart.Count > 1)
                    {
                        this.litShowMes.Text = "<div style=\"color: #F60; \"><img  src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>";
                    }
                    this.rptCartProducts.DataSource = orderSummitCart;
                    this.rptCartProducts.DataBind();
                    decimal num5        = 0M;
                    decimal num6        = 0M;
                    decimal num7        = 0M;
                    int     num8        = 0;
                    int     intOrderNum = 0;
                    foreach (ShoppingCartInfo info3 in orderSummitCart)
                    {
                        num8        += info3.GetPointNumber;
                        num5        += info3.Total;
                        num6        += info3.Exemption;
                        num7        += info3.ShipCost;
                        intOrderNum += info3.GetQuantity();
                    }
                    decimal num9 = num6;
                    decimal d    = num5 - num9;
                    if (d <= 0M)
                    {
                        d = 0M;
                    }
                    d = decimal.Round(d, 2);
                    if (this.objRadio[1].Checked == true)
                    {
                        this.litServiceMoney.Text = (intOrderNum * intPerServiceMoney).ToString("0.00");
                        d += decimal.Round(intOrderNum * intPerServiceMoney, 2);
                    }
                    else
                    {
                        this.litServiceMoney.Text = "0.00";
                    }
                    this.litOrderTotal.Text = d.ToString("F2");
                    if (num8 == 0)
                    {
                        this.litDisplayPointNumber.Text = "style=\"display:none;\"";
                    }
                    this.litPointNumber.Text = num8.ToString();
                    int          num11          = base.CurrentMemberInfo.Points - num8;
                    decimal      num12          = 0M;
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    if ((d * masterSettings.PointToCashRate) > base.CurrentMemberInfo.Points)
                    {
                        if (num11 > (masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate))
                        {
                            num12 = masterSettings.PonitToCash_MaxAmount;
                            num11 = ((int)masterSettings.PonitToCash_MaxAmount) * masterSettings.PointToCashRate;
                        }
                        else
                        {
                            num12 = num11 / masterSettings.PointToCashRate;
                        }
                    }
                    else
                    {
                        num12 = masterSettings.PonitToCash_MaxAmount;
                        if (num12 > d)
                        {
                            num12 = d;
                        }
                        num12 = decimal.Round(num12, 2);
                        num11 = (int)(num12 * masterSettings.PointToCashRate);
                    }
                    if (num11 <= 0)
                    {
                        num11 = 0;
                        num12 = 0M;
                    }
                    this.MembersPointMoney.Value = num12.ToString("F2");
                    if (num11 > 0)
                    {
                        this.litUseMembersPointShow.Text = string.Concat(new object[] { "<input type='hidden' id='hdCanUsePoint' value='", num11, "'/><input type='hidden' id='hdCanUsePointMoney' value='", num12.ToString("F2"), "'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span  id=\"usepointnum\">", num11, "</span>积分抵 <span class=\"colorr\">\x00a5<span  id=\"usepointmoney\">", num12.ToString("F2"), "</span></span>元</div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\"><input  type=\"checkbox\" /></div>" });
                    }
                    else
                    {
                        this.litUseMembersPointShow.Text = "<input type='hidden' id='hdCanUsePoint' value='0'/><input type='hidden' id='hdCanUsePointMoney' value='0'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span  id=\"usepointnum\">0</span>积分 <span  id=\"usepointmoney\" style=\"display:none\">" + num12.ToString("F2") + "</span></div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\" style=\"display:none\"><input type=\"checkbox\" disabled /></div>";
                    }
                    decimal availableAmount = 0M;
                    if (d > base.CurrentMemberInfo.AvailableAmount)
                    {
                        availableAmount = base.CurrentMemberInfo.AvailableAmount;
                        this.BalanceCanPayMoney.Value = base.CurrentMemberInfo.AvailableAmount.ToString("F2");
                    }
                    else
                    {
                        availableAmount = d;
                        this.BalanceCanPayMoney.Value = d.ToString("F2");
                    }
                    if ((base.CurrentMemberInfo.AvailableAmount > 0M) && masterSettings.EnableBalancePayment)
                    {
                        this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\">余额支付 <span class=\"colorr\">\x00a5<span id=\"spCanpayMoney\">" + availableAmount.ToString("F2") + "</span></span>(可用 \x00a5<span id=\"spAvailableAmount\">" + base.CurrentMemberInfo.AvailableAmount.ToString("F2") + "</span>)</div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\"><input type=\"checkbox\" " + ((availableAmount > 0M) ? "" : " disabled") + " /></div></div>";
                    }
                    else
                    {
                        this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\"" + (masterSettings.EnableBalancePayment ? "" : " style=\"display:none\"") + ">余额可用 <span class=\"colorr\">\x00a5<span id=\"spCanpayMoney\">0.00</span></span><span id=\"spAvailableAmount\" style=\"display:none\">0.00</span></div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\" style=\"display:none\"><input type=\"checkbox\" disabled /></div></div>";
                    }
                    if (!masterSettings.PonitToCash_Enable)
                    {
                        this.litDisplayPoint.Text = " style=\"display:none;\"";
                    }
                    PageTitle.AddSiteNameTitle("订单确认");
                }
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string text = context.Request["action"].ToNullString();

            if (string.IsNullOrEmpty(text) || text == "")
            {
                string text2 = string.Empty;
                string text3 = context.Request["ckids"];
                if (!string.IsNullOrEmpty(text3))
                {
                    text2 = text3;
                }
                string           a2 = context.Request["client"].ToNullString();
                ShoppingCartInfo shoppingCartInfo = (!(a2 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(text2, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(text2, false, false, -1);
                if (shoppingCartInfo != null)
                {
                    string[] source = text2.Split(',');
                    bool     flag   = false;
                    bool     flag2  = true;
                    bool     flag3  = true;
                    foreach (ShoppingCartItemInfo lineItem in shoppingCartInfo.LineItems)
                    {
                        if (source.Contains(lineItem.SkuId) || source.Contains(lineItem.SkuId + "|" + lineItem.StoreId))
                        {
                            int skuStock = ShoppingCartProcessor.GetSkuStock(lineItem.SkuId, lineItem.StoreId);
                            if (skuStock < lineItem.Quantity)
                            {
                                flag = true;
                                break;
                            }
                            if (HiContext.Current.SiteSettings.OpenMultStore && lineItem.StoreId > 0)
                            {
                                StoresInfo storeById = StoresHelper.GetStoreById(lineItem.StoreId);
                                if (storeById != null)
                                {
                                    if (!SettingsManager.GetMasterSettings().Store_IsOrderInClosingTime)
                                    {
                                        DateTime 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)
                                        {
                                            flag3 = false;
                                        }
                                    }
                                    if (!storeById.CloseStatus && storeById.CloseEndTime.HasValue && storeById.CloseBeginTime.HasValue && storeById.CloseEndTime.Value > DateTime.Now && storeById.CloseBeginTime.Value < DateTime.Now)
                                    {
                                        flag2 = false;
                                    }
                                }
                            }
                        }
                    }
                    if (flag)
                    {
                        context.Response.ContentType = "text/json";
                        context.Response.Write("{\"status\":\"false\",\"msg\":\"有商品库存不足,不能结算\"}");
                        context.Response.End();
                    }
                    if (!flag3)
                    {
                        context.Response.ContentType = "text/json";
                        context.Response.Write("{\"status\":\"StoreNotInTime\",\"msg\":\"非营业时间\"}");
                        context.Response.End();
                    }
                    if (!flag2)
                    {
                        context.Response.ContentType = "text/json";
                        context.Response.Write("{\"status\":\"StoreNotOpen\",\"msg\":\"歇业中\"}");
                        context.Response.End();
                    }
                    if (shoppingCartInfo != null)
                    {
                        ShoppingCartGiftInfo shoppingCartGiftInfo = (from a in shoppingCartInfo.LineGifts
                                                                     where a.PromoType == 5
                                                                     select a).FirstOrDefault();
                        shoppingCartInfo.SendGiftPromotionId = (shoppingCartGiftInfo?.GiftId ?? 0);
                        if (!shoppingCartInfo.IsSendGift && shoppingCartInfo.LineGifts.Count > 0)
                        {
                            foreach (ShoppingCartGiftInfo lineGift in shoppingCartInfo.LineGifts)
                            {
                                ShoppingCartProcessor.RemoveGiftItem(lineGift.GiftId, PromoteType.SentGift);
                            }
                        }
                    }
                    string s = JsonConvert.SerializeObject(shoppingCartInfo);
                    context.Response.ContentType = "text/json";
                    context.Response.Write(s);
                }
            }
            else if (text == "ClearCart")
            {
                string text4 = context.Request.Form["ck_productId"].ToNullString();
                if (string.IsNullOrEmpty(text4))
                {
                    context.Response.Write("{\"status\":\"false\",\"msg\":\"请选择要清除的商品\"}");
                }
                else
                {
                    string[] array = text4.Split(',');
                    foreach (string text5 in array)
                    {
                        string[] array2 = text5.Split('|');
                        if (array2.Length == 2)
                        {
                            ShoppingCartProcessor.RemoveLineItem(array2[0], array2[1].ToInt(0));
                        }
                        else
                        {
                            ShoppingCartProcessor.RemoveLineItem(text5, 0);
                        }
                    }
                    context.Response.Write("{\"status\":\"true\",\"msg\":\"清除成功\"}");
                }
                context.Response.End();
            }
            else if (text == "HasStore")
            {
                string       text6          = context.Request.Form["skuId"].ToNullString();
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                if (string.IsNullOrEmpty(text6) || !masterSettings.OpenMultStore)
                {
                    context.Response.Write("{\"status\":\"false\"}");
                }
                else if (ShoppingCartProcessor.HasStoreSkuStocks(text6))
                {
                    context.Response.Write("{\"status\":\"true\"}");
                }
                else
                {
                    context.Response.Write("{\"status\":\"false\"}");
                }
            }
            else if (text == "ProductsHasStore")
            {
                string       text7           = context.Request.Form["productIds"];
                SiteSettings masterSettings2 = SettingsManager.GetMasterSettings();
                if (string.IsNullOrEmpty(text7) || !masterSettings2.OpenMultStore)
                {
                    context.Response.Write("{\"status\":\"false\"}");
                }
                else
                {
                    string str3 = ShoppingCartProcessor.HasStoreByProducts(text7);
                    context.Response.Write("{\"status\":\"true\",\"productIds\":\"" + str3 + "\"}");
                }
            }
            else if (text == "updateBuyNum")
            {
                string               skuid                = context.Request.Form["SkuId"].ToNullString().Trim();
                int                  num                  = context.Request.Form["BuyNum"].ToNullString().Trim().ToInt(0);
                string               a3                   = context.Request.Form["client"].ToNullString().Trim();
                ShoppingCartInfo     shoppingCartInfo2    = (!(a3 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(null, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(null, false, false, -1);
                ShoppingCartItemInfo shoppingCartItemInfo = shoppingCartInfo2.LineItems.FirstOrDefault((ShoppingCartItemInfo a) => a.SkuId == skuid);
                int                  num2                 = shoppingCartItemInfo?.Quantity ?? 1;
                if (num <= 0)
                {
                    context.Response.Write("{\"status\":\"numError\",\"msg\":\"购买数量必须为大于0的整数\",\"oldNumb\":\"" + num2 + "\"}");
                }
                else if (ShoppingCartProcessor.GetSkuStock(skuid, 0) < num)
                {
                    context.Response.Write("{\"status\":\"StockError\",\"msg\":\"该商品库存不足\",\"oldNumb\":\"" + num2 + "\"}");
                }
                else
                {
                    ShoppingCartProcessor.UpdateLineItemQuantity(skuid, num, 0);
                    PromotionInfo productQuantityDiscountPromotion = ShoppingCartProcessor.GetProductQuantityDiscountPromotion(skuid, HiContext.Current.User.GradeId);
                    if (productQuantityDiscountPromotion != null && (decimal)num >= productQuantityDiscountPromotion.Condition)
                    {
                        shoppingCartItemInfo.AdjustedPrice = shoppingCartItemInfo.MemberPrice * productQuantityDiscountPromotion.DiscountValue;
                    }
                    else
                    {
                        shoppingCartItemInfo.AdjustedPrice = shoppingCartItemInfo.MemberPrice;
                    }
                    context.Response.Write("{\"status\":\"true\",\"adjustedPrice\":" + shoppingCartItemInfo.AdjustedPrice.F2ToString("f2") + "}");
                }
            }
            else if (text == "updateGiftBuyNum")
            {
                string               giftId                = context.Request.Form["giftId"].ToNullString().Trim();
                int                  num3                  = context.Request.Form["BuyNum"].ToNullString().Trim().ToInt(0);
                string               a4                    = context.Request.Form["client"].ToNullString().Trim();
                ShoppingCartInfo     shoppingCartInfo3     = (!(a4 == "wap")) ? ShoppingCartProcessor.GetShoppingCart(null, false, false, -1) : ShoppingCartProcessor.GetMobileShoppingCart(null, false, false, -1);
                ShoppingCartGiftInfo shoppingCartGiftInfo2 = shoppingCartInfo3.LineGifts.FirstOrDefault((ShoppingCartGiftInfo a) => a.GiftId == giftId.ToInt(0));
                if (shoppingCartGiftInfo2 == null)
                {
                    context.Response.Write("{\"status\":\"nullError\",\"msg\":\"该礼品不存在或已删除\",\"oldNumb\":\"" + 0 + "\"}");
                }
                else if (num3 <= 0)
                {
                    context.Response.Write("{\"status\":\"numError\",\"msg\":\"购买数量必须为大于0的整数\",\"oldNumb\":\"" + shoppingCartGiftInfo2.Quantity + "\"}");
                }
                else
                {
                    ShoppingCartProcessor.UpdateGiftItemQuantity(giftId.ToInt(0), num3, PromoteType.NotSet);
                    context.Response.Write("{\"status\":\"true\"}");
                }
            }
            else if (text == "deleteGift")
            {
                string text8 = context.Request.Form["giftId"].ToNullString().Trim();
                text8 = text8.TrimStart(',').TrimEnd(',');
                string[] array3 = text8.Split(',');
                foreach (string text9 in array3)
                {
                    ShoppingCartProcessor.RemoveGiftItem(text8.ToInt(0), PromoteType.NotSet);
                }
                context.Response.Write("{\"status\":\"true\"}");
            }
            else if (text == "deletestore")
            {
                string skuId   = context.Request.Form["SkuId"].ToNullString().Trim();
                int    storeId = context.Request.Form["StoreId"].ToInt(0);
                ShoppingCartProcessor.RemoveLineItem(skuId, storeId);
                context.Response.Write("{\"status\":\"true\"}");
            }
            else if (text == "delete")
            {
                string skuId2 = context.Request.Form["SkuId"].ToNullString().Trim();
                ShoppingCartProcessor.RemoveLineItem(skuId2, 0);
                context.Response.Write("{\"status\":\"true\"}");
            }
            else if (text == "deleteall")
            {
                string text10 = context.Request.Form["SkuIdList"].ToNullString().Trim();
                if (!string.IsNullOrEmpty(text10.ToNullString().Trim()))
                {
                    text10 = text10.TrimStart(',').TrimEnd(',');
                    string[] array4 = text10.Split(',');
                    foreach (string skuId3 in array4)
                    {
                        ShoppingCartProcessor.RemoveLineItem(skuId3, 0);
                    }
                }
                context.Response.Write("{\"status\":\"true\"}");
            }
            else if (text == "reducedpromotion")
            {
                decimal       amount           = context.Request.Form["Amount"].ToDecimal(0);
                int           quantity         = context.Request.Form["Quantity"].ToInt(0);
                MemberInfo    user             = HiContext.Current.User;
                decimal       num4             = default(decimal);
                PromotionInfo reducedPromotion = new PromotionDao().GetReducedPromotion(user.GradeId, amount, quantity, out num4, 0);
                if (reducedPromotion != null)
                {
                    context.Response.Write("{\"ReducedPromotionAmount\":\"" + num4 + "\",\"ReducedPromotionCondition\":\"" + reducedPromotion.Condition + "\"}");
                }
                else
                {
                    context.Response.Write("{\"ReducedPromotionAmount\":\"0\",\"ReducedPromotionCondition\":\"0\"}");
                }
            }
        }
Esempio n. 8
0
        protected override void AttachChildControls()
        {
            this.litShipTo       = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litIsUseBalance = (System.Web.UI.WebControls.Literal) this.FindControl("litIsUseBalance");
            this.litCellPhone    = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress      = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.litShowMes      = (System.Web.UI.WebControls.Literal) this.FindControl("litShowMes");
            this.GetUserCoupons  = MemberProcessor.GetUserCoupons();
            this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartProducts.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.litOrderTotal          = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
            this.litPointNumber         = (System.Web.UI.WebControls.Literal) this.FindControl("litPointNumber");
            this.litUseMembersPointShow = (System.Web.UI.WebControls.Literal) this.FindControl("litUseMembersPointShow");
            this.litDisplayPointNumber  = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPointNumber");
            this.litDisplayPoint        = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPoint");
            this.BalanceCanPayMoney     = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("BalanceCanPayMoney");
            this.groupbuyHiddenBox      = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox");
            this.rptAddress             = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            this.selectShipTo           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            this.MembersPointMoney      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("MembersPointMoney");
            this.regionId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId");
            this.litAddAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddAddress");

            if (Globals.GetCurrentDistributorId() == CurrentMemberInfo.UserId)
            {
                base.GotoResourceNotFound("站点管理员无法在自己店内购买!");
                return;
            }
            if (Globals.GetCurrentDistributorId() == 0)//CurrentMemberInfo.ReferralUserId ==0  &&
            {
                base.GotoResourceNotFound("请先扫码关注站点后再下单!");
                return;
            }


            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

            this.rptAddress.DataBind();
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["startDate"]))
            {
                this.SendStartDate = DateTime.Parse(this.Page.Request.QueryString["startDate"]);
            }
            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["quantityPerDay"]))
            {
                this.QuantityPerDay = Convert.ToInt32(this.Page.Request.QueryString["quantityPerDay"]);
            }
            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sendDays"]))
            {
                this.SendDays = Convert.ToInt32(this.Page.Request.QueryString["sendDays"]);
            }


            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text    = shippingAddressInfo.ShipTo;
                this.litCellPhone.Text = shippingAddressInfo.CellPhone;
                this.litAddress.Text   = shippingAddressInfo.Address;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString());
            }
            this.litAddAddress.Text = "<li><a href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()) + "'>新增收货地址</a></li>";
            if (shippingAddresses == null || shippingAddresses.Count == 0)
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()));
            }
            else
            {
                System.Collections.Generic.List <ShoppingCartInfo> list = new System.Collections.Generic.List <ShoppingCartInfo>();
                if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy"))
                {
                    this.productSku = this.Page.Request.QueryString["productSku"];
                    if (this.isbargain)
                    {
                        int bargainDetialId = Globals.RequestQueryNum("bargainDetialId");
                        list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0);
                    }
                    else
                    {
                        int num  = this.buyAmount;
                        int num2 = Globals.RequestQueryNum("limitedTimeDiscountId");
                        if (num2 > 0)
                        {
                            bool flag = true;
                            LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(num2);
                            if (discountInfo == null)
                            {
                                flag = false;
                            }
                            if (flag)
                            {
                                if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, this.CurrentMemberInfo.UserId))
                                {
                                    if (discountInfo.LimitNumber != 0)
                                    {
                                        int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(num2, this.productSku, 0, this.CurrentMemberInfo.UserId, false);
                                        if (this.buyAmount > discountInfo.LimitNumber - limitedTimeDiscountUsedNum)
                                        {
                                            num = discountInfo.LimitNumber - limitedTimeDiscountUsedNum;
                                        }
                                    }
                                }
                                else
                                {
                                    num2 = 0;
                                }
                            }
                            else
                            {
                                num2 = 0;
                            }
                        }
                        if (num2 > 0)
                        {
                            ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, num2);
                        }
                        if (num == 0 && num2 > 0)
                        {
                            num  = this.buyAmount;
                            num2 = 0;
                        }
                        list = ShoppingCartProcessor.GetListShoppingCart(SendStartDate, QuantityPerDay, SendDays, this.productSku, num, 0, num2);
                    }
                }
                else
                {
                    list = ShoppingCartProcessor.GetOrderSummitCart();
                }
                if (list == null)
                {
                    System.Web.HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>");
                }
                else
                {
                    if (list.Count > 1)
                    {
                        this.litShowMes.Text = "<div style=\"color: #F60; \"><img  src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>";
                    }
                    this.rptCartProducts.DataSource = list;
                    this.rptCartProducts.DataBind();
                    decimal d    = 0m;
                    decimal num3 = 0m;
                    decimal d2   = 0m;
                    int     num4 = 0;
                    foreach (ShoppingCartInfo current in list)
                    {
                        num4 += current.GetPointNumber;
                        d    += current.Total;
                        num3 += current.Exemption;
                        d2   += current.ShipCost;
                    }
                    decimal d3   = num3;
                    decimal num5 = d - d3;
                    if (num5 <= 0m)
                    {
                        num5 = 0m;
                    }
                    num5 = decimal.Round(num5, 2);
                    this.litOrderTotal.Text = num5.ToString("F2");
                    if (num4 == 0)
                    {
                        this.litDisplayPointNumber.Text = "style=\"display:none;\"";
                    }
                    this.litPointNumber.Text = num4.ToString();
                    int          num6           = this.CurrentMemberInfo.Points - num4;
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    decimal      num7;
                    if (num5 * masterSettings.PointToCashRate > this.CurrentMemberInfo.Points)
                    {
                        if (num6 > masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate)
                        {
                            num7 = masterSettings.PonitToCash_MaxAmount;
                            num6 = (int)masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate;
                        }
                        else
                        {
                            num7 = num6 / masterSettings.PointToCashRate;
                        }
                    }
                    else
                    {
                        num7 = masterSettings.PonitToCash_MaxAmount;
                        if (num7 > num5)
                        {
                            num7 = num5;
                        }
                        num7 = decimal.Round(num7, 2);
                        num6 = (int)(num7 * masterSettings.PointToCashRate);
                    }
                    if (num6 <= 0)
                    {
                        num6 = 0;
                        num7 = 0m;
                    }
                    this.MembersPointMoney.Value = num7.ToString("F2");
                    if (num6 > 0)
                    {
                        this.litUseMembersPointShow.Text = string.Concat(new object[]
                        {
                            "<input type='hidden' id='hdCanUsePoint' value='",
                            num6,
                            "'/><input type='hidden' id='hdCanUsePointMoney' value='",
                            num7.ToString("F2"),
                            "'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span  id=\"usepointnum\">",
                            num6,
                            "</span>积分抵 <span class=\"colorr\">¥<span  id=\"usepointmoney\">",
                            num7.ToString("F2"),
                            "</span></span>元</div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\"><input  type=\"checkbox\" /></div>"
                        });
                    }
                    else
                    {
                        this.litUseMembersPointShow.Text = "<input type='hidden' id='hdCanUsePoint' value='0'/><input type='hidden' id='hdCanUsePointMoney' value='0'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span  id=\"usepointnum\">0</span>积分 <span  id=\"usepointmoney\" style=\"display:none\">" + num7.ToString("F2") + "</span></div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\" style=\"display:none\"><input type=\"checkbox\" disabled /></div>";
                    }
                    decimal d4;
                    if (num5 > this.CurrentMemberInfo.AvailableAmount)
                    {
                        d4 = this.CurrentMemberInfo.AvailableAmount;
                        this.BalanceCanPayMoney.Value = this.CurrentMemberInfo.AvailableAmount.ToString("F2");
                    }
                    else
                    {
                        d4 = num5;
                        this.BalanceCanPayMoney.Value = num5.ToString("F2");
                    }
                    if (this.CurrentMemberInfo.AvailableAmount > 0m && masterSettings.EnableBalancePayment)
                    {
                        this.litIsUseBalance.Text = string.Concat(new string[]
                        {
                            "<div class=\"prompt-text pull-left\">余额支付 <span class=\"colorr\">¥<span id=\"spCanpayMoney\">",
                            d4.ToString("F2"),
                            "</span></span>(可用 ¥<span id=\"spAvailableAmount\">",
                            this.CurrentMemberInfo.AvailableAmount.ToString("F2"),
                            "</span>)</div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\"><input type=\"checkbox\" ",
                            (d4 > 0m) ? "" : " disabled",
                            " /></div></div>"
                        });
                    }
                    else
                    {
                        this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\"" + (masterSettings.EnableBalancePayment ? "" : " style=\"display:none\"") + ">余额可用 <span class=\"colorr\">¥<span id=\"spCanpayMoney\">0.00</span></span><span id=\"spAvailableAmount\" style=\"display:none\">0.00</span></div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\" style=\"display:none\"><input type=\"checkbox\" disabled /></div></div>";
                    }
                    if (!masterSettings.PonitToCash_Enable)
                    {
                        this.litDisplayPoint.Text = " style=\"display:none;\"";
                    }
                    PageTitle.AddSiteNameTitle("订单确认");
                }
            }
        }
Esempio n. 9
0
        protected override void AttachChildControls()
        {
            this.litShipTo       = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo");
            this.litCellPhone    = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
            this.litAddress      = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress");
            this.litShowMes      = (System.Web.UI.WebControls.Literal) this.FindControl("litShowMes");
            this.GetUserCoupons  = MemberProcessor.GetUserCoupons();
            this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts");
            this.rptCartProducts.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound);
            this.litOrderTotal         = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
            this.litPointNumber        = (System.Web.UI.WebControls.Literal) this.FindControl("litPointNumber");
            this.litDisplayPointNumber = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPointNumber");
            this.aLinkToShipping       = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("aLinkToShipping");
            this.groupbuyHiddenBox     = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox");
            this.rptAddress            = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            this.selectShipTo          = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo");
            this.regionId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId");
            this.litAddAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddAddress");
            System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();
            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

            this.rptAddress.DataBind();
            ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault);

            if (shippingAddressInfo == null)
            {
                shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null);
            }
            if (shippingAddressInfo != null)
            {
                this.litShipTo.Text    = shippingAddressInfo.ShipTo;
                this.litCellPhone.Text = shippingAddressInfo.CellPhone;
                this.litAddress.Text   = shippingAddressInfo.Address;
                this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString());
                this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString());
            }
            this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()) + "'";
            if (shippingAddresses == null || shippingAddresses.Count == 0)
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()));
            }
            else
            {
                this.aLinkToShipping.HRef = Globals.ApplicationPath + "/Vshop/ShippingAddresses.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString());
                System.Collections.Generic.List <ShoppingCartInfo> list = new System.Collections.Generic.List <ShoppingCartInfo>();
                if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy"))
                {
                    this.productSku = this.Page.Request.QueryString["productSku"];
                    if (this.isbargain)
                    {
                        int bargainDetialId = Globals.RequestQueryNum("bargainDetialId");
                        list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0);
                    }
                    else
                    {
                        int num  = this.buyAmount;
                        int num2 = Globals.RequestQueryNum("limitedTimeDiscountId");
                        if (num2 > 0)
                        {
                            bool flag = true;
                            LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(num2);
                            if (discountInfo == null)
                            {
                                flag = false;
                            }
                            if (flag)
                            {
                                if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, this.CurrentMemberInfo.UserId))
                                {
                                    if (discountInfo.LimitNumber != 0)
                                    {
                                        int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(num2, this.productSku, 0, this.CurrentMemberInfo.UserId, false);
                                        if (this.buyAmount > discountInfo.LimitNumber - limitedTimeDiscountUsedNum)
                                        {
                                            num = discountInfo.LimitNumber - limitedTimeDiscountUsedNum;
                                        }
                                    }
                                }
                                else
                                {
                                    num2 = 0;
                                }
                            }
                            else
                            {
                                num2 = 0;
                            }
                        }
                        if (num2 > 0)
                        {
                            ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, num2);
                        }
                        if (num == 0 && num2 > 0)
                        {
                            num  = this.buyAmount;
                            num2 = 0;
                        }
                        list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, num, 0, num2);
                    }
                }
                else
                {
                    list = ShoppingCartProcessor.GetOrderSummitCart();
                }
                if (list == null)
                {
                    System.Web.HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>");
                }
                else
                {
                    if (list.Count > 1)
                    {
                        this.litShowMes.Text = "<div style=\"color: #F60; \"><img  src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>";
                    }
                    this.rptCartProducts.DataSource = list;
                    this.rptCartProducts.DataBind();
                    decimal d    = 0m;
                    decimal num3 = 0m;
                    decimal d2   = 0m;
                    int     num4 = 0;
                    foreach (ShoppingCartInfo current in list)
                    {
                        num4 += current.GetPointNumber;
                        d    += current.Total;
                        num3 += current.Exemption;
                        d2   += current.ShipCost;
                    }
                    decimal d3 = num3;
                    this.litOrderTotal.Text = (d - d3).ToString("F2");
                    if (num4 == 0)
                    {
                        this.litDisplayPointNumber.Text = "style=\"display:none;\"";
                    }
                    this.litPointNumber.Text = num4.ToString();
                    PageTitle.AddSiteNameTitle("订单确认");
                }
            }
        }