Пример #1
0
        /// <summary>
        /// 通过产品详细信息加入购物车
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="product"></param>
        /// <param name="num"></param>
        /// <param name="styleId"></param>
        public static bool Add(string userId, Product.IProduct product, int num, int styleId, string styleName, string spreadInfo)
        {
            DBExtend  helper = dbHelper;
            ICartItem c      = new ICartItem();

            c.Num              = num;
            c.ProductId        = product.Id;
            c.Price            = product.SoldPrice;
            c.ProductName      = product.ProductName;
            c.StyleId          = styleId;
            c.StyleName        = styleName;
            c.Integral         = product.Integral;
            c.SupplierId       = product.SupplierId;
            c.UserId           = userId;
            c.SpreadInfo       = spreadInfo;
            c.TagData          = product.TagData;
            c.IncludedFreePost = product.IncludedFreePost;
            double totalWeight = 0;

            totalWeight = product.Weight * num;
            if (product.ExemptFreightCount > 0 && product.ExemptFreightCount <= num)//如果达到多少个,则总重量为0
            {
                totalWeight = 0;
            }
            c.TotalWeight = totalWeight;
            Add(c);
            return(true);
        }
Пример #2
0
 public void AddBasket(IProduct product)
 {
     Products.Add(product);
 }