///<summary>Search customer UI that returns to main customer menu when finished </summary>
        public void SearchCustomerMenu()
        {
            try
            {
                _ = SearchCustomer();
                string input;
                do
                {
                    Console.WriteLine("Where would you like to go? \n [0] Back to main menu? \n [1] Customer Menu?\n [2] Exit?");
                    input = Console.ReadLine();
                } while (ErrorHandler.InvalidIntInput(input));

                switch (input)
                {
                case "0":
                    AdminMenu am = new AdminMenu();
                    am.Welcome();
                    break;

                case "1":
                    MainMenu();
                    break;

                case "2":
                    ExitMenu exit = new ExitMenu();
                    exit.Exit();
                    break;

                default:
                    ErrorHandler err = new ErrorHandler();
                    err.InvalidInputMsg();
                    Log.Error("Invalid Input");
                    ExitMenu ex = new ExitMenu();
                    ex.Exit();
                    break;
                }
            }
            catch (CustomerException ex)
            {
                Console.WriteLine(ex.Message);
                Log.Error(ex.Message);
                TryAgain(SearchCustomerMenu);
            }
            catch (NotImplementedException ex)
            {
                Console.WriteLine(ex.Message);
                Log.Error(ex.Message);
                TryAgain(SearchCustomerMenu);
            }
            catch (CustomerNotFoundException ex)
            {
                Console.WriteLine(ex.Message);
                Log.Error(ex.Message);
                TryAgain(SearchCustomerMenu);
            }
        }
        ///<summary>Main Menu for customer operations</summary>
        public void MainMenu()
        {
            string input;

            do
            {
                Console.WriteLine("Welcome to the Customer Records! \n What would you like to do?");
                Console.WriteLine(" [0] Add Customers \n [1] Search Customers \n [2] Get Customer History \n [3] Go back to Main Menu \n [4] Exit");
                input = Console.ReadLine();
            } while (ErrorHandler.InvalidIntInput(input));

            switch (input)
            {
            case "0":
                //Go to Add Customer UI
                AddCustomerMenu();
                break;

            case "1":
                //Go to Search Customer UI
                SearchCustomerMenu();
                break;

            case "2":
                //Go to Customer History UI
                AdminOrder ao = new AdminOrder();
                ao.ViewCustomerOrderHistory();
                break;

            case "3":
                //go back to Main Menu
                AdminMenu main = new AdminMenu();
                main.Welcome();
                break;

            case "4":
                //go to exit
                ExitMenu exit = new ExitMenu();
                exit.Exit();
                break;

            default:
                //error handling
                ErrorHandler err = new ErrorHandler();
                err.InvalidInputMsg();
                Log.Error("Invalid Input");
                MainMenu();
                break;
            }
        }
Ejemplo n.º 3
0
        ///<summary>Main menu for Order Operations</summary>
        public void Menu()
        {
            Console.WriteLine("Welcome to Order UI! \n What would you like to do?");
            Console.WriteLine(" [0] Place Order \n [1] View Order History of Customer \n [2] View Order History of Location\n [3] Return to Main Menu \n [4] Exit");
            string input = Console.ReadLine();

            switch (input)
            {
            case "0":
                //code to add order
                AddOrder();
                break;

            case "1":
                //code to view order history of customer
                ViewCustomerOrderHistory();
                break;

            case "2":
                //code to view order history of location
                ViewLocationOrderHistory();
                break;

            case "3":
                //go back to Main Menu
                AdminMenu main = new AdminMenu();
                main.Welcome();
                break;

            case "4":
                //go to exit
                ExitMenu exit = new ExitMenu();
                exit.Exit();
                break;

            default:
                //Error Handling
                ErrorHandler err = new ErrorHandler();
                err.InvalidInputMsg();
                Menu();
                break;
            }
        }
Ejemplo n.º 4
0
        ///<summary>Main menu for location operations</summary>
        public void Menu()
        {
            Console.WriteLine("Welcome to Location UI! \n What would you like to do?");
            Console.WriteLine(" [0] View Order History of Location \n [1] View Location Inventory \n [2] Go back to Main Menu \n [3] Exit");
            string input = Console.ReadLine();

            switch (input)
            {
            case "0":
                //code to view orderhistory of location
                AdminOrder ao = new AdminOrder();
                ao.ViewLocationOrderHistory();
                break;

            case "1":
                //code to view location inventory
                ViewLocationInventory();
                break;

            case "2":
                //go back to Main Menu
                AdminMenu main = new AdminMenu();
                main.Welcome();
                break;

            case "3":
                //go to exit
                ExitMenu exit = new ExitMenu();
                exit.Exit();
                break;

            default:
                //error handling
                ErrorHandler err = new ErrorHandler();
                err.InvalidInputMsg();
                Menu();
                break;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Method that queries a user if it wants to exit
        /// </summary>
        public void Exit()
        {
            //exit application
            Console.WriteLine("Exit? \n Y^(Yes) N^(No)");
            string choice = Console.ReadLine();

            switch (choice)
            {
            case "N":
                AdminMenu begin = new AdminMenu();
                begin.Welcome();
                break;

            case "Y":
                Log.Information("Exit Program");
                System.Environment.Exit(1);
                break;

            default:
                Console.WriteLine("Invalid Input");
                Exit();
                break;
            }
        }