示例#1
0
 public void AddPizza(List <AIngredient> pizzaToAdd)
 {
     if (Pizzas.Count < 100)
     {
         Pizzas.Add(pizzaToAdd);
     }
 }
示例#2
0
        public void RemovePizza()
        {
            bool end = false;
            int  select;

            do
            {
                System.Console.WriteLine("Type the number of the pizza to remove or 0 to return");
                System.Console.WriteLine();
                DisplayOrder();
                if (int.TryParse(System.Console.ReadLine(), out select))
                {
                    System.Console.WriteLine();
                }
                else
                {
                    System.Console.WriteLine("Invalid Choice");
                    end = true;
                    continue;
                }
                if ((select > Pizzas.Count || select < 1))
                {
                    System.Console.WriteLine("");
                    end = false;
                }
                else
                {
                    Pizzas.RemoveAt(select - 1);
                    end = false;
                }
            } while (end);
        }
示例#3
0
 public bool RemovePizza(APizza pizza)
 {
     if (Pizzas.Remove(pizza))
     {
         TotalPrice -= pizza.CalculateTotalPrice();
         return(true);
     }
     return(false);
 }
        public override string ToString()
        {
            string result = $"{Customer}" + System.Environment.NewLine + $"{TimePlaced}"
                            + System.Environment.NewLine + $"{Store}" + System.Environment.NewLine
                            + $"{Price}" + System.Environment.NewLine + "Pizzas:" + System.Environment.NewLine;

            Pizzas.ForEach(pizza => result += $"{pizza}" + System.Environment.NewLine);
            return(result);
        }
示例#5
0
 public void ViewPizzas()
 {
     foreach (var pizza in Pizzas)
     {
         System.Console.WriteLine($"Pizza {Pizzas.IndexOf(pizza)+1}:");
         foreach (var component in pizza)
         {
             System.Console.Write($"{component.Name} ");
         }
         System.Console.WriteLine("\n");
     }
 }
示例#6
0
文件: Order.cs 项目: NNKamel/pizzabox
        public bool AddPizza(APizza pizza)
        {
            if (!(IsBelowMaxPrice(pizza.CalculateTotalPrice()) && IsBelowMaxPizzas(1) && IsPizzaToppingsOk(pizza)))
            {
                return(false);
            }

            Pizzas.Add(pizza);

            TotalPrice += pizza.CalculateTotalPrice();
            date        = DateTime.Now;
            return(true);
        }
示例#7
0
        public void CreatePizza(Store store)
        {
            Pizza pizza = store.ChoosePizza();

            pizza.Size  = store.ChooseSize();
            pizza.Crust = store.ChooseCrust();
            if ((this.CalculatePrice() + pizza.GetPrice()) > 250)
            {
                System.Console.WriteLine("Pizza cannot be added as the order will exceed the $250 limit!");
                System.Console.WriteLine();
                return;
            }
            Pizzas.Add(pizza);
        }
示例#8
0
        public void RemoveLastPizza()
        {
            if (Pizzas.Count > 0)
            {
                Pizzas.RemoveAt(Pizzas.Count - 1);

                //Re-calculate order price
                Price = CalcOrderPrice();
            }

            else
            {
                System.Console.WriteLine("Cannot remove pizza; no pizzas added yet.");
            }
        }
示例#9
0
        public void CreatePizza(string size, string crust, List <string> toppings)
        {
            if (Pizzas.Count < 50)
            {
                Pizzas.Add(new Pizza(size, crust, toppings));

                //Re-calculate order price
                Price = CalcOrderPrice();
            }

            else
            {
                System.Console.WriteLine("Too many pizzas in order; could not add pizza. Please remove some pizzas or make a separate order.");
            }
        }
        protected void addPizzaToOrder(APizza pizza)
        {
            pizza.Price = pizza.Crust.Price + pizza.Size.Price;
            foreach (Topping t in pizza.Toppings)
            {
                pizza.Price += t.Price;
            }

            if (Pizzas == null)
            {
                Pizzas = new List <APizza>();
            }
            Pizzas.Add(pizza);
            _ordered = true;
            Console.WriteLine("Your pizza has been added to your order.");
            Console.WriteLine();
            doNext();
        }
