// GET: Survey/Index
        public ActionResult Index()
        {
            SurveyEntry survey = new SurveyEntry();

            survey.ParkList = dalPark.GetAllParks();
            return(View("Index", survey));
        }
        //startup for first menu
        public void Run()
        {
            while (true)
            {
                PrintHeader();
                PrintMainMenu();

                string command = Console.ReadLine();

                if (command.ToUpper() == "Q")
                {
                    return;
                }
                try
                {
                    Console.Clear();
                    int          parkID = int.Parse(command);
                    IList <Park> parks  = parkDAO.GetAllParks();

                    Park selectedPark = parkDAO.GetInfo(parkID);

                    PrintSelectedPark(selectedPark);
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine("Please select valid park");
                }
            }
        }
예제 #3
0
        public ActionResult SurveyResult()
        {
            ISurveyDAO surveyDAO = new SurveySqlDAO(connectionString);

            ViewBag.Parks = parkDAO.GetAllParks();
            IList <Survey> posts = surveyDAO.GetAllPosts();

            return(View(posts));
        }
예제 #4
0
        public IActionResult Index()
        {
            List <Park> parks = ParkDAO.GetAllParks();
            ParkListVM  vm    = new ParkListVM()
            {
                Parks = parks
            };

            return(View(vm));
        }
        public IActionResult Survey()
        {
            SurveyVM     surveyVM       = new SurveyVM();
            IList <Park> parks          = parkDAO.GetAllParks();
            SelectList   parkSelectList = new SelectList(parks, "ParkCode", "ParkName");

            surveyVM.ParkDropdown = parkSelectList;

            ViewData["States"] = states;
            return(View(surveyVM));
        }
예제 #6
0
        public IActionResult Survey()
        {
            SurveyForm survey = new SurveyForm();

            survey.Parks = parkDAO.GetAllParks();
            return(View(survey));
        }
예제 #7
0
        private bool PrintMainMenu()
        {
            Console.WriteLine("Select a Park for Further Details");
            Console.WriteLine();

            IList <Park> allParks = parkDAO.GetAllParks();

            foreach (Park park in allParks)
            {
                Console.WriteLine($"{park.ParkId}) {park.Name}");
            }

            Console.WriteLine("0 - Quit");
            Console.WriteLine();


            int parkSelection = CLIHelper.GetInteger("Select park number to display more information");

            if (parkSelection == 0)
            {
                return(false);
            }
            foreach (Park park in allParks)
            {
                if (park.ParkId == parkSelection)
                {
                    PrintParkInfoMenu(park);
                    return(true);
                }
            }

            Console.WriteLine("you gave an incorrect park id");
            Console.ReadLine();
            return(true);
        }
예제 #8
0
        protected override void SetMenuOptions()
        {
            foreach (Park park in ParkDAO.GetAllParks())
            {
                this.menuOptions.Add($"{park.ParkId}", park.Name);
            }

            this.menuOptions.Add("Q", "Quit program");
        }
예제 #9
0
        private void ListAllParks()
        {
            IList <Park> parks = parkDAO.GetAllParks();

            foreach (Park park in parks)
            {
                Console.WriteLine(park);
            }
        }
예제 #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parkDAO">DAO for parks table/param>
 /// <param name="campgroundDAO">DAO for campgrounds table</param>
 /// <param name="siteDAO">DAO for sites table</param>
 /// <param name="reservationDAO">DAO for reservations table</param>
 public ViewParksMenu(IParkDAO parkDAO, ICampgroundDAO campgroundDAO, ISiteDAO siteDAO, IReservationDAO reservationDAO) :
     base(parkDAO, campgroundDAO, siteDAO, reservationDAO)
 {
     this.Title = "*** Select a Park for further Details ***";
     parks      = parkDAO.GetAllParks();
     for (int i = 0; i < parks.Count; i++)
     {
         this.menuOptions.Add((i + 1).ToString(), parks[i].Name);
     }
     this.menuOptions.Add("Q", "Quit");
 }
        public ActionResult Index()
        {
            //if (Session["fahrenheitOrCelsius"] as string == null)
            //{
            //    Session["fahrenheitOrCelsius"] = "fahrenheit";
            //}

            List <Park> parks = parkDAO.GetAllParks();

            return(View(parks));
        }
