Example #1
0
        public void GetSelectedParkCampgrounds()
        {
            _command = Console.ReadKey().KeyChar.ToString();
            Parks    = ParkObject.GetParkDictionary();
            bool exit = false;

            while (!exit)
            {
                if (Parks.ContainsKey(_command))
                {
                    CampgroundList = ParkObject.GetAvailableCampgroundsFromParks(_command);

                    exit = true;
                }
                else
                {
                    Console.WriteLine("The option provided was not a valid selection, please try again.");
                    _command = Console.ReadKey().KeyChar.ToString();
                }
            }
            Console.Clear();
            Console.WriteLine("{0, 25}{1, 32}{2, 25}{3, 25}",
                              "Campground Name", "Month Open", "Month Closed", "Daily Fee");
            Console.WriteLine("----------------------------------------------------------------------------------------------------------");
            foreach (var item in CampgroundList)
            {
                Console.WriteLine("{0, 2}{1, -25}{2, 25}{3, 25}{4, 25}",
                                  item.ID + ") ", item.Name, item.OpenFrom, item.OpenTo, "$" + item.DailyFee);
            }
        }
Example #2
0
        /// <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();
            }
        }