Example #1
0
        /// <summary>
        /// 获取虚拟购物车物品
        /// </summary>
        /// <param name="sku"></param>
        /// <param name="exchangeRate"></param>
        /// <returns></returns>
        public CartViewModel GetBuyVirtualCart(string sku, int ping, int proid, decimal?exchangeRate = null)
        {
            var entity = CartBll.GetVirtualCartItemEntity(sku, base.language, base.DeliveryRegion);
            IList <PromotionEntity> promotions = null;

            if (entity != null)
            {
                if (ping == 1)
                {
                    promotions = itemBll.GetPromotionEntitiesTeam(proid);
                }
                else
                {
                    promotions = itemBll.GetPromotionEntities(new[] { sku });
                }
            }

            var itemArray = new ShoppingCartItemEntity[] { entity };

            var items = itemArray.AsProdcutItems(promotions, base.ExchangeRate);


            CartViewModel model = new CartViewModel(base.ExchangeRate)
            {
                Items = items
            };

            return(model);
        }