Beispiel #1
0
        public void displayView(Puser user)
        {
            this.user = user;

            MainOptions();


            switch (option - 1)
            {
            case (int)menuCustomerConst.Order:
            {
                CustomerLocation();

                bool validateDate = OrderHandler.CheckOrderDateTime(location, user);

                if (validateDate == true)
                {
                    CustomerPizzas();
                    CustomerOrder();
                }
                else
                {
                    Console.WriteLine("Can't Order From another Location within 24 hours");
                    Console.WriteLine("Pls Choose another location:");

                    displayView(user);
                    listCount = 1;
                }

                break;
            }

            case (int)menuCustomerConst.View:
            {
                List <Porder> orders = OrderHandler.GetOrders();
                OrderView.DisplayOrders(orders);

                break;
            }
            }
        }
        public void displayView(Puser user)
        {
            this.user = user;

            Console.WriteLine("===================== ADMINISTRATOR ==================");
            Console.WriteLine();
            Console.WriteLine($"Choose from the options below from 1 to {menuAdmin.Length}");
            Console.WriteLine();

            int listCount = 1;
            int option;


            for (int i = 0; i < menuAdmin.Length - 1; listCount++, i++)
            {
                Console.WriteLine($" ({listCount}) \t {menuAdmin[i]}");
            }

            Console.WriteLine();

            do
            {
                option = base.GetValidatedOption(menuAdmin.Length - 1);
            } while (option == -1);

            //Load Locations from domainusing
            List <Plocation> locations = LocationHandler.GetLocationData();

            switch (option - 1)
            {
            case (int)menuAdminConst.Stores:
            {
                LocationView.DisplayLocationsOptions(locations);

                break;
            }

            case (int)menuAdminConst.Pizzas:
            {
                LocationView.DisplayLocationsOptions(locations);

                do
                {
                    option = base.GetValidatedOption(locations.Count - 1);
                } while (option == -1);

                //Load Pizzas from domain
                List <Pizza> pizzas = PizzaHandler.GetPizzasFromLocation(locations[option - 1]);

                //Display pizzas
                PizzaView.DisplayPizzas(pizzas);

                break;
            }

            case (int)menuAdminConst.Order:

            {
                List <Porder> orders = OrderHandler.GetOrders();
                OrderView.DisplayOrders(orders);

                break;
            }

            case (int)menuAdminConst.Customer:

            {
                List <Customer> customers = CustomerHandler.GetCustomers();
                CustomerDetailsView.DisplayCustomerDetails(customers);

                break;
            }

            case (int)menuAdminConst.Sales:

            {
                break;
            }

            case (int)menuAdminConst.Users:
            {
                List <Puser> users = UserHandler.GetUsers();
                UserDetailsView.DisplayUserDetails(users);

                break;
            }
            }

            string option1;

            do
            {
                option1 = base.GetInput("Type in YES to continue or NO to quit. ");

                if (option1.ToLower().Equals("yes"))
                {
                    displayView(user);
                }
                else if (option1.ToLower().Equals("no"))
                {
                    Console.WriteLine("Thank you for choosing PizaBox");
                    Environment.Exit(0);
                }
                else
                {
                    Console.WriteLine("Incorrect Option, pls try again.");
                    Console.WriteLine();
                }
            } while (option1.ToLower().Equals("yes") || option1.ToLower().Equals("no"));

            Console.WriteLine();
        }