Exemplo n.º 1
0
        public static List <UserGradeInfo> JoinUserGrade(int productID)
        {
            List <MemberPriceInfo> list  = MemberPriceBLL.ReadMemberPriceByProduct(productID);
            List <UserGradeInfo>   list2 = ReadUserGradeCacheList();
            List <UserGradeInfo>   list3 = new List <UserGradeInfo>();

            foreach (UserGradeInfo info in list2)
            {
                bool flag = false;
                foreach (MemberPriceInfo info2 in list)
                {
                    if (info.ID == info2.GradeID)
                    {
                        UserGradeInfo item = new UserGradeInfo();
                        item             = (UserGradeInfo)ServerHelper.CopyClass(info);
                        item.MemberPrice = info2;
                        flag             = true;
                        list3.Add(item);
                        break;
                    }
                }
                if (!flag)
                {
                    info.MemberPrice.Price = -1M;
                    list3.Add(info);
                }
            }
            return(list3);
        }
Exemplo n.º 2
0
        public static void StaticsCart(int userID, int gradeID)
        {
            List <CartGiftPackVirtualInfo>      cartGiftPackVirtualList      = new List <CartGiftPackVirtualInfo>();
            List <CartCommonProductVirtualInfo> cartCommonProductVirtualList = new List <CartCommonProductVirtualInfo>();
            List <ProductInfo> productList  = new List <ProductInfo>();
            List <CartInfo>    cartList     = ReadCartList(userID);
            string             strProductID = string.Empty;

            foreach (CartInfo info in 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;
                }
                productList = ProductBLL.SearchProductList(productSearch);
            }
            List <MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, gradeID);

            foreach (CartInfo info in cartList)
            {
                ProductInfo product = ProductBLL.ReadProductByProductList(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, gradeID, product);
            }
            HandlerCartList(cartList, ref cartGiftPackVirtualList, ref cartCommonProductVirtualList);
            int     num  = 0;
            decimal num2 = 0M;
            decimal num3 = 0M;

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