private void PrintOrderHistory(ClientConsole console)
 {
     for (int i = 0; i < curCust.OrderHistory.Count; i++)
     {
         console.PrintCurrentOrder(curCust.OrderHistory[i]);
     }
 }
        private void DeletePizza(ClientConsole client, Order o)
        {
            client.PrintCurrentOrder(o);
            int userChoice = client.ChooseMenu();

            o.DeletePizza(userChoice - 1);
        }
        private void Action(ClientConsole console)
        {
            int userMenuChoice = 0;

            do
            {
                console.PrintMenu();
                userMenuChoice = console.ChooseMenu();
                switch (userMenuChoice)
                {
                case 1:
                    PrintOrderHistory(console);
                    break;

                case 2:
                    StartOrder(console);
                    userMenuChoice = 3;
                    break;

                case 3:
                    break;

                default:
                    userMenuChoice = 3;
                    break;
                }
            }while(userMenuChoice != 3);
        }
        public void Start(ClientConsole console)
        {
            console.PrintCustomersList(CustomerSingleton.Instance.Customers);
            int  userMenuChoice = console.ChooseMenu();
            bool validUser      = false;

            if (userMenuChoice > CustomerSingleton.Instance.Customers.Count)
            {
                curCust = new Customer(console.GetString("Enter name: "));
                CustomerSingleton.Instance.Customers.Add(curCust);
                validUser = true;
            }
            else
            {
                curCust = CustomerSingleton.Instance.Customers[userMenuChoice - 1];
                if (curCust.PasswordCheck(console.GetString("Enter password: "******"Invalid password.");
            }
        }
 private void PrintAllOrders(ClientConsole console)
 {
     for (int i = 0; i < curStore.Orders.Count; i++)
     {
         console.PrintCurrentOrder(curStore.Orders[i]);
     }
 }
        private void FinishOrder(ClientConsole client, Customer c, AStore store, Order o)
        {
            store.AddOrder(o);
            c.AddToOrderHistory(o);

            StoreSingleton.Instance.UpdateStores();
            CustomerSingleton.Instance.UpdateCustomers();
        }
Beispiel #7
0
        public static void ApplicationStart()
        {
            ClientConsole client = new ClientConsole();

            client.PrintInit();
            int userMenuChoice = client.ChooseMenu();

            if (userMenuChoice == 1) //StoreFront
            {
                StoreFront store = new StoreFront();
                store.Start(client);
            }
            else if (userMenuChoice == 2) //CustomerFront
            {
                CustomerFront custFront = new CustomerFront();
                custFront.Start(client);
            }
        }
        private void PrintUserOrders(ClientConsole console)
        {
            bool   foundOne = false;
            string userName = console.GetString("Enter name to search: ");

            for (int i = 0; i < curStore.Orders.Count; i++)
            {
                if (curStore.Orders[i].Name == userName)
                {
                    console.PrintCurrentOrder(curStore.Orders[i]);
                    foundOne = true;
                }
            }

            if (!foundOne)
            {
                console.GenericPrint("Could not find any orders placed by " + userName);
            }
        }
        private void PrintOrders(ClientConsole console)
        {
            console.PrintStoreOrderOptions();
            int userMenuChoice = console.ChooseMenu();

            switch (userMenuChoice)
            {
            case 1:
                PrintAllOrders(console);
                break;

            case 2:
                PrintUserOrders(console);
                break;

            default:
                break;
            }
        }
        private void DoPizzaOption(ClientConsole client, int menuChoice, AStore store, Order o)
        {
            if (menuChoice != store.PresetPizza.Count + 1) //Preset option
            {
                o.StartPresetPizza(store.PresetPizza[menuChoice - 1]);
                client.PrintSizes(store);
                int sizeChoice = client.ChooseMenu();
                o.CurrentPizza.AddSize(store.SizeList[sizeChoice - 1]);
                o.FinishPizza();
            }
            else
            {
                o.StartCustomPizza();
                o.CurrentPizza.AddDefaults();
                client.PrintSizes(store);
                //client.PrintCompInfo(store.SizeList);
                o.CurrentPizza.AddSize(store.SizeList[client.ChooseMenu() - 1]);
                client.PrintCrusts(store);
                o.CurrentPizza.AddCrust(store.CrustList[client.ChooseMenu() - 1]);
                string yesno = client.GetString("Do you want stuffed crust (y/n)?: ");
                if (yesno.ToLower() == "y")
                {
                    o.CurrentPizza.Crust.ChangeStuffedCrust();
                }
                do
                {
                    client.PrintToppings(store);
                    menuChoice = client.ChooseMenu();
                    if (menuChoice > store.ToppingsList.Count || o.CurrentPizza.Toppings.Count >= o.CurrentPizza.MaxToppings)
                    {
                        break;
                    }
                    else
                    {
                        o.CurrentPizza.AddTopping(store.ToppingsList[menuChoice - 1]);
                    }
                }while(menuChoice <= store.ToppingsList.Count);

                o.FinishPizza();
            }
        }
        private void StartOrder(ClientConsole console)
        {
            AStore clientStore    = console.ChooseStore(StoreSingleton.Instance.Stores);
            int    userMenuChoice = 0;

            if (curCust.StartOrderCheck(clientStore))
            {
                Order currentOrder = new Order(curCust, clientStore);
                do
                {
                    console.PrintOrderOptions();
                    userMenuChoice = console.ChooseMenu();
                    switch (userMenuChoice)
                    {
                    case 1:
                        console.PrintCurrentOrder(currentOrder);
                        break;

                    case 2:
                        console.PrintPizzaOptionsNoSize(clientStore);
                        userMenuChoice = console.ChooseMenu();
                        DoPizzaOption(console, userMenuChoice, clientStore, currentOrder);
                        break;

                    case 3:
                        DeletePizza(console, currentOrder);
                        break;

                    case 4:
                        FinishOrder(console, curCust, clientStore, currentOrder);
                        break;

                    default:
                        userMenuChoice = 4;
                        break;
                    }
                }while(userMenuChoice != 4);
            }
        }
 private void PrintSales(ClientConsole console)
 {
     console.PrintStoreSales(curStore);
 }
 public void Start(ClientConsole console)
 {
     curStore = console.ChooseStore(StoreSingleton.Instance.Stores);
     Action(console);
 }