public void CampgroundMenu() { while (true) { string command = CampCLIHelper.GetUserString("Select a Command"); Console.Clear(); switch (command.ToLower()) { case Command_SearchForAvailableReservation: DisplayCamgrounds(); DisplayMenuAskingUserForDate(); return; case Command_ReturnToParkInfoMenu: DisplayPark(ChosenPark); DisplayParkInformationMenu(); return; default: Console.WriteLine("The command provided was not a valid command, please try again."); break; } DisplayParkInformationMenu(); } }
public void DisplayParks() { List <Park> parkList = new List <Park>(); parkList = parks.GetParks(); int number = 1; foreach (Park park in parkList) { Console.WriteLine(number + ") " + park.Name); number += 1; } Console.WriteLine("Q) Quit"); string userInput = CampCLIHelper.GetUserString("Please select a Park: "); if (userInput.ToLower() == "q") { System.Environment.Exit(0); } else { DisplayPark(userInput); } }
public void DisplayMenuAskingUserForDate() { Console.WriteLine("Which Campground (enter 0 to cancel): "); int campGround = int.Parse(Console.ReadLine()); if (campGround == 0) { DisplayParkCampgroundMenu(); } else { DateTime arrivalDate = CampCLIHelper.GetUserDateTime("What is the arrival date? "); DateTime departureDate = CampCLIHelper.GetUserDateTime("What is the departure date ?"); SiteSqlDAO site = new SiteSqlDAO(ConnectionString); List <Site> listOfSites = site.GetUserInputtedSite(campGround, arrivalDate, departureDate); Console.WriteLine("Site No. Max Occup. Accessible? Max RV Length Utility Cost"); foreach (Site item in listOfSites) { Console.Write(item.SiteID + " "); Console.Write(item.MaxOccupancy + " "); Console.Write(CampCLIHelper.BoolToString(item.Accessible) + " "); Console.Write(CampCLIHelper.NumberToString(item.MaxRvLength) + " "); Console.Write(CampCLIHelper.BoolToString(item.Utilities) + " "); Console.Write(item.Cost.ToString("C2") + " "); Console.WriteLine(); } int sites = CampCLIHelper.GetUserInt("Which site should be reserved (enter 0 to cancel):"); if (sites == 0) { DisplayParkCampgroundMenu(); } else { string name = CampCLIHelper.GetUserString("What name should the reservation be made under ?"); ReservationSqlDAO reservation = new ReservationSqlDAO(ConnectionString); int reservationId = reservation.PlaceReservation(sites, name, arrivalDate, departureDate); Console.WriteLine($"The reservation has been made and the Confirmation id is: {reservationId}"); } } Console.ReadLine(); }