/// <summary>
 /// Create a new subscription item passing in the recurrentItem
 /// </summary>
 /// <param name="recurrentItem">The item for the subscription</param>
 /// <param name="period">The period attribute specifies how frequently 
 /// you will charge the customer for the subscription</param>
 /// <param name="type">
 /// The type attribute identifies the type of subscription that you are creating. 
 /// The valid values for this attribute are merchant and google, 
 /// and this specifies who handles the recurrences.
 /// </param>
 public Subscription(IShoppingCartItem recurrentItem, AutoGen.DatePeriod period,
     SubscriptionType type)
 {
     this.RecurrentItem = recurrentItem;
       this.Period = period;
       this.Type = type;
 }
示例#2
0
        public async Task <IShoppingCartItem> AddProductAsync(IProduct product, int quantity = 1)
        {
            IShoppingCartItem shoppingCartItem = null;

            shoppingCartItem = _items.Find(o => o.Product.ProductId == product.ProductId);

            if (shoppingCartItem != null)
            {
                // Increase existing quantity.
                shoppingCartItem.Quantity += quantity;
            }
            else
            {
                // Add a new shopping cart item.
                shoppingCartItem = new ShoppingCartItem
                {
                    Product  = product,
                    Quantity = quantity,
                };
                _items.Add(shoppingCartItem);
            }
            // TODO: Remove this demonstration wait.
            await Task.Delay(2000);

            return(shoppingCartItem);
        }
示例#3
0
 public PickedProduct(ICart cart, IShoppingCartItem shoppingCartItem, UserManager <ApplicationUser> userManager, CreaturesDbcontext context)
 {
     _context          = context;
     _cart             = cart;
     _userManager      = userManager;
     _shoppingCartItem = shoppingCartItem;
 }
 /// <summary>
 /// access to other tables
 /// </summary>
 /// <param name="product">prod table</param>
 /// <param name="cart">cart table</param>
 /// <param name="shoppingCartItem">shoppingcartitem table</param>
 /// <param name="userManager">identity table</param>
 public ProductController(Iproduct product, ICart cart, IShoppingCartItem shoppingCartItem, UserManager <ApplicationUser> userManager)
 {
     _cart             = cart;
     _product          = product;
     _shoppingCartItem = shoppingCartItem;
     _userManager      = userManager;
 }
示例#5
0
 /// <summary>
 /// Create a new subscription item passing in the recurrentItem
 /// </summary>
 /// <param name="recurrentItem">The item for the subscription</param>
 /// <param name="period">The period attribute specifies how frequently
 /// you will charge the customer for the subscription</param>
 /// <param name="type">
 /// The type attribute identifies the type of subscription that you are creating.
 /// The valid values for this attribute are merchant and google,
 /// and this specifies who handles the recurrences.
 /// </param>
 public Subscription(IShoppingCartItem recurrentItem, AutoGen.DatePeriod period,
                     SubscriptionType type)
 {
     this.RecurrentItem = recurrentItem;
     this.Period        = period;
     this.Type          = type;
 }
示例#6
0
        public void Add(IShoppingCartItem item)
        {
            var newItem = new ShoppingCartItem(item);

            // Don't process items with no quantities
            if (newItem.Quantity == 0)
            {
                return;
            }

            // Get a list of all items that have the same item code and type.
            var preExistingItems = this.FindAll(i =>
                                                i.ItemCode == newItem.ItemCode &&
                                                i.Type.Equals(newItem.Type) &&
                                                i.DynamicKitCategory == newItem.DynamicKitCategory &&
                                                i.ParentItemCode == newItem.ParentItemCode);

            // If we returned any existing items that match the item code and type, we need to add to those existing items.
            if (preExistingItems.Count() > 0)
            {
                // Loop through each item found.
                preExistingItems.ForEach(i =>
                {
                    // Add the new quantity to the existing item code.
                    // Note that the only thing we are adding to the existing item code is the new quantity.
                    i.Quantity = i.Quantity + newItem.Quantity;
                });
            }

            // If we didn't find any existing items matching the item code or type, let's add it to the ShoppingBasketItemsCollection
            else
            {
                base.Add(newItem);
            }
        }
