示例#1
0
 public void AddPizza(List <AIngredient> pizzaToAdd)
 {
     if (Pizzas.Count < 100)
     {
         Pizzas.Add(pizzaToAdd);
     }
 }
示例#2
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);
        }
示例#3
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);
        }
示例#4
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();
        }
 public void CreatePizza()
 {
     Pizzas.Add(new Pizza());
 }
示例#7
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");
     }
 }
示例#8
0
 public void AddPizza(APizza pizza)
 {
     Pizzas.Add(pizza);
     Total += pizza.Crust.Price + pizza.Size.Price + pizza.Toppings.Sum(t => t.Price);
 }
示例#9
0
 public void MakeCustomPizza(Crust Crust, Size Size, List <Topping> Toppings)
 {
     Pizzas.Add(new CustomPizza(Crust, Size, Toppings));
 }
示例#10
0
 public void MakeCheesePizza()
 {
     Pizzas.Add(_pizzaFactory.Make <CheesePizza>());
 }
示例#11
0
 public void MakeMeatPizza()
 {
     Pizzas.Add(_pizzaFactory.Make <MeatPizza>());
 }
示例#12
0
 public bool AddPizza(APizza pizza)
 {
     Pizzas.Add(pizza);
     return(true);
 }