private void SaveDiscountProduct(HttpContext context)
 {
     Globals.RequestFormNum("id");
     foreach (string str2 in Globals.RequestFormStr("discountProductList").Trim(new char[] { ',' }).Split(new char[] { ',' }))
     {
         string[] strArray2 = str2.Split(new char[] { '^' });
         LimitedTimeDiscountProductInfo info = new LimitedTimeDiscountProductInfo();
         if (((!string.IsNullOrEmpty(strArray2[0]) && !string.IsNullOrEmpty(strArray2[1])) && !string.IsNullOrEmpty(strArray2[4])) && (!string.IsNullOrEmpty(strArray2[2]) || !string.IsNullOrEmpty(strArray2[3])))
         {
             int id = Globals.ToNum(strArray2[0]);
             LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(id);
             info.LimitedTimeDiscountId = id;
             info.ProductId             = Globals.ToNum(strArray2[1]);
             info.Discount   = (string.IsNullOrEmpty(strArray2[2]) || (strArray2[2] == "undefined")) ? 0M : decimal.Parse(strArray2[2]);
             info.Minus      = (string.IsNullOrEmpty(strArray2[3]) || (strArray2[2] == "undefined")) ? 0M : decimal.Parse(strArray2[3]);
             info.FinalPrice = decimal.Parse(strArray2[4]);
             if (discountInfo != null)
             {
                 info.BeginTime = discountInfo.BeginTime;
                 info.EndTime   = discountInfo.EndTime;
             }
             info.CreateTime = DateTime.Now;
             info.Status     = 1;
             LimitedTimeDiscountHelper.AddLimitedTimeDiscountProduct(info);
         }
     }
     context.Response.Write("{\"msg\":\"success\"}");
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.id = Globals.RequestQueryNum("id");
         if (this.id > 0)
         {
             LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id);
             if (discountInfo != null)
             {
                 this.IsCommision.Checked  = discountInfo.IsCommission;
                 this.discount.Text        = (((double)discountInfo.CommissionDiscount) / 10.0).ToString();
                 this.txtActivityName.Text = discountInfo.ActivityName;
                 this.dateBeginTime.Text   = discountInfo.BeginTime.ToString();
                 this.dateEndTime.Text     = discountInfo.EndTime.ToString();
                 this.txtDescription.Text  = discountInfo.Description;
                 this.txtLimitNumber.Text  = discountInfo.LimitNumber.ToString();
                 HiddenField field  = this.memberRange.FindControl("txt_Grades") as HiddenField;
                 HiddenField field2 = this.memberRange.FindControl("txt_DefualtGroup") as HiddenField;
                 HiddenField field3 = this.memberRange.FindControl("txt_CustomGroup") as HiddenField;
                 this.memberRange.Grade        = discountInfo.ApplyMembers;
                 this.memberRange.CustomGroup  = discountInfo.CustomGroup;
                 this.memberRange.DefualtGroup = discountInfo.DefualtGroup;
                 field.Value  = discountInfo.ApplyMembers;
                 field2.Value = discountInfo.DefualtGroup;
                 field3.Value = discountInfo.CustomGroup;
             }
         }
     }
 }
        private void DataBindDiscount()
        {
            this.id = Globals.RequestQueryNum("id");
            if (this.id > 0)
            {
                LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id);
                if (discountInfo != null)
                {
                    this.actionName = discountInfo.ActivityName;
                }
            }
            ProductQuery productQuery = new ProductQuery
            {
                Keywords    = this.txtProductName.Text,
                ProductCode = "",
                CategoryId  = this.dropCategories.SelectedValue,
                PageSize    = this.pager.PageSize,
                PageIndex   = this.pager.PageIndex,
                SortOrder   = SortAction.Desc,
                SortBy      = "DisplaySequence"
            };

            if (this.dropCategories.SelectedValue.HasValue && this.dropCategories.SelectedValue > 0)
            {
                productQuery.MaiCategoryPath = CatalogHelper.GetCategory(this.dropCategories.SelectedValue.Value).Path;
            }
            DbQueryResult discountProduct = LimitedTimeDiscountHelper.GetDiscountProduct(productQuery);

            this.grdProducts.DataSource = discountProduct.Data;
            this.grdProducts.DataBind();
            this.pager.TotalRecords = discountProduct.TotalRecords;
        }