示例#7
0
 public ShoppingCartController(UserManager <ApplicationUser> userManager, IProduct product, IShoppingCartItem shoppingCartItem, ShopDbContext shopcontext)
 {
     _userManager      = userManager;
     _product          = product;
     _shoppingCartItem = shoppingCartItem;
     _shopcontext      = shopcontext;
 }
    protected void RepeaterCartItems_OnItemDataBound(object source, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.AlternatingItem) ||
            (e.Item.ItemType == ListItemType.Item))
        {
            Image             productImage = (Image)e.Item.FindControl("ProductImage");
            IShoppingCartItem cartItem     = (IShoppingCartItem)e.Item.DataItem;
            if (productImage != null)
            {
                productImage.ImageUrl = cartItem.ImageUrl;
            }

            var currentCustomer = AspDotNetStorefrontCore.Customer.Current;

            Label CartItemPriceValue = e.Item.FindControl("CartItemPriceValue") as Label;
            CartItemPriceValue.Text = Localization.CurrencyStringForDisplayWithExchangeRate(cartItem.Price, currentCustomer.CurrencySetting);

            if (!String.IsNullOrEmpty(cartItem.Size))
            {
                if (cartItem.SizePrompt.Length > 0)
                {
                    Label LabelSizePrompt = (Label)e.Item.FindControl("ProductSizeLabel");
                    if (LabelSizePrompt != null)
                    {
                        LabelSizePrompt.Text = cartItem.SizePrompt + ":";
                    }
                }
                Panel panelSize = (Panel)e.Item.FindControl("PanelSize");
                panelSize.Visible = true;
            }

            if (!String.IsNullOrEmpty(cartItem.Color))
            {
                if (cartItem.ColorPrompt.Length > 0)
                {
                    Label LabelColorPrompt = (Label)e.Item.FindControl("ProductColorLabel");
                    if (LabelColorPrompt != null)
                    {
                        LabelColorPrompt.Text = cartItem.ColorPrompt + ":";
                    }
                }
                Panel panelColor = (Panel)e.Item.FindControl("PanelColor");
                panelColor.Visible = true;
            }

            if (cartItem.RestrictedQuantities.Count > 0)
            {
                DropDownList CartItemRestrictedQuantity = (DropDownList)e.Item.FindControl("CartItemRestrictedQuantity");
                CartItemRestrictedQuantity.DataSource = cartItem.RestrictedQuantities;
                CartItemRestrictedQuantity.DataBind();
                CartItemRestrictedQuantity.Visible = true;

                TextBox CartItemQuantityValue = (TextBox)e.Item.FindControl("CartItemQuantityValue");
                CartItemQuantityValue.Visible = false;

                CartItemRestrictedQuantity.SelectedValue = cartItem.Quantity.ToString();
            }
        }
    }
 /// <summary>
 /// injects other tables
 /// </summary>
 /// <param name="cart">cart table</param>
 /// <param name="shoppingCartItem">shopping cart item table</param>
 /// <param name="order">order table</param>
 /// <param name="userManager">identityd table</param>
 /// <param name="ordereditems">ordered items table</param>
 /// <param name="emailSender">email table</param>
 public CheckoutController(ICart cart, IShoppingCartItem shoppingCartItem, IOrder order, UserManager <ApplicationUser> userManager, IOrderedItems ordereditems, IEmailSender emailSender)
 {
     _ordereditems     = ordereditems;
     _cart             = cart;
     _order            = order;
     _shoppingCartItem = shoppingCartItem;
     _userManager      = userManager;
     _emailSender      = emailSender;
 }
 public ShoppingCartItem(IShoppingCartItem item)
 {
     ID                  = (item.ID != Guid.Empty) ? item.ID : Guid.NewGuid();
     ItemCode            = GlobalUtilities.Coalesce(item.ItemCode);
     Quantity            = item.Quantity;
     GroupMasterItemCode = GlobalUtilities.Coalesce(item.GroupMasterItemCode);
     Type                = item.Type;
     Children            = item.Children;
 }
示例#11
0
 public ShoppingCart(IShoppingCartItem shoppingCartItem, ILogger logger)
 {
     if (shoppingCartItem == null || logger == null)
     {
         throw new ArgumentNullException();
     }
     this._shoppingCartItem = shoppingCartItem;
     this._logger           = logger;
 }
 public ShoppingCartItem(IShoppingCartItem item)
 {
     ID                  = (item.ID != Guid.Empty) ? item.ID : Guid.NewGuid();
     ItemCode            = GlobalUtilities.Coalesce(item.ItemCode);
     Quantity            = item.Quantity;
     ParentItemCode      = GlobalUtilities.Coalesce(item.ParentItemCode);
     DynamicKitCategory  = GlobalUtilities.Coalesce(item.DynamicKitCategory);
     GroupMasterItemCode = GlobalUtilities.Coalesce(item.GroupMasterItemCode);
     Type                = item.Type;
 }
        public void returns_correct_total_price(int quantity, double price, double expectedTotal)
        {
            _stubProductDiscounter.Setup(mpd => mpd.IsEligibleForDiscount(It.IsAny <int>())).Returns(false);

            _dummyShoppingCartItem = new ShoppingCartItem(new Product('A', price), quantity);

            var actualTotal = _sut.CalculateTotal(_dummyShoppingCartItem);

            Assert.AreEqual(expectedTotal, actualTotal);
        }
