コード例 #1
0
        public void ReservationConfirmationForPark(string arrivalDate, string departureDate, int camp_id, int parkSelection)
        {
            SiteSqlDAL        site            = new SiteSqlDAL(databaseconnectionString);
            ReservationSqlDAL bookReservation = new ReservationSqlDAL(databaseconnectionString);

            Console.WriteLine();
            Console.Write("Which campground should be reserved? (enter 0 to cancel)  ");
            int campInput = CLI_Helper.GetInteger("==>");

            if (campInput == 0)
            {
                return;
            }

            Console.WriteLine();
            Console.Write("Which camp site should be reserved? (enter 0 to cancel)   ");
            int siteInput = CLI_Helper.GetInteger("==>");

            if (siteInput == 0)
            {
                return;
            }

            Console.WriteLine();
            Console.Write("Under what name should the reservation be held?  ");
            string inputName = Console.ReadLine();

            bookReservation.MakeReservation(parkSelection, site.GetSiteID(siteInput, camp_id), inputName, arrivalDate, departureDate);
            string reservationID = bookReservation.GetReservationId(inputName);

            Thread.Sleep(2000);
            Console.WriteLine();
            Console.WriteLine($"The reservation has been booked and the confirmation ID is: {reservationID}");
            Console.ReadLine();
        }
コード例 #2
0
        public void ParkMenu(int parkSelection)
        {
            Console.WriteLine();
            Console.WriteLine("Select a Command");
            Console.WriteLine("1) View Campgrounds");
            Console.WriteLine("2) Search for Reservation");
            Console.WriteLine("3) Return to Previous Screen");
            Console.WriteLine();

            bool wegood = true;

            while (wegood)
            {
                int menuInput = CLI_Helper.GetInteger("==>");
                switch (menuInput)
                {
                case 1:
                    PrintParkCampGround(parkSelection);
                    wegood = false;
                    break;

                case 2:
                    ParkWideReservations(parkSelection);
                    wegood = false;
                    break;

                case 3:
                    return;

                default:
                    Console.WriteLine("Invalid Input. Please try another value.");
                    break;
                }
            }
        }
コード例 #3
0
        public void RunCLI()
        {
            while (true)
            {
                Console.Clear();
                PrintHeader();
                PrintMainMenu();

                // Assign user input to integer value to pass through proceeding methods
                int parkSelection = CLI_Helper.GetInteger("==>");

                //Checks if a user input a string value of 'Q'. CLI_HELPER.GetInteger returns 0 in this case.
                if (parkSelection == 0)
                {
                    break;
                }
                else if (CLI_Helper.ParkExists(parkSelection))
                {
                    Console.WriteLine();
                    PrintParkDetails(parkSelection);
                    ParkMenu(parkSelection);
                }
                else
                {
                    Console.WriteLine("Invalid Input, Please Try Again.");
                    Thread.Sleep(2000);
                }
            }
        }