Example #4
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.id = Globals.RequestQueryNum("id");
         if (this.id > 0)
         {
             LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id);
             if (discountInfo != null)
             {
                 this.txtActivityName.Text = discountInfo.ActivityName;
                 this.dateBeginTime.Text   = discountInfo.BeginTime.ToString();
                 this.dateEndTime.Text     = discountInfo.EndTime.ToString();
                 this.txtDescription.Text  = discountInfo.Description;
                 this.txtLimitNumber.Text  = discountInfo.LimitNumber.ToString();
                 System.Web.UI.WebControls.HiddenField hiddenField  = this.memberRange.FindControl("txt_Grades") as System.Web.UI.WebControls.HiddenField;
                 System.Web.UI.WebControls.HiddenField hiddenField2 = this.memberRange.FindControl("txt_DefualtGroup") as System.Web.UI.WebControls.HiddenField;
                 System.Web.UI.WebControls.HiddenField hiddenField3 = this.memberRange.FindControl("txt_CustomGroup") as System.Web.UI.WebControls.HiddenField;
                 this.memberRange.Grade        = discountInfo.ApplyMembers;
                 this.memberRange.CustomGroup  = discountInfo.CustomGroup;
                 this.memberRange.DefualtGroup = discountInfo.DefualtGroup;
                 hiddenField.Value             = discountInfo.ApplyMembers;
                 hiddenField2.Value            = discountInfo.DefualtGroup;
                 hiddenField3.Value            = discountInfo.CustomGroup;
             }
         }
     }
 }
        private void IsDiscountProduct(System.Web.HttpContext context)
        {
            int num = Globals.RequestFormNum("productId");

            if (num > 0)
            {
                LimitedTimeDiscountProductInfo discountProductInfoByProductId = LimitedTimeDiscountHelper.GetDiscountProductInfoByProductId(num);
                if (discountProductInfoByProductId != null)
                {
                    LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(discountProductInfoByProductId.LimitedTimeDiscountId);
                    MemberInfo currentMember             = MemberProcessor.GetCurrentMember();
                    int        num2 = 0;
                    int        num3 = discountInfo.LimitNumber;
                    if (discountInfo != null)
                    {
                        if (currentMember != null)
                        {
                            if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, currentMember.UserId))
                            {
                                int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(discountProductInfoByProductId.LimitedTimeDiscountId, null, num, currentMember.UserId, false);
                                if (discountInfo.LimitNumber == 0)
                                {
                                    num2 = discountInfo.LimitedTimeDiscountId;
                                }
                                else if (discountInfo.LimitNumber - limitedTimeDiscountUsedNum > 0)
                                {
                                    num2 = discountInfo.LimitedTimeDiscountId;
                                    num3 = discountInfo.LimitNumber - limitedTimeDiscountUsedNum;
                                }
                                else
                                {
                                    num3 = 0;
                                }
                            }
                        }
                        else
                        {
                            num2 = discountInfo.LimitedTimeDiscountId;
                        }
                    }
                    if (discountInfo != null)
                    {
                        context.Response.Write(string.Concat(new object[]
                        {
                            "{\"msg\":\"success\",\"ActivityName\":\"",
                            Globals.String2Json(discountInfo.ActivityName),
                            "\",\"FinalPrice\":\"",
                            discountProductInfoByProductId.FinalPrice.ToString("f2"),
                            "\",\"LimitedTimeDiscountId\":\"",
                            num2,
                            "\",\"LimitNumber\":\"",
                            discountInfo.LimitNumber,
                            "\",\"RemainNumber\":\"",
                            num3,
                            "\"}"
                        }));
                    }
                }
            }
        }