예제 #12
0
        /// <summary>
        /// The override of ExecuteSelection handles whatever selection was made by the user.
        /// This is where any business logic is executed.
        /// </summary>
        /// <param name="choice">"Key" of the user's menu selection</param>
        /// <returns></returns>
        protected override bool ExecuteSelection(string choice)
        {
            switch (choice)
            {
            case "1":     // Display all parks with summary information
                ObjectListViews.DisplayParksDetailedView(parkDAO.GetAllParks());
                Pause("");
                return(true);

            case "2":     // Display all the campgrounds at a selected national park by calling DisplayCampgroundByPark method
                DisplayCampgroundsByPark();
                Pause("");
                return(true);

            case "3":     // Create and show the reservation sub-menu
                ReservationMenu rm = new ReservationMenu(parkDAO, campgroundDAO, siteDAO, reservationDAO);
                rm.Run();
                return(true);
            }
            return(true);
        }
        public Dictionary <string, string> GetParkCodesAndNames()
        {
            IList <Park> parks = pdao.GetAllParks();

            Dictionary <string, string> namesAndCodes = new Dictionary <string, string>();

            foreach (Park park in parks)
            {
                namesAndCodes[park.ParkName] = park.ParkCode;
            }

            return(namesAndCodes);
        }
        private IList <Park> ViewParksListMenu()
        {
            IList <Park> parksList = parkDAO.GetAllParks();

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Select a Park for Further Details:");
            for (int i = 0; i < parksList.Count; i++)
            {
                Console.WriteLine($"{i+1}) {parksList[i].Name}");
            }
            Console.WriteLine();
            Console.WriteLine("Q) - Quit");

            return(parksList);
        }
예제 #15
0
        public ViewParksMenu(ICampgroundDAO campground, IParkDAO park, IReservationDAO reservation) : base()
        {
            this.campgroundDAO  = campground;
            this.parkDAO        = park;
            this.reservationDAO = reservation;
            this.parkList       = park.GetAllParks();


            this.Title = "Select a park for further details";
            int i = 1;

            foreach (Park currentPark in parkList)
            {
                this.menuOptions.Add(i.ToString(), currentPark.Name);
                i++;
            }
            this.menuOptions.Add("Q", "Quit");
        }
예제 #16
0
 //this is the main mnu running
 public void Run()
 { //While running, if this is still true, execute (will always be tue because we said so)
     while (true)
     {
         // Ilist is the interface list and parks is the parks table from sql as a c# list
         // this returns a list that is the table from sql uing the get all parks method we created in parksqldao
         IList <Park> parks = parkDAO.GetAllParks();
         //DONE make this prettier
         Console.WriteLine("Select a park for further details:");
         //This is wriiten at the top of the menu when it is run
         for (int i = 1; i <= parks.Count; i++)
         { // for each element in the list starting at index 1, write the index number, park in the index minus
             // one because indexes start at  and our list starts at 1
             Console.WriteLine($"\t{i}) {parks[i - 1].Name}");
         }
         // this is option 0 to exit the menu
         Console.WriteLine("\t0) Exit");
         // this feeds the length of the parks list GetValidSelection method making sure it's and integer
         // and assigns it to user selection
         int userSelection = GetValidSelection(parks.Count);
         // if user selection is equal to 0, write the message, wait 3 seconds and return aka close
         if (userSelection == 0)
         {
             Console.WriteLine("Thank you, come again :)");
             Thread.Sleep(3000);
             return;
         }
         // this subtracts 1 from the user selection to lign up with the list index element bc it starts at 0
         userSelection--;
         // this is the run park info method below using the user's input
         RunParkInfoMenu(parks[userSelection]);
         // This clears the console
         Console.Clear();
         //Console.ReadLine();
     }
 }