示例#14
0
 public ShoppingCartItem(IShoppingCartItem item)
 {
     ID                  = (item.ID != Guid.Empty) ? item.ID : Guid.NewGuid();
     ItemCode            = GlobalUtilities.Coalesce(item.ItemCode);
     Quantity            = item.Quantity;
     ParentItemCode      = GlobalUtilities.Coalesce(item.ParentItemCode);
     DynamicKitCategory  = GlobalUtilities.Coalesce(item.DynamicKitCategory);
     GroupMasterItemCode = GlobalUtilities.Coalesce(item.GroupMasterItemCode);
     Type                = item.Type;
 }
示例#15
0
        public async Task RemoveProductByIdAsync(int productId)
        {
            IShoppingCartItem item = _items.Find(o => o.Product.ProductId == productId);

            if (item != null)
            {
                _items.Remove(item);
            }
            // TODO: Remove this demonstration wait.
            await Task.Delay(2000);
        }
示例#16
0
        public async Task SetQuantityByProductIdAsync(int productId, int quantity)
        {
            IShoppingCartItem item = _items.Find(o => o.Product.ProductId == productId);

            if (item != null)
            {
                item.Quantity = quantity;
            }
            // TODO: Remove this demonstration wait.
            await Task.Delay(500);
        }
        public void returns_discounted_total_price_when_eligible_for_discount(int quantity, double price, double discount, double expectedTotal)
        {
            _stubProductDiscounter.Setup(mpd => mpd.SKU).Returns('A');
            _stubProductDiscounter.Setup(mpd => mpd.IsEligibleForDiscount(It.IsAny <int>())).Returns(true);
            _stubProductDiscounter.Setup(mpd => mpd.GetDiscount(It.IsAny <int>())).Returns(discount);

            _dummyShoppingCartItem = new ShoppingCartItem(new Product('A', price), quantity);

            var actualTotal = _sut.CalculateTotal(_dummyShoppingCartItem);

            Assert.AreEqual(expectedTotal, actualTotal);
        }
示例#18
0
        public async Task <IActionResult> OnPostAsync(int productId, int quantity)
        {
            IShoppingCart cart = await _shoppingCartService.GetCartAsync();

            IShoppingCartItem item = cart.Items.First(o => o.Product.ProductId == productId);

            if (item == null)
            {
                throw new ArgumentException("Could not find that product.");
            }
            item.Quantity = quantity;
            return(RedirectToPage("/Cart/Index"));
        }
示例#19
0
        private static IShoppingCart GetPredefinedCart(int[] itemIDs)
        {
            List <IShoppingCartItem> iscLst = new List <IShoppingCartItem>();

            foreach (int i in itemIDs)
            {
                IItem             item = blo.GetItemByID(i);
                IShoppingCartItem tt   = Factory.CreateShoppingCartItem();
                tt.Amount       = 1;
                tt.SelectedItem = item;
                iscLst.Add(tt);
            }
            ShoppingCart.CartItems = iscLst;
            return(ShoppingCart);
        }
示例#20
0
        public List <IShoppingCartItem> AddProduct(IShoppingCartItem item, List <IShoppingCartItem> currentCartItems)
        {
            IShoppingCartItem tempItem = currentCartItems.FindLast(p => p.SelectedItem.ItemID == item.SelectedItem.ItemID);

            if (tempItem == null)
            {
                currentCartItems.Add(item);
            }
            else
            {
                currentCartItems.Remove(tempItem);
                tempItem.Amount = tempItem.Amount + item.Amount;
                currentCartItems.Add(tempItem);
            }
            return(currentCartItems);
        }
