Exemple #1
0
        private void ReadCart()
        {
            this.cartList = CartBLL.ReadCartList(base.UserID);
            string strProductID = string.Empty;

            foreach (CartInfo info in this.cartList)
            {
                if (strProductID == string.Empty)
                {
                    strProductID = info.ProductID.ToString();
                }
                else
                {
                    strProductID = strProductID + "," + info.ProductID.ToString();
                }
            }
            if (strProductID != string.Empty)
            {
                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.InProductID = strProductID;
                this.productList          = ProductBLL.SearchProductList(productSearch);
            }
            List <MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID);

            foreach (CartInfo info in this.cartList)
            {
                ProductInfo product = ProductBLL.ReadProductByProductList(this.productList, info.ProductID);
                info.ProductWeight = product.Weight;
                info.SendPoint     = product.SendPoint;
                if (ShopConfig.ReadConfigInfo().ProductStorageType == 1)
                {
                    info.LeftStorageCount = product.TotalStorageCount - product.OrderCount;
                }
                else
                {
                    info.LeftStorageCount = product.ImportVirtualStorageCount;
                }
                info.ProductPrice = MemberPriceBLL.ReadCurrentMemberPrice(memberPriceList, base.GradeID, product);
            }
            CartBLL.HandlerCartList(this.cartList, ref this.cartGiftPackVirtualList, ref this.cartCommonProductVirtualList);
            int     num  = 0;
            decimal num2 = 0M;
            decimal num3 = 0M;

            foreach (CartGiftPackVirtualInfo info4 in this.cartGiftPackVirtualList)
            {
                num3 += info4.TotalProductWeight * info4.GiftPackBuyCount;
                num2 += info4.TotalPrice * info4.GiftPackBuyCount;
            }
            foreach (CartCommonProductVirtualInfo info5 in this.cartCommonProductVirtualList)
            {
                num3 += info5.FatherCart.ProductWeight * info5.FatherCart.BuyCount;
                num2 += info5.FatherCart.ProductPrice * info5.FatherCart.BuyCount;
            }
            foreach (CartInfo info in this.cartList)
            {
                if (info.FatherID == 0)
                {
                    num += info.BuyCount;
                }
            }
            Sessions.ProductBuyCount    = num;
            Sessions.ProductTotalPrice  = num2;
            Sessions.ProductTotalWeight = num3;
        }