예제 #17
0
 public IActionResult Index()
 {
     return(View(parkDAO.GetAllParks()));
 }
예제 #18
0
 public ActionResult Survey()
 {
     Session["ParkCodesAndNames"] = parkDAO.GetAllParks();
     return(View());
 }
예제 #19
0
        public IActionResult Index()
        {
            IList <Park> model = parkDao.GetAllParks();

            return(View(model));
        }
예제 #20
0
        public IActionResult Index()
        {
            IList <Park> parks = parkDAO.GetAllParks();

            return(View(parks));
        }
예제 #21
0
        /// <summary>
        /// Runs the national park reservation system
        /// </summary>
        public void Run()
        {
            //Get the list of parks from the database
            IList <Park> parks = parkDAO.GetAllParks();

            //The loop which keeps us in the menu system until you quit
            while (true)
            {
                //Displaying the main menu
                string mMInput = mainMenu.DisplayMenu(parks);

                //The check for a command to quit
                if (mMInput.ToLower() == "q")
                {
                    break;
                }

                //Converting the user's input into a specific park object
                int  parkID   = int.Parse(mMInput);
                Park userPark = parks[parkID - 1];

                //The loop which keeps us in the park info menu
                while (true)
                {
                    //Get the list of campgrounds in the park
                    IList <Campground> campgrounds = campgroundDAO.GetAllCampgroundsByPark(parkID);

                    //Display the park info menu
                    int pIInput = parkInfoMenu.DisplayMenu(userPark);

                    //Declaring the variable for input from the campground menu here so it persists outside the if statement where we visit that menu
                    int pCInput = 0;

                    //If the input on the park info menu is 1 we go to the campgrounds menu
                    if (pIInput == 1)
                    {
                        //Displaying the campgrounds menu
                        pCInput = parkCampgrounds.DisplayMenu(userPark, campgrounds);
                    }

                    //If you choose "Search for a Reservation" on either the park info or campground menu
                    if (pIInput == 2 || pCInput == 1)
                    {
                        //Creating a list that will store the the available sites
                        IList <Site> sites = new List <Site>();

                        //Creating a variable to store information returned from the "Display Menu" method of the reservation menu
                        int      campgroundID       = 0;
                        DateTime requestedStart     = new DateTime(1753, 01, 01);
                        DateTime requestedEnd       = new DateTime(1753, 01, 01);
                        bool     makeReservation    = true;
                        var      reservationRequest = (campground : campgroundID, from : requestedStart, to : requestedEnd, keepGoing : makeReservation);

                        //A boolean to control when we break out of these nested while loops
                        bool looper = false;

                        //The loop which keeps us in the Reservation Menu's display menu method
                        do
                        {
                            //Making sure this is false whenever we start the loop
                            looper = false;

                            //Displayinng the reservation menu
                            reservationRequest = reservationMenu.DisplayMenu(userPark, campgrounds); Campground thisCampground = new Campground();

                            //Making sure the requested stay is within the open season of the campground
                            if (reservationRequest.campground != 0)
                            {
                                //Getting this specific campground we are looking at
                                List <Campground> camps = new List <Campground>(campgrounds.Where(c => c.ID == reservationRequest.campground));
                                thisCampground = camps[0];

                                if (reservationRequest.from.Month < thisCampground.OpeningMonth || reservationRequest.to.Month > thisCampground.ClosingMonth)
                                {
                                    //Changing the control variable so we stay in this loop
                                    looper = true;
                                    //Displaying the out of range message
                                    reservationMenu.DateOutOfRange();
                                }
                            }

                            //Where we break if the user chooses to cancel
                            if (reservationRequest.keepGoing == false)
                            {
                                //changing the control variable so we return to the top menu
                                looper = true;
                                break;
                            }

                            //retreiving the list of available sites
                            sites = siteDAO.GetAvailableSites(parkID, reservationRequest.campground, reservationRequest.from, reservationRequest.to);
                            if (sites.Count == 0)
                            {
                                //changing the control variable
                                looper = true;

                                //telling the user there were no sites available and checking their choice of whther or not to continue
                                if (!reservationMenu.NoSitesAvailable())
                                {
                                    break;
                                }
                            }
                        } while (looper);

                        //If we display the make reservation menu
                        if (!looper)
                        {
                            //Creating a variable to store information returned from the "make reservation" method of the reservsation menu
                            int    selectedSite  = 0;
                            string camperName    = "";
                            bool   pressOnward   = true;
                            var    camperAndSite = (site : selectedSite, camper : camperName, keepGoing : pressOnward);

                            //Displaying the make reservation menu
                            camperAndSite = reservationMenu.MakeReservation(sites, campgrounds, reservationRequest);

                            //where we allow the user to quit
                            if (camperAndSite.keepGoing == false)
                            {
                                break;
                            }

                            //turning the user's input into a reservation object
                            Reservation newReservation = new Reservation();
                            newReservation.SiteID    = camperAndSite.site;
                            newReservation.Name      = camperAndSite.camper;
                            newReservation.StartDate = reservationRequest.from;
                            newReservation.EndDate   = reservationRequest.to;

                            //Storing the reservation in the database and returning the reservztion id
                            int reservationID = reservationDAO.MakeReservation(newReservation);

                            //Displaying the confirmation message
                            reservationMenu.ConfirmReservation(reservationID);
                            break;
                        }
                    }
                    //The input for return to previous screen
                    else if (pIInput == 3)
                    {
                        break;
                    }
                    //The choice for looking at upcoming reservations
                    else if (pCInput == 2)
                    {
                        //Displaying the upcoming reservations
                        parkCampgrounds.ShowReservations(reservationDAO.GetReservations(userPark));
                    }
                }
            }
        }