示例#11
0
 public void MakeMeatPizza()
 {
     Pizzas.Add(_pizzaFactory.Make <MeatPizza>());
 }
示例#12
0
 public void AddPizza(int choice)
 {
     if (choice == 1)
     {
         // check to see if amount of pizza is less than 50
         if (Pizzas.Count < 25)
         {
             APizzaModel p = _pizzaFactory.Make <PepperoniPizza>();
             p.OrderId = EntityId;
             Pizzas.Add(p);
             Total = Total + 10;
         }
         else
         {
             Console.WriteLine("Max Order amount reached");
         }
     }
     else if (choice == 2)
     {
         if (Pizzas.Count < 25)
         {
             APizzaModel p = _pizzaFactory.Make <FourCheesePizza>();
             p.OrderId = EntityId;
             Pizzas.Add(p);
             Total = Total + 10;
         }
         else
         {
             Console.WriteLine("Max Order amount reached");
         }
     }
     else if (choice == 3)
     {
         if (Pizzas.Count < 25)
         {
             APizzaModel p = _pizzaFactory.Make <VeggiePizza>();
             p.OrderId = EntityId;
             Pizzas.Add(p);
             Total = Total + 10;
         }
         else
         {
             Console.WriteLine("Max Order amount reached");
         }
     }
     else if (choice == 4)
     {
         if (Pizzas.Count < 25)
         {
             APizzaModel p = _pizzaFactory.Make <MeatPizza>();
             p.OrderId = EntityId;
             Pizzas.Add(p);
             Total = Total + 10;
         }
         else
         {
             Console.WriteLine("Max Order amount reached");
         }
     }
     else if (choice == 5)
     {
         if (Pizzas.Count < 25)
         {
             APizzaModel p = _pizzaFactory.Make <MeatPizza>();
             p.OrderId = EntityId;
             p.Size    = "Large";
             Pizzas.Add(p);
             Total = Total + 10;
         }
         else
         {
             Console.WriteLine("Max Order amount reached");
         }
     }
     else if (choice == 6)
     {
         if (Pizzas.Count < 25)
         {
             APizzaModel p = _pizzaFactory.Make <PepperoniPizza>();
             p.OrderId = EntityId;
             Pizzas.Add(p);
             Total = Total + 10;
         }
         else
         {
             Console.WriteLine("Max Order amount reached");
         }
     }
     else if (choice == 7)
     {
         if (Pizzas.Count < 25)
         {
             APizzaModel p = _pizzaFactory.Make <FourCheesePizza>();
             p.OrderId = EntityId;
             Pizzas.Add(p);
             Total = Total + 10;
         }
         else
         {
             Console.WriteLine("Max Order amount reached");
         }
     }
     else if (choice == 8)
     {
         if (Pizzas.Count < 25)
         {
             APizzaModel p = _pizzaFactory.Make <VeggiePizza>();
             p.OrderId = EntityId;
             Pizzas.Add(p);
             Total = Total + 10;
         }
         else
         {
             Console.WriteLine("Max Order amount reached");
         }
     }
     else if (choice == 0)
     {
         System.Console.WriteLine("Finished Ordering..");
     }
     else
     {
         System.Console.WriteLine("Choose a valid option");
     }
 }
示例#13
0
 public void AddPizza(APizza pizza)
 {
     Pizzas.Add(pizza);
     Total += pizza.Crust.Price + pizza.Size.Price + pizza.Toppings.Sum(t => t.Price);
 }
 public decimal CalculatePrice()
 {
     return(Pizzas.Sum(p => p.CalculatePrice()));
 }
示例#15
0
文件: Order.cs 项目: NNKamel/pizzabox
 public bool RemovePizza(APizza pizza)
 {
     return(Pizzas.Remove(pizza));
 }
示例#16
0
 public void MakeCustomPizza(Crust Crust, Size Size, List <Topping> Toppings)
 {
     Pizzas.Add(new CustomPizza(Crust, Size, Toppings));
 }
 public void CreatePizza()
 {
     Pizzas.Add(new Pizza());
 }
示例#18
0
 public void MakeCheesePizza()
 {
     Pizzas.Add(_pizzaFactory.Make <CheesePizza>());
 }
示例#19
0
 public bool AddPizza(APizza pizza)
 {
     Pizzas.Add(pizza);
     return(true);
 }