Example #1
0
        private void ReadCart()
        {
            int     ProductBuyCount   = 0;
            decimal ProductTotalPrice = 0M;

            this.cartList = CartBLL.ReadCartList(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();
                }
            }
            //List<MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID);
            foreach (CartInfo info in this.cartList)
            {
                ProductInfo product = ProductBLL.ReadProduct(info.ProductID);
                info.ProductPrice  = product.MarketPrice;//MemberPriceBLL.ReadCurrentMemberPrice(memberPriceList, base.GradeID, TestCateModel);
                ProductBuyCount   += 1;
                ProductTotalPrice += info.ProductPrice;
            }
            RecordList.DataSource = cartList;
            RecordList.DataBind();
            Sessions.ProductBuyCount   = ProductBuyCount;
            Sessions.ProductTotalPrice = ProductTotalPrice;
        }
Example #2
0
 protected void AddOrderProduct(int orderID)
 {
     foreach (CartInfo info in CartBLL.ReadCartList(UserID))
     {
         OrderDetailInfo orderDetail = new OrderDetailInfo();
         orderDetail.OrderID     = orderID;
         orderDetail.ProductID   = info.ProductID;
         orderDetail.ProductName = info.ProductName;
         //orderDetail.ProductWeight = product.Weight;
         //orderDetail.SendPoint = product.SendPoint;
         orderDetail.ProductPrice = info.ProductPrice;
         orderDetail.BuyCount     = info.BuyCount;
         orderDetail.RandNumber   = info.RandNumber;
         OrderDetailBLL.AddOrderDetail(orderDetail);
     }
     CartBLL.ClearCart(UserID);
     Sessions.ProductTotalPrice  = 0M;
     Sessions.ProductBuyCount    = 0;
     Sessions.ProductTotalWeight = 0M;
 }
Example #3
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;
        }
Example #4
0
        protected void AddOrderProduct(int orderID)
        {
            List <CartInfo> list         = CartBLL.ReadCartList(base.UserID);
            string          strProductID = string.Empty;

            foreach (CartInfo info in list)
            {
                if (strProductID == string.Empty)
                {
                    strProductID = info.ProductID.ToString();
                }
                else
                {
                    strProductID = strProductID + "," + info.ProductID.ToString();
                }
            }
            List <ProductInfo> productList = new List <ProductInfo>();

            if (strProductID != string.Empty)
            {
                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.InProductID = strProductID;
                productList = ProductBLL.SearchProductList(productSearch);
            }
            List <MemberPriceInfo>    memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID);
            Dictionary <string, bool> dictionary      = new Dictionary <string, bool>();
            Dictionary <int, int>     dictionary2     = new Dictionary <int, int>();

            foreach (CartInfo info in list)
            {
                ProductInfo     product     = ProductBLL.ReadProductByProductList(productList, info.ProductID);
                OrderDetailInfo orderDetail = new OrderDetailInfo();
                orderDetail.OrderID       = orderID;
                orderDetail.ProductID     = info.ProductID;
                orderDetail.ProductName   = info.ProductName;
                orderDetail.ProductWeight = product.Weight;
                orderDetail.SendPoint     = product.SendPoint;
                if (info.GiftPackID == 0)
                {
                    orderDetail.ProductPrice = MemberPriceBLL.ReadCurrentMemberPrice(memberPriceList, base.GradeID, product);
                }
                else if (dictionary.ContainsKey(info.RandNumber + "|" + info.GiftPackID.ToString()))
                {
                    orderDetail.ProductPrice = 0M;
                }
                else
                {
                    orderDetail.ProductPrice = GiftPackBLL.ReadGiftPack(info.GiftPackID).Price;
                    dictionary.Add(info.RandNumber + "|" + info.GiftPackID.ToString(), true);
                }
                orderDetail.BuyCount = info.BuyCount;
                if (info.FatherID > 0)
                {
                    orderDetail.FatherID = dictionary2[info.FatherID];
                }
                orderDetail.RandNumber = info.RandNumber;
                orderDetail.GiftPackID = info.GiftPackID;
                int num = OrderDetailBLL.AddOrderDetail(orderDetail);
                dictionary2.Add(info.ID, num);
            }
            CartBLL.ClearCart(base.UserID);
            Sessions.ProductTotalPrice  = 0M;
            Sessions.ProductBuyCount    = 0;
            Sessions.ProductTotalWeight = 0M;
        }