Exemplo n.º 1
0
        public void ModifyOrder(User user, Order order, string newOrder = "New")
        {
            bool modify = true;
            int  select;

            order.Status = "Incomplete";

            do
            {
                System.Console.WriteLine("Type 1 to add a pizza, 2 to modify your order, 3 to complete the order, or 4 to quit.");
                if (int.TryParse(System.Console.ReadLine(), out select))
                {
                    System.Console.WriteLine();
                }
                else
                {
                    System.Console.WriteLine("Invalid Choice");
                    continue;
                }
                switch (select)
                {
                case 1:
                    if (user.Orders.Count >= 50)
                    {
                        System.Console.WriteLine("You cannot have more than 50 pizzas in one order!");
                        System.Console.WriteLine();
                    }
                    order.CreatePizza(this);
                    break;

                case 2:
                    order.RemovePizza();
                    break;

                case 3:
                    order.Status = "Complete";
                    modify       = false;
                    break;

                default:
                    modify = false;
                    break;
                }
            } while (modify);

            System.Console.WriteLine("Final Order:");
            order.DisplayOrder();
            if (newOrder == "New")
            {
                Orders.Add(order);
                user.Orders.Add(order);
            }
        }
 public bool PlaceOrder()
 {
     if (Cart == null)
     {
         return(false);
     }
     else
     {
         Orders.Add(Cart);
         Cart = null;
         return(true);
     }
 }
Exemplo n.º 3
0
        public void PlaceOrder(Store userStore)
        {
            var finished = false;
            var order    = new Order(Name);

            while (!finished)
            {
                int selection;

                PrintOptions(order);
                int.TryParse(System.Console.ReadLine(), out selection);
                switch (selection)
                {
                case 1:
                    AddPresetPizza(order);
                    break;

                case 2:
                    AddCustomPizza(order);
                    break;

                case 3:
                    order.RemoveLastPizza();
                    break;

                default:
                    finished = true;
                    break;
                }
            }

            //Add completed order to the user's active orders
            if (order.Pizzas.Count > 0)
            {
                Orders.Add(order);
                System.Console.WriteLine("Order Placed.");
            }
        }
Exemplo n.º 4
0
Arquivo: Store.cs Projeto: Saixah/p1
 public void CreateOrder()
 {
     Orders.Add(new Order());
 }