Example #6
0
        private void DataBindDiscount()
        {
            string str = Globals.RequestQueryStr("key").Trim();

            if (!string.IsNullOrEmpty(str))
            {
                this.txtProductName.Text = str;
            }
            int num = Globals.RequestQueryNum("cid");

            this.id = Globals.RequestQueryNum("id");
            if (this.id > 0)
            {
                LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id);
                if (discountInfo != null)
                {
                    this.actionName = discountInfo.ActivityName;
                }
                int?nullable = null;
                if (num > 0)
                {
                    nullable = new int?(num);
                    this.dropCategories.SelectedValue = new int?(num);
                }
                ProductQuery query = new ProductQuery
                {
                    Keywords    = str,
                    ProductCode = "",
                    CategoryId  = nullable,
                    PageSize    = this.pager.PageSize,
                    PageIndex   = this.pager.PageIndex,
                    SortOrder   = SortAction.Desc,
                    SortBy      = "DisplaySequence"
                };
                if (num > 0)
                {
                    query.MaiCategoryPath = CatalogHelper.GetCategory(num).Path;
                }
                DbQueryResult discountProduct = LimitedTimeDiscountHelper.GetDiscountProduct(query);
                this.grdProducts.DataSource = discountProduct.Data;
                this.grdProducts.DataBind();
                this.pager.TotalRecords = discountProduct.TotalRecords;
            }
            else
            {
                base.Response.Redirect("LimitedTimeDiscountList.aspx");
            }
        }
        private void DataBindDiscount()
        {
            string text = Globals.RequestQueryStr("key").Trim();

            if (!string.IsNullOrEmpty(text))
            {
                this.txtProductName.Text = text;
            }
            int num = Globals.RequestQueryNum("cid");

            this.id = Globals.RequestQueryNum("id");
            int?categoryId = null;

            if (num > 0)
            {
                categoryId = new int?(num);
                this.dropCategories.SelectedValue = new int?(num);
            }
            if (this.id > 0)
            {
                LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id);
                if (discountInfo != null)
                {
                    this.actionName = discountInfo.ActivityName;
                }
                ProductQuery productQuery = new ProductQuery
                {
                    Keywords    = text,
                    ProductCode = "",
                    CategoryId  = categoryId,
                    PageSize    = this.pager.PageSize,
                    PageIndex   = this.pager.PageIndex,
                    SortOrder   = SortAction.Desc
                };
                if (num > 0)
                {
                    productQuery.MaiCategoryPath = CatalogHelper.GetCategory(num).Path;
                }
                DbQueryResult discountProducted = LimitedTimeDiscountHelper.GetDiscountProducted(productQuery, this.id);
                this.grdProducts.DataSource = discountProducted.Data;
                this.grdProducts.DataBind();
                this.pager.TotalRecords = discountProducted.TotalRecords;
                return;
            }
            base.Response.Redirect("LimitedTimeDiscountList.aspx");
        }
        private void SaveDiscountProduct(System.Web.HttpContext context)
        {
            Globals.RequestFormNum("id");
            string text = Globals.RequestFormStr("discountProductList").Trim(new char[]
            {
                ','
            });

            string[] array = text.Split(new char[]
            {
                ','
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string   text2  = array2[i];
                string[] array3 = text2.Split(new char[]
                {
                    '^'
                });
                LimitedTimeDiscountProductInfo limitedTimeDiscountProductInfo = new LimitedTimeDiscountProductInfo();
                if (!string.IsNullOrEmpty(array3[0]) && !string.IsNullOrEmpty(array3[1]) && !string.IsNullOrEmpty(array3[4]) && (!string.IsNullOrEmpty(array3[2]) || !string.IsNullOrEmpty(array3[3])))
                {
                    int num = Globals.ToNum(array3[0]);
                    LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(num);
                    limitedTimeDiscountProductInfo.LimitedTimeDiscountId = num;
                    limitedTimeDiscountProductInfo.ProductId             = Globals.ToNum(array3[1]);
                    limitedTimeDiscountProductInfo.Discount   = ((string.IsNullOrEmpty(array3[2]) || array3[2] == "undefined") ? 0m : decimal.Parse(array3[2]));
                    limitedTimeDiscountProductInfo.Minus      = ((string.IsNullOrEmpty(array3[3]) || array3[2] == "undefined") ? 0m : decimal.Parse(array3[3]));
                    limitedTimeDiscountProductInfo.FinalPrice = decimal.Parse(array3[4]);
                    if (discountInfo != null)
                    {
                        limitedTimeDiscountProductInfo.BeginTime = discountInfo.BeginTime;
                        limitedTimeDiscountProductInfo.EndTime   = discountInfo.EndTime;
                    }
                    limitedTimeDiscountProductInfo.CreateTime = System.DateTime.Now;
                    limitedTimeDiscountProductInfo.Status     = 1;
                    LimitedTimeDiscountHelper.AddLimitedTimeDiscountProduct(limitedTimeDiscountProductInfo);
                }
            }
            context.Response.Write("{\"msg\":\"success\"}");
        }
        private void UpdateDiscountProductList(System.Web.HttpContext context)
        {
            int    id   = Globals.RequestFormNum("LimitedTimeDiscountId");
            string text = Globals.RequestFormStr("discountProductList").Trim(new char[]
            {
                ','
            });

            string[] array = text.Split(new char[]
            {
                ','
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string   text2  = array2[i];
                string[] array3 = text2.Split(new char[]
                {
                    '^'
                });
                for (int j = 0; j < array3.Length; j++)
                {
                    if (!string.IsNullOrEmpty(array3[0]) && !string.IsNullOrEmpty(array3[1]) && !string.IsNullOrEmpty(array3[4]) && (!string.IsNullOrEmpty(array3[2]) || !string.IsNullOrEmpty(array3[3])))
                    {
                        LimitedTimeDiscountProductInfo limitedTimeDiscountProductInfo = new LimitedTimeDiscountProductInfo();
                        int limitedTimeDiscountProductId = Globals.ToNum(array3[0]);
                        LimitedTimeDiscountHelper.GetDiscountInfo(id);
                        limitedTimeDiscountProductInfo.LimitedTimeDiscountProductId = limitedTimeDiscountProductId;
                        limitedTimeDiscountProductInfo.Discount   = ((string.IsNullOrEmpty(array3[2]) || array3[2] == "undefined") ? 0m : decimal.Parse(array3[2]));
                        limitedTimeDiscountProductInfo.Minus      = ((string.IsNullOrEmpty(array3[3]) || array3[2] == "undefined") ? 0m : decimal.Parse(array3[3]));
                        limitedTimeDiscountProductInfo.FinalPrice = decimal.Parse(array3[4]);
                        LimitedTimeDiscountHelper.UpdateLimitedTimeDiscountProductById(limitedTimeDiscountProductInfo);
                    }
                }
            }
            context.Response.Write("{\"msg\":\"success\"}");
        }
Example #10
0
        private void IsDiscountProduct(HttpContext context)
        {
            int productId = Globals.RequestFormNum("productId");

            if (productId > 0)
            {
                LimitedTimeDiscountProductInfo discountProductInfoByProductId = LimitedTimeDiscountHelper.GetDiscountProductInfoByProductId(productId);
                if (discountProductInfoByProductId != null)
                {
                    LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(discountProductInfoByProductId.LimitedTimeDiscountId);
                    MemberInfo currentMember             = MemberProcessor.GetCurrentMember();
                    int        limitedTimeDiscountId     = 0;
                    if (discountInfo != null)
                    {
                        if (currentMember != null)
                        {
                            if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, currentMember.UserId))
                            {
                                int num3 = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(limitedTimeDiscountId, null, productId, currentMember.UserId, false);
                                if ((discountInfo.LimitNumber - num3) > 0)
                                {
                                    limitedTimeDiscountId = discountInfo.LimitedTimeDiscountId;
                                }
                            }
                        }
                        else
                        {
                            limitedTimeDiscountId = discountInfo.LimitedTimeDiscountId;
                        }
                    }
                    if (discountInfo != null)
                    {
                        context.Response.Write(string.Concat(new object[] { "{\"msg\":\"success\",\"ActivityName\":\"", discountInfo.ActivityName, "\",\"FinalPrice\":\"", discountProductInfoByProductId.FinalPrice.ToString("f2"), "\",\"LimitedTimeDiscountId\":\"", limitedTimeDiscountId, "\",\"LimitNumber\":\"", discountInfo.LimitNumber, "\"}" }));
                    }
                }
            }
        }
        private void UpdateDiscountProductList(HttpContext context)
        {
            int id = Globals.RequestFormNum("LimitedTimeDiscountId");

            foreach (string str2 in Globals.RequestFormStr("discountProductList").Trim(new char[] { ',' }).Split(new char[] { ',' }))
            {
                string[] strArray2 = str2.Split(new char[] { '^' });
                for (int i = 0; i < strArray2.Length; i++)
                {
                    if (((!string.IsNullOrEmpty(strArray2[0]) && !string.IsNullOrEmpty(strArray2[1])) && !string.IsNullOrEmpty(strArray2[4])) && (!string.IsNullOrEmpty(strArray2[2]) || !string.IsNullOrEmpty(strArray2[3])))
                    {
                        LimitedTimeDiscountProductInfo info = new LimitedTimeDiscountProductInfo();
                        int num3 = Globals.ToNum(strArray2[0]);
                        LimitedTimeDiscountHelper.GetDiscountInfo(id);
                        info.LimitedTimeDiscountProductId = num3;
                        info.Discount   = (string.IsNullOrEmpty(strArray2[2]) || (strArray2[2] == "undefined")) ? 0M : decimal.Parse(strArray2[2]);
                        info.Minus      = (string.IsNullOrEmpty(strArray2[3]) || (strArray2[2] == "undefined")) ? 0M : decimal.Parse(strArray2[3]);
                        info.FinalPrice = decimal.Parse(strArray2[4]);
                        LimitedTimeDiscountHelper.UpdateLimitedTimeDiscountProductById(info);
                    }
                }
            }
            context.Response.Write("{\"msg\":\"success\"}");
        }