示例#21
0
        private ShoppingCartItem(IShoppingCartItem item)
        {
            ID = (item.ID != Guid.Empty) ? item.ID : Guid.NewGuid();

            ItemCode        = GlobalUtilities.Coalesce(item.ItemCode);
            ParentItemCode  = GlobalUtilities.Coalesce(item.ParentItemCode);
            Description     = item.ItemDescription;
            ItemDescription = item.ItemDescription;
            Quantity        = item.Quantity;

            DynamicKitCategory  = GlobalUtilities.Coalesce(item.DynamicKitCategory);
            GroupMasterItemCode = GlobalUtilities.Coalesce(item.GroupMasterItemCode);

            Type              = item.Type;
            Category          = item.Category;
            PriceTypeID       = item.PriceTypeID;
            Price             = item.Price;
            PriceEachOverride = item.PriceEachOverride;

            BusinessVolumeEachOverride       = item.BusinessVolumeEachOverride;
            CommissionableVolumeEachOverride = item.CommissionableVolumeEachOverride;

            ApplyDiscountType = item.ApplyDiscountType;
            AppliedAmount     = item.AppliedAmount;
            InventoryStatus   = item.InventoryStatus;
            OtherCheck1       = item.OtherCheck1;
            OtherCheck2       = item.OtherCheck2;
            OtherCheck3       = item.OtherCheck3;
            OtherCheck4       = item.OtherCheck4;
            OtherCheck5       = item.OtherCheck5;
            Field1            = item.Field1;
            Field2            = item.Field2;


            if (item.ApplyDiscountType == DiscountType.Unknown)
            {
                Discounts = new List <Discount>();
            }
            else
            {
                var factory = new DiscountFactory();

                Discounts = new List <Discount> {
                    factory.CreateDiscount(ApplyDiscountType, item.AppliedAmount)
                };
            }
        }
示例#22
0
        private static IShoppingCartItem BuildCartItem(int itemID, int numberOfItems)
        {
            IShoppingCartItem sc = Factory.CreateShoppingCartItem();

            try
            {
                IItem tempItem = blo.GetItemByID(itemID);
                sc.SelectedItem = tempItem;
                sc.Amount       = numberOfItems;
            }
            catch
            {
                throw new Exception("There was a problem Building the shopping cart item");
            }

            return(sc);
        }
        public void CheckOut()
        {
            // ---- Functional Test
            var allArticles        = dao.GetAllItems();
            IShoppingCartItem item = FactoryTest.CreateShoppingCartItem();

            item.SelectedItem = allArticles[0];
            item.Amount       = 4;

            IShoppingCartItem item2 = FactoryTest.CreateShoppingCartItem();

            item2.SelectedItem = allArticles[1];
            item2.Amount       = 3;
            cart.CartItems.Add(item);
            cart.CartItems.Add(item2);
            blo.CheckOut(cart);
        }
示例#24
0
        public List <IShoppingCartItem> RemoveProduct(IShoppingCartItem item, List <IShoppingCartItem> currentCartItems)
        {
            IShoppingCartItem tempItem = currentCartItems.FindLast(p => p.SelectedItem.ItemID == item.SelectedItem.ItemID);

            if (tempItem == null)
            {
                _logger.Log("Selected article is not in the shopping cart \n");
            }
            else
            {
                currentCartItems.Remove(tempItem);
                if (tempItem.Amount > item.Amount)
                {
                    tempItem.Amount = tempItem.Amount - item.Amount;
                    currentCartItems.Add(tempItem);
                }
            }
            return(currentCartItems);
        }
示例#25
0
        public void Update(IShoppingCartItem item)
        {
            var cartitem = new ShoppingCartItem(item);
            var oldItem  = this.Where(c => c.ID == cartitem.ID).FirstOrDefault();

            if (oldItem == null)
            {
                return;
            }

            // Remove the old item
            this.Remove(oldItem.ID);

            // If we have a valid quantity, add the new item
            if (item.Quantity > 0)
            {
                this.Add(item);
            }
        }
        public double CalculateTotal(IShoppingCartItem shoppingCartItem)
        {
            var fullPrice = shoppingCartItem.Product.Price * shoppingCartItem.Quantity;

            if (fullPrice == ZERO_COST)
            {
                return(fullPrice);
            }

            var discounter = _productDiscounters.SingleOrDefault(x => char.ToLowerInvariant(x.SKU) == char.ToLowerInvariant(shoppingCartItem.Product.SKU));

            if (discounter == null || !discounter.IsEligibleForDiscount(shoppingCartItem.Quantity))
            {
                return(fullPrice);
            }

            var discount = discounter.GetDiscount(shoppingCartItem.Quantity);

            _consoleWrapper.WriteLine($"Applying discount for SKU: {shoppingCartItem.Product.SKU} for the amount of {discount}");

            return(fullPrice - discount);
        }
