示例#1
0
        public void DisplaySitesInfo(Campground campground)
        {
            Console.Clear();

            ParkSqlDAL  campSitesDal = new ParkSqlDAL(_dbConnectionString);
            List <Site> sites        = campSitesDal.GetSites(campground.CampgroundId);

            Console.WriteLine();
            Console.WriteLine(" " + campground.CampgroundName + " Camp Site Information");
            Console.WriteLine();
            Console.WriteLine(" {0,0} {1,15} {2,15} {3,15} {4,15}", "Site #", "Max Occupancy", "Accessibility", "Max RV Length", "Utilities");
            Console.WriteLine();

            for (int index = 0; index < sites.Count; index++)
            {
                string siteInfo = sites[index].SiteNumber.ToString() + ") " +
                                  " " + sites[index].MaxOccupancy.ToString().PadLeft(10) +
                                  " " + sites[index].AccessibilityStr.PadLeft(15) +
                                  " " + sites[index].MaxRvLength.ToString().PadLeft(15) +
                                  " " + sites[index].UtilitiesStr.PadLeft(20);

                if (sites[index].SiteNumber <= 9)
                {
                    Console.WriteLine("  " + siteInfo);
                }
                else
                {
                    Console.WriteLine(" " + siteInfo);
                }
            }
        }
        public void RequestReservationMenu(Campground campground)
        {
            Console.Clear();

            ParkSqlDAL  campSitesDal = new ParkSqlDAL(_dbConnectionString);
            List <Site> sites        = campSitesDal.GetSites(campground.CampgroundId);

            //display site info
            Console.WriteLine();
            Console.WriteLine(" " + campground.CampgroundName + " Camp Site Information");
            Console.WriteLine();
            Console.WriteLine(" {0,0} {1,15} {2,15} {3,15} {4,15}", "Site #", "Max Occupancy", "Accessibility", "Max RV Length", "Utilities");
            Console.WriteLine();

            for (int index = 0; index < sites.Count; index++)
            {
                if (sites[index].SiteNumber <= 9)
                {
                    Console.WriteLine("  " + sites[index].SiteNumber.ToString() + ") " +
                                      " " + sites[index].MaxOccupancy.ToString().PadLeft(10) +
                                      " " + sites[index].AccessibilityStr.PadLeft(15) +
                                      " " + sites[index].MaxRvLength.ToString().PadLeft(15) +
                                      " " + sites[index].UtilitiesStr.PadLeft(20));
                }
                else
                {
                    Console.WriteLine(" " + sites[index].SiteNumber.ToString() + ") " +
                                      " " + sites[index].MaxOccupancy.ToString().PadLeft(10) +
                                      " " + sites[index].AccessibilityStr.PadLeft(15) +
                                      " " + sites[index].MaxRvLength.ToString().PadLeft(15) +
                                      " " + sites[index].UtilitiesStr.PadLeft(20));
                }
            }

            int selectedCampground = campground.CampgroundId;

            Park park = new Park();

            park.ParkId = campground.ParkId;

            bool exit = false;

            while (!exit)
            {
                Console.WriteLine();
                Console.WriteLine(" C - Return to Campgrounds Menu");
                Console.WriteLine(" N - Create new reservation");
                Console.WriteLine(" Q - Quit");
                Console.WriteLine();
                Console.Write(" Select an option... ");

                string command = Console.ReadLine();

                if (command == "n" || command == "N")
                {
                    Console.WriteLine();
                    CreateReservation(campground);
                }
                else if (command == "c" || command == "C")
                {
                    Console.WriteLine();
                    DisplayCampgroundInfo(park);
                }
                else if (command == "q" || command == "Q")
                {
                    DisplayQuitApplication();
                    exit = true;
                }
                else
                {
                    DisplayInvalidRequest();
                }

                Console.ReadKey();
                Console.Clear();
            }
        }