/// <summary> /// Sets menu options of List of parks /// </summary> protected override void SetMenuOptions() { List <Park> parks = parkDAO.GetParks(); foreach (Park park in parks) { this.menuOptions.Add(park.Id.ToString(), park.Name); } this.menuOptions.Add("Q", "Quit"); }
public IActionResult Index() { //Get a list of parks for the select list in the view. IList <Park> parks = parkDAO.GetParks(); SurveyResultVM vm = new SurveyResultVM(); vm.Parks = new SelectList(parks, "ParkCode", "ParkName"); //Return the view. return(View(vm)); }
protected override void SetMenuOptions() { List <Park> viewParks = parkDAO.GetParks(); int Count = 1; foreach (Park park in viewParks) { menuOptions.Add(Count.ToString(), park.parkName); Count++; } this.menuOptions.Add("Q", "Quit program"); }
protected override void SetMenuOptions() { List <Park> parks = ParkDAO.GetParks(); foreach (Park park in parks) { menuOptions.Add(park.ParkID.ToString(), park.Name); } this.menuOptions.Add("B", "Back to Main Menu"); this.quitKey = "B"; }
public IActionResult GetParks() { //get parks from database as a list IList <Park> parks = parkDAO.GetParks(); return(View(parks)); }
public IActionResult Index() { //Get a list of all the parks and pass it into the view. IList <Park> parks = parkDAO.GetParks(); return(View(parks)); }
/// <summary> /// Park selection menu /// </summary> private void DisplayParkMenu() { var parks = _db.GetParks(); Dictionary <int, ParkItem> menu = new Dictionary <int, ParkItem>(); bool exit = false; while (!exit) { menu.Clear(); Console.Clear(); DisplayColored("Select a park for further details..."); for (int i = 1; i <= parks.Count; i++) { menu.Add(i, parks[i - 1]); Console.WriteLine($" ({i}) {parks[i - 1].Name}"); } Console.WriteLine(" (R) Reservation History"); Console.WriteLine(" (L) Logout"); Console.WriteLine(); var selection = CLIHelper.GetString(Message_EnterSelection); if (selection.ToLower() == Option_Logout) { _userMgr.LogoutUser(); exit = true; } else if (selection.ToLower() == Option_ReservationHistory) { var reservations = _db.GetReservationsForUserId(_userMgr.User.Id); DisplayReservationHistory(reservations); } else { try { var parkSel = int.Parse(selection); if (menu.ContainsKey(parkSel)) { DisplayParkDetailsMenu(menu[parkSel]); } else { throw new Exception(); } } catch (ExitToMainException) { // do nothing, this is the main menu } catch (Exception e) { CLIHelper.DisplayDebugInfo(e); DisplayInvalidSelection(); } } } }
public IActionResult Index() { // get parks IList <Park> parks = parkDAO.GetParks(); return(View(parks)); }
public void TestGetParks() { List <Park> parks = _db.GetParks(); Assert.AreEqual(10, parks.Count, "Number of parks do not match."); Assert.AreEqual(TEST_PARK_CODE, parks[0].ParkCode, "Park info does not match."); }
private void GetParks(int parkId) { IList <Park> parks = parkDAO.GetParks(newPark.Park_Id); if (parks.Count > 0) { foreach (Park park in parks) { Console.WriteLine("Park Name: " + park.Name.ToString().PadRight(20)); Console.WriteLine("Location: " + park.Location.PadRight(15)); Console.WriteLine("Established: " + park.Establish_Date.ToString().PadRight(12)); Console.WriteLine("Area: " + park.Area.ToString().PadRight(8)); Console.WriteLine("Visitors: " + park.Visitors.ToString().PadRight(10)); Console.WriteLine(); Console.WriteLine("Description: " + park.Description.ToString().PadRight(10)); Console.WriteLine(); } CampgroundMenu(); Console.ReadLine(); } else { Console.WriteLine("**** NO RESULTS ****"); Console.ReadLine(); } }
/// <summary> /// Controls the Home Page view of the parks /// </summary> /// <param name="park">Passing in a paramter of Park</param> /// <returns>Returns a view of the Home Page of parks</returns> public IActionResult Park(Park park) { IList <Park> output = parkDAO.GetParks(); park.AllParks = output; return(View(park)); }
//Constructor to call in IDAO, Generate List using GetParks(), and Create our menu with parks list public ViewParksMenu(IParkDAO parkdao, ICampgroundDAO campgroundDAO, IReservationDAO reservationDAO, ISiteDAO siteDAO) : base() { this.parkdao = parkdao; this.campgroundDAO = campgroundDAO; this.reservationDAO = reservationDAO; this.siteDAO = siteDAO; //parkdao, campgroundDAO, reservationDAO, siteDAO, try { parkList = parkdao.GetParks(); this.Title = "****View Parks****"; for (int i = 0; i < parkList.Count; i++) { this.menuOptions.Add($"{i + 1}", $"{parkList[i].Name}"); } this.menuOptions.Add("Q", "Quit"); } catch (Exception ex) { Console.WriteLine($"There was an error: {ex.Message}"); } }
public IActionResult Index() { IList <Park> parks = dao.GetParks(); ViewData["parks"] = parks; return(View()); }
public IActionResult Index(Park park) { IList <Park> parks = parkDAO.GetParks(); park.Parks = parks; return(View(parks)); }
//Gets the list of parks and displays them for the user to select private void GetParks() { IList <Park> parks = parkDAO.GetParks(); foreach (Park park in parks) { Console.WriteLine($"{park.park_id.ToString()}) - {park.name.PadLeft(5)}"); } }
public void ListParks() { IList <Park> parks = ParkDAO.GetParks(); foreach (Park park in parks) { Console.WriteLine($"{park.Park_Id}) {park.Name}"); } }
private void ListAllParks() { IList <Park> parks = parkDAO.GetParks(); if (parks.Count > 0) { foreach (Park park in parks) { Console.WriteLine($"Park ID\tPark Name"); Console.WriteLine($"{park.ParkId}\t{park.Name} National Park"); Console.WriteLine(); } } else { Console.WriteLine("*****No Results*****"); } }
public ParksMenu(IParkDAO parkDAO, ICampgroundDAO campgroundDAO, IReservationDAO reservationDAO, ISiteDAO siteDAO) : base(parkDAO, campgroundDAO, reservationDAO, siteDAO) { this.Title = "List of park names"; parks = parkDAO.GetParks(); for (int i = 0; i < parks.Count; i++) { this.menuOptions.Add($"{i + 1}", $"{parks[i].Name}"); } this.menuOptions.Add("Q", "Quit"); }
public IActionResult Survey() { string surveyStatus = HttpContext.Session.GetString("SurveyStatus"); ViewBag.SurveyStatus = surveyStatus; ViewBag.Parks = parkDAO.GetParks(); ViewBag.States = states; return(View()); }
private void DisplayParks() { IList <Parks> parks = parkDAO.GetParks(); Console.WriteLine(); Console.WriteLine("Park Information Screen"); Console.WriteLine(); for (int index = 0; index < parks.Count; index++) { Console.WriteLine($"{parks[index].ParkName} National Park"); Console.WriteLine($"Location: {parks[index].Location}"); Console.WriteLine($"Established: {parks[index].EstablishedDate.ToString("yyyy/MM/dd")}"); Console.WriteLine($"Area: {parks[index].Area} sq km"); Console.WriteLine($"Annual Visitors: {parks[index].Visitors}"); Console.WriteLine(); Console.WriteLine($"{parks[index].Description}"); menuSpacer(); } }
public IActionResult Results() { IList <Survey> SurveyResults = surveyDAO.GetSurveyResults(); ResultsView surveyModel = new ResultsView() { AllSurveys = surveyDAO.GetSurveyResults(), AllParks = parkDAO.GetParks(), }; return(View(surveyModel)); //REMOVED "RESULTS" FROM THE RETURN VIEW STATEMENT }
public void TestPark() { var park = CreatePark("Mt. Airy"); var parks = _db.GetParks(); park.Id = _db.AddPark(park); var newParks = _db.GetParks(); Assert.AreEqual(parks.Count + 1, newParks.Count); bool foundPark = false; foreach (var newPark in newParks) { if (newPark.Id == park.Id) { foundPark = true; } } Assert.IsTrue(foundPark); }
private void GetParks() { IList <Park> parks = parkDAO.GetParks(); if (parks.Count > 0) { foreach (Park park in parks) { Console.WriteLine(park.ParkID.ToString().PadRight(10).PadLeft(5) + park.Name.PadRight(40)); } } else { Console.WriteLine("**** NO RESULTS ****"); } }
public void ViewParks() { bool done = false; Console.WriteLine("Select a Park for Further Details:"); Console.WriteLine(); Console.WriteLine("──▒▒▒▒▒▒▒▒───▒▒▒▒▒▒▒▒───▒▒▒▒▒▒▒▒──"); Console.WriteLine("─▒▐▒▐▒▒▒▒▌▒─▒▒▌▒▒▐▒▒▌▒─▒▒▌▒▒▐▒▒▌▒─"); Console.WriteLine("──▒▀▄█▒▄▀▒───▒▀▄▒▌▄▀▒───▒▀▄▒▌▄▀▒──"); Console.WriteLine("─────██─────────██─────────██─────"); Console.WriteLine("░░░▄▄██▄░░░░░░░▄██▄░░░░░░░▄██▄░░░░"); Console.WriteLine(); while (!done) { IList <Park> parks = parkDAO.GetParks(); int count = parks.Count; for (int i = 0; i < parks.Count; i++) { Console.WriteLine($"{i + 1}) {parks[i].Name}"); } Console.WriteLine("Q) quit"); Console.WriteLine(); string select = Console.ReadLine().ToLower(); Console.WriteLine(); if (select == "q") { Environment.Exit(1); } int.TryParse(select, out selectedParkId); done = helper.ParkMenuSelectValid(selectedParkId, count); } ParkDescription(); }
/// <summary> /// Runs the main menu /// </summary> public override void Run() { IList <Park> parks = parkDAO.GetParks(); MainMenuHeader(parks); while (true) { string input = GetString("Make selection here: "); bool isValidPark = false; if (int.TryParse(input, out int choice)) { choice--; isValidPark = IsVaildPark(choice, parks); if (isValidPark) { ParkCLI parkMenu = new ParkCLI(parks[choice], campgroundDAO, siteDAO, reservationDAO); parkMenu.Run(); MainMenuHeader(parks); } else { // TODO write code for failed vaildation Console.WriteLine($"{input} is Not a vaild park, please try again"); Console.CursorTop -= returnToInputLine; } } else if (input.ToLower() == "q") { break; } else { InvalidInput(); } } }
/// <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) { parkList = parkdao.GetParks(); switch (choice) { case "1": ParkInformationMenu parkInfoMenu = new ParkInformationMenu(parkdao, campgroundDAO, reservationDAO, siteDAO, parkList[0]); parkInfoMenu.Run(); return(true); case "2": parkInfoMenu = new ParkInformationMenu(parkdao, campgroundDAO, reservationDAO, siteDAO, parkList[1]); parkInfoMenu.Run(); return(true); case "3": parkInfoMenu = new ParkInformationMenu(parkdao, campgroundDAO, reservationDAO, siteDAO, parkList[2]); parkInfoMenu.Run(); return(true); } return(true); }
protected override void BeforeDisplayMenu() { List <Park> parks = ParkDAO.GetParks(); Park chosenPark = null; foreach (Park park in parks) { if (park.ParkID == chosen) { chosenPark = park; } } PrintHeader(); //Finish adding info with cw's Console.WriteLine($"Name: {chosenPark.Name}"); Console.WriteLine($"Location: {chosenPark.Location}"); Console.WriteLine($"Establised: {chosenPark.EstablishDateString}"); Console.WriteLine($"Area: {chosenPark.Area} sq. km."); Console.WriteLine($"Annual Visitors: {chosenPark.Visitors}"); Console.WriteLine(""); Console.WriteLine(chosenPark.Description); }
/// <summary> /// Main CLI (View Parks Interface) /// </summary> public void RunCLI() { IList <Park> parks = parkDAO.GetParks(); bool invalidCommand = false; while (true) { Console.Clear(); PrintParksHeader(); PrintParksMenu(parks); invalidCommand = PrintInvalidCommand(invalidCommand); string command = Console.ReadLine().ToLower().Trim(); bool validInt = Int32.TryParse(command, out int parkSelection); if (validInt && parkSelection >= 1 && parkSelection <= parks.Count) { RunParkInfoCLI(parks[parkSelection - 1]); } else { switch (command) { case Command_Parks_Quit: Console.Clear(); Console.WriteLine("Thank you for using the National Park Campsite Reservation System!\n"); return; default: invalidCommand = true; break; } } } }
public IActionResult GetParks() { IList <Park> parks = parkDAO.GetParks(); return(View(parks)); }
public IActionResult Index() { SurveyViewModel vm = new SurveyViewModel(); IList <Park> Parks = parkDAO.GetParks(); vm.ParkList = new SelectList(Parks, "ParkCode", "ParkName"); var State = new List <SelectListItem> { new SelectListItem { Text = "Alabama" }, new SelectListItem { Text = "Alaska" }, new SelectListItem { Text = "Arizona" }, new SelectListItem { Text = "Arkansas" }, new SelectListItem { Text = "California" }, new SelectListItem { Text = "Colorado" }, new SelectListItem { Text = "Connecticut" }, new SelectListItem { Text = "Delaware" }, new SelectListItem { Text = "Florida" }, new SelectListItem { Text = "Georgia" }, new SelectListItem { Text = "Hawaii" }, new SelectListItem { Text = "Idaho" }, new SelectListItem { Text = "Illinois" }, new SelectListItem { Text = "Indiana" }, new SelectListItem { Text = "Iowa" }, new SelectListItem { Text = "Kansas" }, new SelectListItem { Text = "Kentucky" }, new SelectListItem { Text = "Louisiana" }, new SelectListItem { Text = "Maine" }, new SelectListItem { Text = "Maryland" }, new SelectListItem { Text = "Massachusetts" }, new SelectListItem { Text = "Michigan" }, new SelectListItem { Text = "Minnesota" }, new SelectListItem { Text = "Mississippi" }, new SelectListItem { Text = "Missouri" }, new SelectListItem { Text = "Montana" }, new SelectListItem { Text = "North Carolina" }, new SelectListItem { Text = "North Dakota" }, new SelectListItem { Text = "Nebraska" }, new SelectListItem { Text = "Nevada" }, new SelectListItem { Text = "New Hampshire" }, new SelectListItem { Text = "New Jersey" }, new SelectListItem { Text = "New Mexico" }, new SelectListItem { Text = "New York" }, new SelectListItem { Text = "Ohio" }, new SelectListItem { Text = "Oklahoma" }, new SelectListItem { Text = "Oregon" }, new SelectListItem { Text = "Pennsylvania" }, new SelectListItem { Text = "Rhode Island" }, new SelectListItem { Text = "South Carolina" }, new SelectListItem { Text = "South Dakota" }, new SelectListItem { Text = "Tennessee" }, new SelectListItem { Text = "Texas" }, new SelectListItem { Text = "Utah" }, new SelectListItem { Text = "Vermont" }, new SelectListItem { Text = "Virginia" }, new SelectListItem { Text = "Washington" }, new SelectListItem { Text = "West Virginia" }, new SelectListItem { Text = "Wisconsin" }, new SelectListItem { Text = "Wyoming" } }; vm.StateList = new SelectList(State, "Text", "Text"); return(View(vm)); }