示例#27
0
        public static ShoppingCartItem Create(IShoppingCartItem oldCartItem)
        {
            var newCartItem = new ShoppingCartItem(oldCartItem);

            Item item = Exigo.GetItem(newCartItem.ItemCode);

            newCartItem.Category        = oldCartItem.Category;
            newCartItem.Description     = item.ItemDescription;
            newCartItem.ItemDescription = item.ItemDescription;
            newCartItem.ShortDetail     = item.ShortDetail1;
            newCartItem.ShortDetail2    = item.ShortDetail2;
            newCartItem.ShortDetail3    = item.ShortDetail3;
            newCartItem.ShortDetail4    = item.ShortDetail4;

            newCartItem.LongDetail  = item.LongDetail1;
            newCartItem.LongDetail2 = item.LongDetail2;
            newCartItem.LongDetail3 = item.LongDetail3;
            newCartItem.LongDetail4 = item.LongDetail4;

            newCartItem.TinyPicture                      = item.TinyImageUrl;
            newCartItem.SmallPicture                     = item.SmallImageUrl;
            newCartItem.LargePicture                     = item.LargeImageUrl;
            newCartItem.ItemEventId                      = oldCartItem.ItemEventId;
            newCartItem.MaxKitQuantity                   = oldCartItem.MaxKitQuantity;
            newCartItem.InventoryStatus                  = oldCartItem.InventoryStatus;
            newCartItem.BusinessVolumeEachOverride       = oldCartItem.BusinessVolumeEachOverride;
            newCartItem.CommissionableVolumeEachOverride = oldCartItem.CommissionableVolumeEachOverride;
            newCartItem.OtherCheck1                      = item.OtherCheck1;
            newCartItem.OtherCheck2                      = item.OtherCheck2;
            newCartItem.OtherCheck3                      = item.OtherCheck3;
            newCartItem.OtherCheck4                      = item.OtherCheck4;
            newCartItem.OtherCheck5                      = item.OtherCheck5;
            newCartItem.Field1      = item.Field1;
            newCartItem.Field2      = item.Field2;
            newCartItem.OtherCheck5 = item.OtherCheck5;
            return(newCartItem);
        }
        /// <summary>
        /// Convert the item to an auto gen item.
        /// </summary>
        /// <param name="item">The item to convert</param>
        /// <param name="currency">The currency</param>
        /// <returns></returns>
        public static AutoGen.Item CreateAutoGenItem(IShoppingCartItem item,
            string currency)
        {
            GCheckout.AutoGen.Item currentItem = new AutoGen.Item();

              currentItem.itemname = EncodeHelper.EscapeXmlChars(item.Name);
              currentItem.itemdescription =
            EncodeHelper.EscapeXmlChars(item.Description);
              currentItem.quantity = item.Quantity;

              //if there is a subscription, you may not have a unit price

              if (item.Subscription != null && item.Price > 0) {
            throw new ApplicationException(
              "The unit price must be 0 if you are using a subscription item.");
              }

              currentItem.unitprice = new AutoGen.Money();
              currentItem.unitprice.currency = currency;
              currentItem.unitprice.Value = item.Price;

              //TODO determine if we should try to catch if a UK customer tries to
              //use this value.
              if (item.Weight > 0) {
            currentItem.itemweight = new AutoGen.ItemWeight();
            currentItem.itemweight.unit = "LB"; //this is the only option.
            currentItem.itemweight.value = item.Weight;
              }

              if (item.MerchantItemID != null
            && item.MerchantItemID.Length > 0) {
            currentItem.merchantitemid = item.MerchantItemID;
              }

              if (item.MerchantPrivateItemDataNodes != null
            && item.MerchantPrivateItemDataNodes.Length > 0) {
            AutoGen.anyMultiple any = new AutoGen.anyMultiple();

            any.Any = item.MerchantPrivateItemDataNodes;
            currentItem.merchantprivateitemdata = any;
              }

              if (item.TaxTable != null &&
            item.TaxTable != AlternateTaxTable.Empty) {
            currentItem.taxtableselector = item.TaxTable.Name;
              }

              //if we have a digital item then we need to append the information
              if (item.DigitalContent != null) {
            currentItem.digitalcontent = new GCheckout.AutoGen.DigitalContent();
            //we have one of two types, email or key/url
            if (item.DigitalContent.EmailDelivery) {
              currentItem.digitalcontent.emaildelivery = true;
              currentItem.digitalcontent.emaildeliverySpecified = true;
            }
            else {
              if (item.DigitalContent.Description.Length > 0) {
            currentItem.digitalcontent.description =
              item.DigitalContent.Description;
              }
              if (item.DigitalContent.Key.Length > 0) {
            currentItem.digitalcontent.key =
              item.DigitalContent.Key;
              }
              if (item.DigitalContent.Url.Length > 0) {
            currentItem.digitalcontent.url =
              item.DigitalContent.Url;
              }
              currentItem.digitalcontent.displaydisposition
            = item.DigitalContent.GetSerializedDisposition();
            }
              }

              //see if we have subscription information
              if (item.Subscription != null) {
            if (item.Subscription.RecurrentItem == null) {
              throw new ApplicationException(
            "You must set a RecurrentItem for a subscription.");
            }
            Subscription sub = item.Subscription;
            //we have to assume the item was validated
            currentItem.subscription = new GCheckout.AutoGen.Subscription();
            GCheckout.AutoGen.Subscription autoSub = currentItem.subscription;
            if (sub.NoChargeAfter.HasValue) {
              autoSub.nochargeafter = sub.NoChargeAfter.Value;
              autoSub.nochargeafterSpecified = true;
            }
            autoSub.payments
              = new GCheckout.AutoGen.SubscriptionPayment[sub.Payments.Count];
            for (int sp = 0; sp < sub.Payments.Count; sp++) {
              SubscriptionPayment payment = sub.Payments[sp];
              autoSub.payments[sp] = new GCheckout.AutoGen.SubscriptionPayment();
              autoSub.payments[sp].maximumcharge
            = EncodeHelper.Money(currency, payment.MaximumCharge);
              if (payment.Times > 0) {
            autoSub.payments[sp].times = payment.Times;
            autoSub.payments[sp].timesSpecified = true;
              }
              autoSub.period = sub.Period;
              if (sub.RecurrentItem != null
            && sub.RecurrentItem.Subscription != null) {
            throw new ApplicationException(
              "A RecurrentItem may not contain a subscription.");
              }
              //call this method to create the recurrent item.
              autoSub.recurrentitem
            = ShoppingCartItem.CreateAutoGenItem(sub.RecurrentItem, currency);
              if (sub.StartDate.HasValue) {
            autoSub.startdate = sub.StartDate.Value;
            autoSub.startdateSpecified = true;
              }
              autoSub.type = sub.Type.ToString();
            }
              }
              return currentItem;
        }
 public OrderDetailRequest(IShoppingCartItem item)
 {
     this.ItemCode = item.ItemCode;
     this.Quantity = item.Quantity;
 }
 /// <summary>
 /// This method adds an item to an order.
 /// </summary>
 /// <param name="item">The shopping cart item to add.</param>
 public IShoppingCartItem AddItem(IShoppingCartItem item)
 {
     if (item == null)
     throw new ArgumentNullException("item must not be null");
       _items.Add(item);
       return item;
 }
