/// <summary> /// Gets available parks, displays info, and allows selection of campgrounds and sites /// </summary> private void GetSelectedParkInformation() //newest menu { GetAllCampgrounds(); List <Park> result = ParkObject.GetAvailableParks(); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("{0, 10}{1, 18}{2, 28}{3, 25}{4, 25}", "Park Name", "Location", "Date Established", "Total Area", "Annual Visitors"); Console.WriteLine("----------------------------------------------------------------------------------------------------------"); bool exit = false; while (!exit) { if (Parks.ContainsKey(_command)) { string area = Convert.ToDecimal(Parks[_command].Area).ToString("#,##0 sq km"); string visitors = Convert.ToDecimal(Parks[_command].Visitors).ToString("#,##0"); string date = Parks[_command].EstablishDate.ToString("MM/dd/yyyy"); Console.Write("{0, 10}{1, 15}{2, 28}{3, 25}{4, 25}", Parks[_command].Name, Parks[_command].Location, date, area, visitors); Console.WriteLine("\n" + Parks[_command].Description + "\n"); Console.WriteLine(""); exit = true; } else { Console.WriteLine("Not a valid entry. Please try again."); } ParkReservation(); } }
/// <summary> /// Prints out all available parks for user /// </summary> private void GetAllParks() { List <Park> result = ParkObject.GetAvailableParks(); Console.WriteLine("{0, 10}{1, 18}{2, 28}{3, 25}{4, 25}", "Park Name", "Location", "Date Established", "Total Area", "Annual Visitors"); Console.WriteLine("----------------------------------------------------------------------------------------------------------"); foreach (var item in result) { string area = Convert.ToDecimal(item.Area).ToString("#,##0 sq km"); string visitors = Convert.ToDecimal(item.Visitors).ToString("#,##0"); string date = item.EstablishDate.ToString("MM/dd/yyyy");; Console.Write("{0, 0}{1, 10}{2, 15}{3, 28}{4, 25}{5, 25}", item.ID + ")", item.Name, item.Location, date, area, visitors); Console.WriteLine("\n" + item.Description + "\n"); } Console.Write("Press any key to return to Main Menu"); Console.ReadKey(); Console.Clear(); }