예제 #22
0
        // GET: Park
        public ActionResult Index()
        {
            List <Park> parks = dal.GetAllParks();

            return(View("Index", parks));
        }
        /// <summary>
        /// Helper method to perform the reservation search and prompt user for additional input
        /// </summary>
        private void ReservationSearch()
        {
            // Display a list of all parks for the user to choose from
            IList <Park> parks = parkDAO.GetAllParks();

            ObjectListViews.DisplayParksSingleLine(parks);

            // Prompt the user to select a valid park
            int parkId = GetValidInteger("Please choose a park to view available campgrounds: ", Validators.GetValidParkIds(parks));

            // Get and display a list of campgrounds at the selected park
            IList <Campground> campgrounds = campgroundDAO.GetCampgroundsByParkId(parkId);

            ObjectListViews.DisplayCampgrounds(campgrounds);

            // Prompt user to choose a valid campground if the user selects 0 cancel the transaction and return to the reservation menu
            int campgroundId = GetValidInteger("Choose a campground (Select 0 to cancel): ", Validators.GetValidCampgroundIds(campgrounds));

            if (campgroundId == 0)
            {
                return;
            }

            // Prompt the user to enter an arrival and departure date and store them and then calculate the total number of days of the stay
            DateTime startDate = GetDateTime("Please enter an arrival date: ");
            DateTime endDate   = GetDateTimeAfterDate("Please enter a departure date: ", startDate);
            int      numDays   = (int)((endDate - startDate).TotalDays);

            // Ask the user if they would like to perform an advanced search
            bool isAdvancedSearch = GetBool("Would you like to perform an advanced search (y/n): ");

            // Create a list to hold the results of the search
            IList <Site> sites = new List <Site>();

            // If the user selected to perform an advanced search get additional parameters, then build a list of sites matching search criteria
            if (isAdvancedSearch)
            {
                int  maxOccupancyRequired = GetInteger("What is the max occupancy required: ");
                bool isAccessible         = GetBool("Do you need a weelchair accessible site (y/n): ");
                int  rvSizeRequired       = GetInteger("What size RV parking is required (Enter 0 for no RV): ");
                bool isHookupRequired     = GetBool("Do you need utility hookups (y/n): ");
                sites = siteDAO.GetAvailableSites(campgroundId, startDate, endDate, maxOccupancyRequired, isAccessible, rvSizeRequired, isHookupRequired);
            }
            else
            {
                sites = siteDAO.GetAvailableSites(campgroundId, startDate, endDate);
            }

            // Check if the search returned any results and print a message indicating no results or a list showing matching results
            if (sites.Count == 0)
            {
                Console.WriteLine();
                Console.WriteLine("Sorry but no matching results were found for your search, returning to reservation menu.");
                return;
            }
            else
            {
                ObjectListViews.DisplayCampSites(sites, campgroundDAO.GetAllCampgrounds(), campgroundId, numDays);
            }

            // Prompt the user to choose a valid site to reserve allow the user to select 0 to cancel the reservation
            int siteNumber = GetValidInteger("Select a site that you want to reserve (enter 0 to cancel):", Validators.GetValidSiteNumber(sites));

            if (siteNumber == 0)
            {
                return;
            }

            // Prompt the user for a name to book the reservation under
            string name = GetString("Enter the name for the reservation: ");

            // Make the reservation and return to the user a confirmation number or error message if the booking was unsuccesful
            Reservation newReservation = reservationDAO.MakeReservation(siteNumber, campgroundId, name, startDate, endDate);

            if (newReservation == null)
            {
                Console.WriteLine();
                Console.WriteLine("Sorry but there was an error with your reservation, returning to the reservation menu.");
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine();
                Console.WriteLine($"The reservation has been made and the confirmation id is {newReservation.ReservationId}.");
                ObjectListViews.DisplaySingleReservation(newReservation);
                Console.WriteLine();
            }

            return;
        }
