Exemple #1
0
        private void GetAllCampgrounds(Park park)
        {
            IList <Campground> campgrounds = campgroundDAO.GetCampgrounds(park.ParkID);

            while (true)
            {
                Console.WriteLine();
                CampgroundIndex = 0;

                Console.WriteLine("Registered campgrounds");

                if (campgrounds.Count > 0)
                {
                    Console.WriteLine("Please select a campground");
                    Console.WriteLine("          Name".PadRight(50) + "Open".PadRight(15) + "Close".PadRight(15) + "Daily Fee");
                    for (int i = 0; i < campgrounds.Count; i++)
                    {
                        Console.WriteLine($"{CampgroundIndex + 1}.)".PadRight(10) + campgrounds[CampgroundIndex].Name.PadRight(40) + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(campgrounds[CampgroundIndex].Open).PadRight(15) + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(campgrounds[CampgroundIndex].Close).PadRight(15) + campgrounds[CampgroundIndex].DailyFee.ToString("C2"));
                        CampgroundIndex++;
                    }
                    Console.WriteLine($"{CampgroundIndex + 1}.) Select another park");


                    SelectCampground(campgrounds);
                    break;
                }
                else
                {
                    Console.WriteLine("No campgrounds in registry for this park");
                }
            }
        }
Exemple #2
0
        private void GetCampgrounds(int parkId)
        {
            Console.Clear();
            Console.WriteLine("Park Campgrounds");
            Console.WriteLine($"{parksDict[parkId].Name} National Park Campgrounds");
            Console.WriteLine();
            Console.WriteLine($"{"",-18}{"Name", -35}{"Open",-16}{"Close",-16}{"Daily Fee",-15}");
            IList <Campground> camps = campgroundDAO.GetCampgrounds(parkId);

            for (int i = 0; i < camps.Count; i++)
            {
                Console.WriteLine($"#{Convert.ToString(camps[i].Id),-15} {Convert.ToString(camps[i].Name),-35} {CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(camps[i].OpenMonth),-15} {CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(camps[i].CloseMonth),-15} {(camps[i].DailyFee).ToString("C")}");
            }
            Console.WriteLine();
            SelectACommand(2);
        }