public void AddItemToCategory(string category, SellableProduct newItem) { if (!sellingItems.ContainsKey(category)) { throw new CategoryDoesntExistException(); } VerifyItemExist(category, newItem.Name); IList <SellableProduct> items = sellingItems[category]; items.Add(newItem); }
public void AddProduct(SellableProduct product, int quantity) { if (quantity < 1) { throw new ArgumentException("Product quantity < 1"); } Euro total = new Euro(product.Price.IntegerPart, product.Price.DecimalPart); total.Multiply(quantity); totalValue.Add(total); if (statisticData.ContainsKey(product.Name)) { statisticData[product.Name] = statisticData[product.Name] + quantity; } else { statisticData.Add(product.Name, quantity); } }
public override bool Equals(object obj) { SellableProduct item = obj as SellableProduct; return(item.Name.Equals(Name)); }