public void DisplayAvailableSites(Campground campground, string startDate, string endDate) { Console.Clear(); ParkSqlDAL availableSiteDal = new ParkSqlDAL(_dbConnectionString); List <Site> availableSites = availableSiteDal.AvailableSitesToReserve(campground.CampgroundId, startDate, endDate); Console.WriteLine(" Available Sites for " + campground.CampgroundName); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(" {0,0} {1,15} {2,15} {3,15} {4,15}", "Site #", "Max Occupancy", "Accessibility", "Max RV Length", "Utilities"); Console.WriteLine(); bool exit = false; if (availableSites.Count > 0) { DisplaySiteInfoHeader(availableSites); } int selection; Console.Write(" Select a Site... "); string command = Console.ReadLine(); Console.WriteLine(); Console.Write(" Enter a reservation name... "); string reservationName = Console.ReadLine(); while (!exit) { if (availableSites.Count == 0) { Console.WriteLine(); Console.Write(" There are no sites available for " + campground.CampgroundName + "."); Console.Write(" Press any key to exit the application. "); exit = true; } else if (int.TryParse(command, out selection)) { Console.WriteLine(); if (selection > 0 && selection <= availableSites.Count) { int siteID = availableSites[selection - 1].SiteId; availableSiteDal.AddReservation(siteID, startDate, endDate, reservationName); } exit = true; } } Console.ReadKey(); Console.Clear(); }
private void DisplaySubmittedReservationInfo(Campground campground, int siteID, int siteNumber, string startDate, string endDate, string reservationName) { Console.Clear(); ParkSqlDAL reservationDal = new ParkSqlDAL(_dbConnectionString); bool exit = false; while (!exit) { string command = menus.ConfirmedReservationMenu(campground, siteNumber, startDate, endDate, reservationName); Park park = new Park(); park.ParkId = campground.ParkId; if (command == "R" || command == "r") { int result = reservationDal.AddReservation(siteID, startDate, endDate, reservationName); if (result > 0) { DisplayReservationConfirmation(result); } } else if (command == "C" || command == "c") { DisplayCampgroundInfo(park); } else if (command == "M" || command == "m") { DisplayMenu(); } else if (command == "Q" || command == "q") { menus.QuitMenu(); exit = true; } else { menus.InvalidEntry(); } Console.ReadKey(); Console.Clear(); } }