/// <summary> /// 添加商品至购物车 /// </summary> /// <param name="customerSysNo">客户系统编号</param> /// <param name="productSysNo">商品系统编号</param> /// <param name="quantity">商品数量</param> /// <param name="source">购物车商品来源</param> /// <returns></returns> /// <remarks>2013-08-13 吴文强 创建</remarks> public void Add(int customerSysNo, int productSysNo, int quantity, CustomerStatus.购物车商品来源 source) { var productPrices = PdPriceBo.Instance.GetProductPrice(productSysNo, new ProductStatus.产品价格来源[] { ProductStatus.产品价格来源.会员等级价 }); var customer = CrCustomerBo.Instance.GetModel(customerSysNo); var firstOrDefault = productPrices.FirstOrDefault(p => customer != null && p.SourceSysNo == customer.LevelSysNo); if (firstOrDefault != null) { var shoppingCartItem = new CrShoppingCartItem { IsChecked = (int)CustomerStatus.是否选中.是, CustomerSysNo = customerSysNo, ProductSysNo = productSysNo, ProductName = "", Quantity = quantity, OriginPrice = firstOrDefault.Price, IsLock = (int)CustomerStatus.购物车是否锁定.否, IsExpireReset = (int)CustomerStatus.购物车是否过期重置.是, CreateDate = DateTime.Now, Source = (int)source, ProductSalesType = (int)CustomerStatus.商品销售类型.普通, }; var list = new List <CrShoppingCartItem>(); list.Add(shoppingCartItem); ICrShoppingCartItemDao.Instance.Add(list); } }
/// <summary> /// 添加促销赠品至购物车 /// </summary> /// <param name="customerSysNo">客户系统编号</param> /// <param name="productSysNo">商品(赠品)系统编号</param> /// <param name="promotionSysNo">促销系统编号</param> /// <param name="source">购物车商品来源</param> /// <returns></returns> /// <remarks>2013-08-13 吴文强 创建</remarks> public void AddGift(int customerSysNo, int productSysNo, int promotionSysNo, CustomerStatus.购物车商品来源 source) { var shoppingCartItem = new CrShoppingCartItem { IsChecked = (int)CustomerStatus.是否选中.是, CustomerSysNo = customerSysNo, ProductSysNo = productSysNo, ProductName = "", Quantity = 1, OriginPrice = 0, IsLock = (int)CustomerStatus.购物车是否锁定.否, IsExpireReset = (int)CustomerStatus.购物车是否过期重置.是, CreateDate = DateTime.Now, Source = (int)source, ProductSalesType = (int)CustomerStatus.商品销售类型.赠品, Promotions = promotionSysNo.ToString(), UsedPromotions = promotionSysNo.ToString(), }; var list = new List <CrShoppingCartItem>(); list.Add(shoppingCartItem); ICrShoppingCartItemDao.Instance.Add(list); }