コード例 #1
0
        private void AdvancedSearchGetSitesCLI(Campground campground, DateTime userArrivalDate, DateTime userDepartureDate)
        {
            //int numberOfCampers, bool needAccessible, int rvLength, bool needUtilities
            int  numberOfCampers = CLIHelper.GetInteger("Please enter the number of peoples");
            bool needAccessible  = CLIHelper.GetBoolCustom("Will you need your site to have handicap access?", "yes", "no");
            bool usingRV         = CLIHelper.GetBoolCustom("Will you be using an RV?", "yes", "no");
            int  rvLength        = 0;

            if (usingRV)
            {
                rvLength = CLIHelper.GetInteger("Please enter the length of your RV (ft)");
            }
            bool needUtilities = CLIHelper.GetBoolCustom("Will you need your site to have utility access?", "yes", "no");

            SiteDAL siteDAL = new SiteDAL(DatabaseConnection);

            List <Site> sites            = siteDAL.GetTopFiveAvailableSitesAdvancedSearch(campground, userArrivalDate, userDepartureDate, numberOfCampers, needAccessible, rvLength, needUtilities);
            bool        finishedWithMenu = false;

            while (!finishedWithMenu)
            {
                string input = DisplaySitesAndGetUserInput(sites, campground, userArrivalDate, userDepartureDate);

                Console.WriteLine();
                //Using user input
                if (input.ToLower() == "r")
                {
                    finishedWithMenu = true;
                }
                else if (input.ToLower() != "r" && input != "zzz")
                {
                    MakeReservationCLI(campground, int.Parse(input), userArrivalDate, userDepartureDate);
                }
                finishedWithMenu = true;
            }
        }