Beispiel #1
0
        public void ViewAllIndividualSites(Park park)
        {
            bool exit = false;

            while (!exit)
            {
                Console.Clear();

                Console.WriteLine($"{park.Name} National Park\n");
                Console.WriteLine($"| {"Campground ID".PadRight(15)} | " +
                                  $"| {"Campground Name".PadRight(35)} | " +
                                  $"| {"Month Open".PadRight(10)} | " +
                                  $"| {"Closing Month".PadRight(15)} | " +
                                  $"| {"Daily Fee".PadRight(10)} | ");
                Console.WriteLine(new string('-', 100));

                Dictionary <int, Campground> CampgroundDictionary = _park.GetCampgroundDictionary(park);
                foreach (KeyValuePair <int, Campground> item in CampgroundDictionary)
                {
                    Console.WriteLine($"| {item.Value.CampgroundID.ToString().PadRight(15)} | " +
                                      $"| {item.Value.CampgroundName.PadRight(35)} | " +
                                      $"| {item.Value.DisplayMonthOpen.ToString().PadRight(10)} | " +
                                      $"| {item.Value.DisplayMonthClose.ToString().PadRight(15)} | " +
                                      $"| {item.Value.DailyFee.ToString("C").PadRight(10)} |");
                }

                Console.WriteLine("\n\nWhich campground? Enter a campgroundID or enter 0 to return.");
                var selection = Console.ReadKey().KeyChar.ToString();
                if (selection == "0")
                {
                    Console.Clear();
                    return;
                }
                try
                {
                    int                    sel            = int.Parse(selection);
                    Campground             camp           = CampgroundDictionary[sel];
                    Dictionary <int, Site> SiteDictionary = _park.GetSiteDictionary(CampgroundDictionary[sel]);
                    Console.Clear();
                    Console.WriteLine($"| {"Site Number".PadRight(15)} | " +
                                      $"| {"Max Occup.".PadRight(15)}" +
                                      $"| {"Accessible?".PadRight(15)} | " +
                                      $"| {"Max RVLength".PadRight(15)} | " +
                                      $"| {"Utility".PadRight(15)} | " +
                                      $"| {"Cost".PadRight(15)} ");
                    Console.WriteLine(new string('-', 100));
                    foreach (KeyValuePair <int, Site> item in SiteDictionary)
                    {
                        Console.WriteLine($"| {item.Value.SiteNumber.ToString().PadRight(15)} | " +
                                          $"| {item.Value.MaxOccupancy.ToString().PadRight(15)}" +
                                          $"| {item.Value.Accessible.ToString().PadRight(15)} | " +
                                          $"| {item.Value.MaxRVLength.ToString().PadRight(15)} | " +
                                          $"| {item.Value.Utilities.ToString().PadRight(15)} | " +
                                          $"| {item.Value.TotalFee.ToString("C").PadRight(15)}");
                    }
                    Console.WriteLine("Press any key to return");
                    Console.ReadKey();
                    Console.Clear();
                }
                catch
                {
                    Console.WriteLine(") Please only enter a valid selection.");
                    Console.ReadKey();
                    Console.Clear();
                }
            }
        }
Beispiel #2
0
        public void ViewAllIndividualSites(Park park)
        {
            bool exit = false;

            while (!exit)
            {
                Console.Clear();

                Console.WriteLine($"{park.Name} National Park\n");
                Console.WriteLine($"| {"Campground ID".PadRight(15)} | " +
                                  $"| {"Campground Name".PadRight(35)} | " +
                                  $"| {"Month Open".PadRight(10)} | " +
                                  $"| {"Closing Month".PadRight(15)} | " +
                                  $"| {"Daily Fee".PadRight(10)} | ");
                Console.WriteLine(new string('-', 100));

                Dictionary <int, Campground> CampgroundDictionary = _park.GetCampgroundDictionary(park);
                foreach (KeyValuePair <int, Campground> item in CampgroundDictionary)
                {
                    Console.WriteLine($"| {item.Value.CampgroundID.ToString().PadRight(15)} | " +
                                      $"| {item.Value.CampgroundName.PadRight(35)} | " +
                                      $"| {item.Value.DisplayMonthOpen.ToString().PadRight(10)} | " +
                                      $"| {item.Value.DisplayMonthClose.ToString().PadRight(15)} | " +
                                      $"| {item.Value.DailyFee.ToString("C").PadRight(10)} |");
                }
                int selection = NationalPark.GetInteger("Enter a campground by ID to view details for all of its sites, or enter 0 to return.");
                if (selection == 0)
                {
                    exit = true;
                }
                else if (CampgroundDictionary.ContainsKey(selection))
                {
                    Campground             camp           = CampgroundDictionary[selection];
                    Dictionary <int, Site> SiteDictionary = _park.GetSiteDictionary(CampgroundDictionary[selection]);
                    Console.Clear();
                    Console.WriteLine($"| {"Site Number".PadRight(15)} | " +
                                      $"| {"Max Occup.".PadRight(15)}" +
                                      $"| {"Accessible?".PadRight(15)} | " +
                                      $"| {"Max RVLength".PadRight(15)} | " +
                                      $"| {"Utility".PadRight(15)} | " +
                                      $"| {"Cost".PadRight(15)} ");
                    Console.WriteLine(new string('-', 100));
                    foreach (KeyValuePair <int, Site> item in SiteDictionary)
                    {
                        Console.WriteLine($"| {item.Value.SiteNumber.ToString().PadRight(15)} | " +
                                          $"| {item.Value.MaxOccupancy.ToString().PadRight(15)}" +
                                          $"| {item.Value.Accessible.ToString().PadRight(15)} | " +
                                          $"| {item.Value.MaxRVLength.ToString().PadRight(15)} | " +
                                          $"| {item.Value.Utilities.ToString().PadRight(15)} | " +
                                          $"| {item.Value.TotalFee.ToString("C").PadRight(15)}");
                    }
                    Console.WriteLine("Press any key to return");
                    Console.ReadKey();
                }
                else
                {
                    Console.WriteLine("Please only enter a valid campgroundID number");
                    Console.ReadKey();
                }
            }
        }