Example #1
0
        public void Start()
        {
            Boolean runMenu = true;
            string  managerPassword;

            Log.Logger = new LoggerConfiguration().WriteTo.File("../SystemLog.json").CreateLogger();
            do
            {
                Console.Clear();
                Console.WriteLine("Welcome to the Pie Shop!");
                Console.WriteLine("Please make a selection below:");
                Console.WriteLine("[1] Customer Oprions");
                Console.WriteLine("[2] Manager options");
                Console.WriteLine("[3] Exit Application");
                string userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                    StartCustomer newSearch = new StartCustomer(_repo);
                    newSearch.Start();
                    break;

                case "2":
                    Console.WriteLine("Please enter the Password (Psss its Passw0rd!)");
                    managerPassword = Console.ReadLine();
                    if (managerPassword.Equals("Passw0rd!"))
                    {
                        ManagerMenu newManager = new ManagerMenu(_repo);
                        newManager.Start();
                    }
                    else
                    {
                        Log.Error("Invalid password was entered");
                        Console.WriteLine("ERROR WRONG PASSWORD!!! Press Enter to Continue");
                        Console.ReadLine();
                    }
                    break;

                case "3":
                    Console.WriteLine($"We are sad to see you leave :(\nplease come again soon!!");
                    runMenu = false;
                    break;

                default:
                    Log.Error("Invalid option was chosen(Client did not choose 'Customer Oprions', 'Manager options', or 'Exit Application' )");
                    Console.WriteLine("\nThat was not an option try again\nPlease press enter to continue");
                    Console.ReadLine();

                    break;
                }
            } while (runMenu);
        }
Example #2
0
        /// <summary>
        /// This is the start of the application. it will present main menue to useers
        /// </summary>
        public void start()
        {
            Log.Information("Store App started");

            // connecting to the DB
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("appsettings.json")
                                .Build();

            string connectionString = configuration.GetConnectionString("StoreDB");
            DbContextOptions <p0storeContext> options = new DbContextOptionsBuilder <p0storeContext>()
                                                        .UseSqlServer(connectionString).Options;

            var context = new p0storeContext(options);

            Console.WriteLine("\n***\tWELCOME TO OUR FLOWER SHOP\t***");
            bool repeat = true;

            do
            {
                Console.WriteLine("\nMAIN MENU");
                Console.WriteLine("Please enter \"1\" if you are a customer");
                Console.WriteLine("Please enter \"2\" if you are a manager");
                Console.WriteLine("Please enter \"3\" to Exit");
                string Response = Console.ReadLine();

                switch (Response)
                {
                case "1":
                    CustomerMenu newCustomerMenu = new CustomerMenu(new CustomerBL(new CustomerDB(context)), new OrderBL(new OrderDB(context)), new LocationBL(new LocationDB(context)));
                    newCustomerMenu.start();
                    break;

                case "2":
                    ManagerMenu newManager = new ManagerMenu(new LocationBL(new LocationDB(context)), new CustomerBL(new CustomerDB(context)), new OrderBL(new OrderDB(context)));
                    newManager.start();
                    break;

                case "3":
                    System.Console.WriteLine("\tThank you for Visiting Our store\n\t\t BYE BYE :)");
                    repeat = false;
                    break;

                default:
                    System.Console.WriteLine("Invalid input");
                    break;
                }
            } while(repeat);
        }
Example #3
0
        public void Start()
        {
            bool menuRun = true;

            do
            {
                Console.WriteLine();
                Console.WriteLine("Welcome to the Ski Store!");
                Console.WriteLine("-------------------------");
                Console.WriteLine("Please Select an Option:");
                Console.WriteLine("[0] - Customer Menu");
                Console.WriteLine("[1] - Manager Menu");
                Console.WriteLine("[2] - Exit Program");
                Console.WriteLine("Select Option: ");
                string option = Console.ReadLine();
                switch (option)
                {
                case "0":
                    CustMenu customerMenu = new CustMenu(_customerBL, _locationBL, _productBL, _itemBL, _orderBL, _productOrderBL);
                    menuRun = false;
                    customerMenu.Start();
                    break;

                case "1":
                    ManagerMenu managerMenu = new ManagerMenu(_customerBL, _locationBL, _productBL, _itemBL, _orderBL, _productOrderBL);
                    Log.Information("Manager Menu Accessed");
                    menuRun = false;
                    managerMenu.Start();
                    break;

                case "2":
                    menuRun = false;
                    Exit();
                    break;

                default:
                    Console.WriteLine("Invalid menu option. Please try again!");
                    break;
                }
            } while (menuRun);
        }
        public void Start()
        {
            Boolean stay = true;

            do
            {
                Console.Clear();
                Console.WriteLine(MenuPrint);
                Console.WriteLine("Enter a #, 'Back' or 'Exit': ");
                string userInput = Console.ReadLine();

                IMenu menu;
                switch (userInput)
                {
                case "0":
                    try
                    {
                        if (Login())
                        {
                            menu = new ManagerMenu(_manager, _managerBL, _customerBL, _locationBL, _productBL, _inventoryLineItemsBL);
                            menu.Start();
                        }
                        else
                        {
                            _manager = null;
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("\nThe provided email is not associated with a manager!");
                        Console.ReadLine();
                        continue;
                    }
                    finally
                    {
                        _manager = null;
                    }
                    break;

                case "1":
                    try
                    {
                        CreateManager();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("\ninvalid input. ");
                        Console.ReadLine();
                        continue;
                    }

                    break;

                case "2":
                    Console.Clear();
                    GetManagers();
                    break;

                case "Back":
                    stay = false;
                    break;

                case "Exit":
                    System.Environment.Exit(1);
                    break;

                default:
                    Console.Clear();
                    Console.WriteLine("Invalid input! Please select a menu item");
                    Console.WriteLine("Press Enter to view menu");
                    Console.ReadLine();
                    break;
                }
            } while (stay);
        }