예제 #24
0
        public IActionResult Index()
        {
            var park = parkDAO.GetAllParks();

            return(View("Index", park));
        }
예제 #25
0
        public void ParkMenu()
        {
            const int Command_ViewCampgrounds   = 1;
            const int Command_SearchReservation = 2;
            const int Command_AdvancedMenu      = 3;
            const int Command_ReturnToPrevious  = 4;
            bool      isValidInput = false;

            Console.WriteLine("National Parks\n");
            IList <Park> parks = parkDAO.GetAllParks();

            foreach (Park park in parks)
            {
                Console.WriteLine($" {park.ID} - {park.Name}");
            }
            int choice = 0;

            while (!isValidInput)
            {
                choice       = CLIHelper.GetInteger("Please choose a park: ");
                isValidInput = VerifyIntChoice(choice, parks.Count);
                if (!isValidInput)
                {
                    Console.WriteLine("That's not a valid choice, please try again...");
                }
            }

            Park chosenPark = parks.Where(park => park.ID == choice).FirstOrDefault();

            Console.Clear();
            while (true)
            {
                Console.WriteLine(chosenPark);
                PrintParkMenu();
                isValidInput = false;
                int userInput = 0;
                while (!isValidInput)
                {
                    userInput    = CLIHelper.GetInteger("Please enter a command: ");
                    isValidInput = VerifyIntChoice(userInput, 4);
                    if (!isValidInput)
                    {
                        Console.WriteLine("That's not a valid command, please try again...");
                    }
                }
                switch (userInput)
                {
                case Command_ViewCampgrounds:
                    Console.Clear();
                    ViewCampgrounds(chosenPark);
                    break;

                case Command_SearchReservation:
                    Console.Clear();
                    SearchAvailableSitesForReservations(chosenPark);
                    break;

                case Command_AdvancedMenu:
                    Console.Clear();
                    AdvancedMenu(chosenPark);
                    break;

                case Command_ReturnToPrevious:
                    Console.Clear();
                    return;

                default:
                    Console.WriteLine("That's not a valid choice...");
                    break;
                }
            }
        }