Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
            SellableProduct item = obj as SellableProduct;

            return(item.Name.Equals(Name));
        }