/// <summary> /// Reserve site /// </summary> /// <param name="availSites"></param> /// <returns></returns> private int SelectSite(List <SiteItem> availSites) { bool isAvailSite = false; int siteSelection = 0; while (!isAvailSite) { siteSelection = CLIHelper.GetInt("Which site should be reserved (enter 0 to cancel) "); if (siteSelection == 0) { isAvailSite = true; } foreach (var site in availSites) { if (siteSelection.Equals(site.SiteNumber)) { siteSelection = site.Id; isAvailSite = true; break; } } } return(siteSelection); }
/// <summary> /// Displays available campgrounds /// </summary> /// <param name="campgrounds"></param> private void SearchForCampgroundReservation(List <CampgroundItem> campgrounds) { bool exit = false; while (!exit) { Console.WriteLine("Campgrounds: "); Console.WriteLine(); DisplayCampgrounds(campgrounds); Console.WriteLine(); int campgroundSelection = CLIHelper.GetInt("Which campground (enter 0 to cancel)? "); if (campgroundSelection == 0) { exit = true; } else if (campgroundSelection > 0 || campgroundSelection <= campgrounds.Count) { int campgroundIdValue = campgrounds[campgroundSelection - 1].Id; (DateTime arrival, DateTime departure) = CLIHelper.GetValidReservationWindow(); DisplayAvailableSites(campgroundIdValue, arrival, departure); } else { DisplayInvalidOption(); } } }
/// <summary> /// Displays information about each park /// </summary> private void ParkInfoMenu() { bool exit = false; while (!exit) { Console.Clear(); Console.WriteLine("Park Information\n"); Console.WriteLine(_selectedPark.Name + "\n"); Console.WriteLine("Location:".PadRight(17) + _selectedPark.Location); Console.WriteLine("Established:".PadRight(17) + _selectedPark.EstablishedDate); Console.WriteLine("Area:".PadRight(17) + _selectedPark.Area); Console.WriteLine("Annual Visitors:".PadRight(17) + _selectedPark.Visitors); Console.WriteLine(); Console.WriteLine("\n" + _selectedPark.Description + "\n"); Console.WriteLine("Select a command"); Console.WriteLine(); Console.WriteLine("1)".PadLeft(6) + " View Campgrounds"); Console.WriteLine("2)".PadLeft(6) + " Search for Reservation"); Console.WriteLine("3)".PadLeft(6) + " See Booked Reservations (next 30 days) for this park"); // Bonus Console.WriteLine("4)".PadLeft(6) + " Return to Previous Screen"); int selection = CLIHelper.GetInt(""); switch (selection) { case 1: CampgroundMenu(); break; case 2: DisplayEntireParkAvailability(); break; case 3: Display30DayReservationsByPark(); break; case 4: exit = true; break; default: DisplayInvalidOption(); break; } } }
/// <summary> /// Campground Menu page /// </summary> private void CampgroundMenu() { bool exit = false; while (!exit) { Console.Clear(); Console.WriteLine("Park Campgrounds"); Console.WriteLine(_selectedPark.Name); Console.WriteLine(); List <CampgroundItem> campgrounds = _db.GetCampgroundItemsByPark(_selectedPark.Id); DisplayCampgrounds(campgrounds); Console.WriteLine(); Console.WriteLine("Select a command"); Console.WriteLine(); Console.WriteLine("1)".PadLeft(6) + " Search for Available Reservation"); Console.WriteLine("2)".PadLeft(6) + " Return to Previous Screen"); int selection = CLIHelper.GetInt("Selection: "); switch (selection) { case 1: SearchForCampgroundReservation(campgrounds); break; case 2: exit = true; break; default: DisplayInvalidOption(); break; } } }
/// <summary> /// Reserve campground /// </summary> /// <param name="availCampgrounds"></param> /// <returns></returns> private int SelectCampground(List <CampgroundItem> availCampgrounds) { bool isAvailSite = false; int cgSelection = 0; while (!isAvailSite) { cgSelection = CLIHelper.GetInt("Which campground should be reserved (enter 0 to cancel) "); if (cgSelection == 0) { isAvailSite = true; } foreach (var campground in availCampgrounds) { if (cgSelection.Equals(campground.Id)) { isAvailSite = true; break; } } } return(cgSelection); }