Пример #1
0
        static void Main(string[] args)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["CapstoneDatabase"].ConnectionString;

            try
            {
                ParksInterface ui = new ParksInterface();
                ui.RunCLI();
            }
            catch (Exception ex)
            {
                Console.WriteLine("There was an error with the Park Reservation System. Out of service.");
            }
        }
Пример #2
0
        public void Display()

        {
            // prompts user to view available campgrounds or return to previous screen //
            PrintMenu();
            parkInfoSelection = CLIHelper.GetInteger("Select a command: ");
            Console.WriteLine();
            if (parkInfoSelection != 1 && parkInfoSelection != 2 && parkInfoSelection != 3)
            {
                Console.WriteLine("Invalid Input, returning to main menu!");
                Thread.Sleep(milliseconds);
                Console.Clear();
                ParksInterface mainmenu = new ParksInterface();
                mainmenu.RunCLI();
            }
            // user selected to view available campgrounds //
            if (parkInfoSelection == 1)
            {
                // Clears screen and calls method that shows menu of campgrounds at the selected park //
                // prompts user to search for available reservations or return to previous menu //
                Console.Clear();
                ViewCampgrounds();
                Console.WriteLine();
                PrintMenu2();

                // Checks if user entered 1 or 2, if not, sends back to previous menu display //
                if (parkCampgroundSelection != 1 && parkCampgroundSelection != 2)
                {
                    Console.WriteLine("Invalid Input, Campground Menu!");
                    Thread.Sleep(milliseconds);
                    Console.Clear();
                    Display();
                }

                // user selected to search for available reservations //
                if (parkCampgroundSelection == 1)
                {
                    // clears screen and displays a list of campgrounds for selected park //
                    // saves selected campground and carries it to reservation subMenu //
                    Console.Clear();
                    List <Campground>    campgroundsForCurrentPark = ViewCampgrounds();
                    ReservationInterface reservationSubmenu        = new ReservationInterface(campgroundsForCurrentPark);
                    reservationSubmenu.Display();
                }

                // user opted to return to previous menu //
                // the constructor keeps the selectedPark //
                // the method ensures the park info is redisplayed for the user //
                else if (parkCampgroundSelection == 2)
                {
                    Console.Clear();
                    DisplayParkInfo();
                    CampgroundsInterface reuturnToPreviousMenu = new CampgroundsInterface(selectedPark);
                    reuturnToPreviousMenu.Display();
                }
            }

            // THIS IS ONE OF THE BONUS SELECTIONS FOR PARKWIDE RESOS (CURRENTLY NOT IMPLEMENTED) //
            else if (parkInfoSelection == 2)
            {
                Console.WriteLine("This option is currently not available, returning to mainmenu!");
                Thread.Sleep(milliseconds);
                Console.Clear();
                ParksInterface mainmenu = new ParksInterface();
                mainmenu.RunCLI();
            }

            // user opted to return to the main menu //
            else if (parkInfoSelection == 3)
            {
                Console.Clear();
                ParksInterface mainmenu = new ParksInterface();
                mainmenu.RunCLI();
            }
        }