private void ChooseDisplayParkInfo() { //this shows park information based on choice tempParkId = CLIHelper.GetInteger("Please enter in the Park ID for more information:"); ParkDAL dal = new ParkDAL(DatabaseConnection); IList <Park> parks = dal.DisplayParkInfo(tempParkId); Console.WriteLine("Park Information:"); Console.WriteLine(); if (parks.Count > 0) { foreach (Park park in parks) { Console.WriteLine(park.Name.ToString() + Environment.NewLine + "Location: " + park.Location + Environment.NewLine + "Established: " + park.EstablishDate.ToShortDateString() + Environment.NewLine + "Area: " + (park.Area.ToString("N0")) + " sq km" + Environment.NewLine + "Annual Vistors: " + park.Visitors.ToString("N0")); Console.WriteLine(); Console.WriteLine(park.Description); Console.WriteLine(); } } else { Console.WriteLine("**** NO RESULTS ****"); } Console.WriteLine(); DisplayParkOptions(); }
private void DisplayParkInfo(Park selectedPark) { int dateRangeSelected = -1; int userInput = 0; Console.WriteLine(); Console.WriteLine("PARK INFORMATION SCREEN"); Console.WriteLine(); //access park info from database ParkDAL dal = new ParkDAL(DatabaseConnection); selectedPark = dal.DisplayParkInfo(selectedPark); Console.WriteLine(selectedPark.Name + " National Park"); Console.WriteLine("State: " + selectedPark.State); Console.WriteLine("Established: " + selectedPark.EstablishYear); Console.WriteLine("Area: " + string.Format("{0:n0}", selectedPark.Area) + " sq km"); Console.WriteLine("Annual Visitors: " + string.Format("{0:n0}", selectedPark.Vistors)); Console.WriteLine(); //word wrap for console display String[] words = selectedPark.Description.Split(' '); StringBuilder buffer = new StringBuilder(); foreach (String word in words) { buffer.Append(word); if (buffer.Length >= Console.WindowWidth) { String line = buffer.ToString().Substring(0, buffer.Length - word.Length); Console.WriteLine(line); buffer.Clear(); buffer.Append(word); } buffer.Append(" "); } Console.WriteLine(buffer.ToString()); Console.WriteLine(); Console.WriteLine("Select a Command:"); Console.WriteLine("1) View Campgrounds in " + selectedPark.Name); Console.WriteLine("2) View Existing Reservations for the Next 30 Days"); Console.WriteLine("3) Make a Reservation"); Console.WriteLine("4) Return to Previous Screen"); userInput = CLIHelper.GetInteger(""); //user input implements corresponding method, default returns to ViewParksMenu() List <Campground> campgroundsInPark = new List <Campground>(); switch (userInput) { case 1: ViewCampgrounds(selectedPark, campgroundsInPark); break; case 2: ViewUpcomingReservations(selectedPark); break; case 3: while (dateRangeSelected == -1) { dateRangeSelected = ChooseCampground(selectedPark, campgroundsInPark, dateRangeSelected); } break; default: Console.WriteLine(); break; } }