Example #12
0
        protected override void AttachChildControls()
        {
            this.litShipTo       = (Literal)this.FindControl("litShipTo");
            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.litDisplayPointNumber = (Literal)this.FindControl("litDisplayPointNumber");
            this.aLinkToShipping       = (HtmlAnchor)this.FindControl("aLinkToShipping");
            this.groupbuyHiddenBox     = (HtmlInputControl)this.FindControl("groupbuyHiddenBox");
            this.rptAddress            = (VshopTemplatedRepeater)this.FindControl("rptAddress");
            this.selectShipTo          = (HtmlInputHidden)this.FindControl("selectShipTo");
            this.regionId      = (HtmlInputHidden)this.FindControl("regionId");
            this.litAddAddress = (Literal)this.FindControl("litAddAddress");
            IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses();

            //if (CS$<>9__CachedAnonymousMethodDelegate2 == null)
            //{
            //    CS$<>9__CachedAnonymousMethodDelegate2 = new Func<ShippingAddressInfo, bool>(null, (IntPtr) <AttachChildControls>b__0);
            //}
            //this.rptAddress.DataSource = Enumerable.OrderBy<ShippingAddressInfo, bool>(shippingAddresses, CS$<>9__CachedAnonymousMethodDelegate2);
            //this.rptAddress.DataBind();
            //if (CS$<>9__CachedAnonymousMethodDelegate3 == null)
            //{
            //    CS$<>9__CachedAnonymousMethodDelegate3 = new Func<ShippingAddressInfo, bool>(null, (IntPtr) <AttachChildControls>b__1);
            //}
            this.rptAddress.DataSource = from item in shippingAddresses
                                         orderby item.IsDefault
                                         select item;

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

            //ShippingAddressInfo info = Enumerable.FirstOrDefault<ShippingAddressInfo>(shippingAddresses, CS$<>9__CachedAnonymousMethodDelegate3);
            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 = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "'";
            if ((shippingAddresses == null) || (shippingAddresses.Count == 0))
            {
                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()));
            }
            else
            {
                this.aLinkToShipping.HRef = Globals.ApplicationPath + "/Vshop/ShippingAddresses.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString());
                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)
                            {
                                int num4 = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(id, this.productSku, 0, base.CurrentMemberInfo.UserId, false);
                                if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, base.CurrentMemberInfo.UserId))
                                {
                                    if ((discountInfo.LimitNumber > 0) && (this.buyAmount <= (discountInfo.LimitNumber - num4)))
                                    {
                                        buyAmount = discountInfo.LimitNumber - num4;
                                        if (buyAmount > this.buyAmount)
                                        {
                                            buyAmount = this.buyAmount;
                                        }
                                    }
                                    else if (discountInfo.LimitNumber != 0)
                                    {
                                        id = 0;
                                    }
                                }
                                else
                                {
                                    id = 0;
                                }
                            }
                            else
                            {
                                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;
                    foreach (ShoppingCartInfo info3 in orderSummitCart)
                    {
                        num8 += info3.GetPointNumber;
                        num5 += info3.Total;
                        num6 += info3.Exemption;
                        num7 += info3.ShipCost;
                    }
                    decimal num9 = num6;
                    this.litOrderTotal.Text = (num5 - num9).ToString("F2");
                    if (num8 == 0)
                    {
                        this.litDisplayPointNumber.Text = "style=\"display:none;\"";
                    }
                    this.litPointNumber.Text = num8.ToString();
                    PageTitle.AddSiteNameTitle("订单确认");
                }
            }
        }
        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("订单确认");
                }
            }
        }
Example #14
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("订单确认");
                }
            }
        }
Example #15
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("订单确认");
                }
            }
        }