Example #1
0
        public void ReturnProduct(int id, int count)
        {
            FoodStuff food = Basket[id];

            for (int i = 0; i < count; i++)
            {
                Basket.Remove(food);
            }
        }
Example #2
0
 public static List <FoodStuff> AddToBusket(FoodStuff food, int count)
 {
     for (int i = 0; i < count; i++)
     {
         Basket.Add(food);
     }
     if (Basket.Count > Bag.Capacity)
     {
         throw new BagException("Products will not fit in the bag");
     }
     return(Basket);
 }
Example #3
0
        public double CalculateSumm(int id, int count)
        {
            FoodStuff food = ProductInCell;

            if (CountFoodInCell < count)
            {
                throw new ShopException($"Cell have {CountFoodInCell} products, not more");
            }


            CountFoodInCell -= count;


            if (CountFoodInCell == 0)
            {
                Window.DeleteFoodFromCell(id);
            }

            Buyer.AddToBusket(food, count);

            return(food.CalculateSumm(food, count));
        }
Example #4
0
 public double CalculateSumm(FoodStuff food, int count)
 {
     return(food.Price * count);
 }
Example #5
0
 public Cell(FoodStuff food, int count)
 {
     ProductInCell   = food;
     CountFoodInCell = count;
 }
Example #6
0
 public Cell()
 {
     ProductInCell   = new FoodStuff();
     CountFoodInCell = NameGenerator.RandomInt(1, 10);
 }