示例#31
0
 public List <IShoppingCartItem> RemoveProductFromShoppingCart(IShoppingCartItem item, List <IShoppingCartItem> currentCartItems)
 {
     return(_shoppingCart.RemoveProduct(item, currentCartItems));
 }
示例#32
0
 public void add(IShoppingCartItem item)
 {
     totalPrice += item.GetPrice();
     items.Add(item);
 }
示例#33
0
        private static void RemoveProductFromShoppingCart(int articleID, int numberOfArticles)
        {
            IShoppingCartItem sc = BuildCartItem(articleID, numberOfArticles);

            ShoppingCart.CartItems = blo.RemoveProductFromShoppingCart(sc, ShoppingCart.CartItems);
        }
示例#34
0
        private static void SaveProductInShoppingCart(int articleID, int numberOfArticles)
        {
            IShoppingCartItem sc = BuildCartItem(articleID, numberOfArticles);

            ShoppingCart.CartItems = blo.AddProductToShoppingCart(sc, ShoppingCart.CartItems);
        }
示例#35
0
 internal static void AssertEqualShoppingCartItems(IShoppingCartItem firstItem, IShoppingCartItem secondItem)
 {
     Assert.AreEqual(firstItem.Quantity, secondItem.Quantity);
     Assert.AreEqual(firstItem.Product.Name, secondItem.Product.Name);
     Assert.AreEqual(firstItem.Product.UnitPrice, secondItem.Product.UnitPrice);
 }