public ShoppingCartItemType ConvertItemType(string type)
        {
            var itemType = new ShoppingCartItemType();

            switch (type)
            {
            case "Order":
                itemType = ShoppingCartItemType.Order;
                break;

            case "AutoOrder":
                itemType = ShoppingCartItemType.AutoOrder;
                break;

            case "EnrollmentPack":
                itemType = ShoppingCartItemType.EnrollmentPack;
                break;

            case "EnrollmentAutoOrderPack":
                itemType = ShoppingCartItemType.EnrollmentAutoOrderPack;
                break;

            default:
                break;
            }
            return(itemType);
        }
        public void Remove(ShoppingCartItemType type)
        {
            var matchingItems = this.Where(item => item.Type.Equals(type)).ToList();

            foreach (var item in matchingItems)
            {
                base.Remove(item);
            }
        }
Ejemplo n.º 3
0
        public void Remove(ShoppingCartItemType type)
        {
            var matchingItems = this.Where(item => item.Type.Equals(type)).ToList();

            foreach (var item in matchingItems)
            {
                base.Remove(item);
            }

            DeleteOrphanDynamicKitMembers();
        }
        /// <summary>
        /// Short cut add which will handle adding one of a specific item type to the cart collection
        /// </summary>
        /// <param name="itemCode"></param>
        /// <param name="type"></param>
        public void Add(string itemCode, ShoppingCartItemType type)
        {
            var item = new ShoppingCartItem();

            item.ItemCode = itemCode;
            item.Type     = type;
            item.Quantity = 1;


            this.Add(item);
        }
        public void Remove(string itemcode, ShoppingCartItemType type = ShoppingCartItemType.Order)
        {
            var matchingItems = this.Where(item => item.ItemCode == itemcode && item.Type == type).ToList();

            foreach (var item in matchingItems)
            {
                base.Remove(item);
            }

            DeleteOrphanDynamicKitMembers();
        }
        public AutoshipCartItemViewModel(ItemResponse itemResponse, ShoppingCart cart, ShoppingCartItemType type)
        {
            this.ItemCode = itemResponse.ItemCode;
            this.Description = itemResponse.Description;
            this.PriceEach = itemResponse.Price;
            this.Type = type;
            this.BV = itemResponse.BusinessVolume;
            this.CV = itemResponse.CommissionableVolume;
            this.Image = GlobalSettings.Shopping.ProductImagePath + itemResponse.TinyPicture;

            this.ParentItemCode = cart.Items
                        .Where(i => i.ItemCode == itemResponse.ItemCode && i.Type == type)
                        .Select(i => i.ParentItemCode).FirstOrDefault();

            var quantity = cart.Items
                        .Where(i => i.ItemCode == itemResponse.ItemCode && i.Type == type)
                        .Select(i => i.Quantity).FirstOrDefault();

            this.Quantity = quantity;
            this.PriceTotal = itemResponse.Price *  quantity;

        }
 public ShoppingCartItemType ConvertItemType(string type)
 {
     var itemType = new ShoppingCartItemType();
     switch (type)
     {
         case "Order":
             itemType = ShoppingCartItemType.Order;
             break;
         case "AutoOrder":
             itemType = ShoppingCartItemType.AutoOrder;
             break;
         case "EnrollmentPack":
             itemType = ShoppingCartItemType.EnrollmentPack;
             break;
         case "EnrollmentAutoOrderPack":
             itemType = ShoppingCartItemType.EnrollmentAutoOrderPack;
             break;
         default:
             break;
     }
     return itemType;
 }
 public bool HasItemsOfType(ShoppingCartItemType type)
 {
     return(this.Any(i => i.Type == type));
 }
 public List <ShoppingCartItem> GetItemsOfType(ShoppingCartItemType type)
 {
     return(this.Where(i => i.Type == type).ToList());
 }