public void SelectPark() { // Prompt user for park, and have the ParkSQLDAL return the relevant park(s) and their information. string userPark = CLIHelper.GetString("Please select the Park Name: "); ParkSQLDAL dal = new ParkSQLDAL(DatabaseConnection); List <Park> foundParks = dal.FindPark(userPark); // Display park information, if valid if (foundParks.Count > 0) { foreach (Park p in foundParks) { Console.WriteLine("Park Name: " + p.ToString()); Console.WriteLine("Park Location: " + p.ParkLocation); Console.WriteLine("Park Area: " + p.ParkArea.ToString("N0") + " sq km"); Console.WriteLine("Establish Date: " + p.ParkEstablishDate.ToString("y")); Console.WriteLine("Annual Visitors: " + p.VisitorCount.ToString("N0") + "\n"); Console.WriteLine(p.ParkDescription); } } else { Console.WriteLine("No Results Found."); } // Open submenu where user can search for and book reservations, or back out to main menu DisplayParkSubMenu(foundParks[0]); }
public void GetParkInformationTest() { ParkSQLDAL parkDAL = new ParkSQLDAL(connectionString); Park park = parkDAL.GetParkInformation(1); Assert.IsNotNull(park); }
// GET: Home public ActionResult Home() { IParkDAL dal = new ParkSQLDAL(connectionString); List <Park> result = dal.GetAllParks(); return(View(result)); }
// GET: Home public ActionResult Index() { ParkSQLDAL sql = new ParkSQLDAL(); List <Park> allParks = sql.GetAllParks(); return(View("Index", allParks)); }
public void GetParksTest() { ParkSQLDAL park = new ParkSQLDAL(connectionString); List <Park> parks = park.GetAllParks(); Assert.IsNotNull(parks); }
public void PrintParkInformation(int parkID) { ParkSQLDAL dal = new ParkSQLDAL(DatabaseConnection); Park park = dal.GetParkInformation(parkID); if (park.Location != null || park.Description != null) { Console.WriteLine(); Console.WriteLine("Park Information Screen"); Console.WriteLine(); Console.WriteLine(park.ParkName); Console.WriteLine("Location:".PadRight(30) + park.Location); Console.WriteLine("Established:".PadRight(30) + park.EstablishedDate.ToShortDateString()); Console.WriteLine("Area:".PadRight(30) + park.AreaInAcres.ToString("#,###") + " Acres"); Console.WriteLine("Annual Visitors:".PadRight(30) + park.AnnualVisitors.ToString("#,###")); Console.WriteLine(); Console.WriteLine(park.Description); Console.WriteLine(); } else { Console.WriteLine(); Console.WriteLine("Invalid Input. Press enter to continue."); Console.WriteLine(); Console.ReadLine(); Console.WriteLine(); } }
public void GetParksTest() { ParkSQLDAL dal = new ParkSQLDAL(connectionString); List <Park> parksList = dal.GetParks(); Assert.IsNotNull(parksList); Assert.IsTrue(parksList.Count > 0); }
public void FindParkTest() { ParkSQLDAL dal = new ParkSQLDAL(connectionString); List <Park> parksList = dal.FindPark(parkName); Assert.IsNotNull(parksList); Assert.IsTrue(parksList.Count > 0); Assert.AreEqual(parkName, parksList[0].ParkName); }
private void GetAllParksLongDisplay() { ParkSQLDAL dal = new ParkSQLDAL(connectionString); List <Park> parks = dal.GetAllParksWithFullDescription(); foreach (var park in parks) { Console.WriteLine(park); } }
public void TestGetParksDate() { //Arrange ParkSQLDAL parkDAL = new ParkSQLDAL(connectionString); //Act int numberAllParkByDate = parkDAL.GetAllParksByDate(DateTime.Now, DateTime.Now, 1).Count; //Assert Assert.AreEqual(numberParksByDateOutPut, numberAllParkByDate); }
public void GetAllParks() { //Arrange ParkSQLDAL parkDAL = new ParkSQLDAL(connectionString); //Act int parkCount = parkDAL.GetAllParksShortened().Count; //Assert Assert.IsNotNull(parkCount); Assert.AreEqual(numberOfParks, parkCount); }
private void GetAllParksShortDisplay() { ParkSQLDAL dal = new ParkSQLDAL(connectionString); List <Park> parks = dal.GetAllParksShortened(); Console.WriteLine(); Console.WriteLine(); foreach (var park in parks) { Console.WriteLine(park.ParkID + "- " + park.Name); } }
public void GetParks() { ParkSQLDAL dal = new ParkSQLDAL(DatabaseConnection); List <Park> parks = dal.GetParks(); if (parks.Count > 0) { for (int i = 0; i < parks.Count; i++) { Console.WriteLine("--" + parks[i].ToString()); } } else { Console.WriteLine("No results."); } }
// GET: Park public ActionResult Detail(string id) { ParkSQLDAL dal = new ParkSQLDAL(); Park detailedPark = dal.DetailPark(id); Park isCelsius = Session["isCelsius"] as Park; if (isCelsius == null) { Park celsiusCheck = new Park(); Session["isCelsius"] = celsiusCheck; return(View("Detail", detailedPark)); } if (isCelsius.IsCelsius) { return(View("DetailCelsius", detailedPark)); } return(View("Detail", detailedPark)); }
public ActionResult TemperatureChange() { if (Request["temperatureType"] != null) { if (Request["temperatureType"] == "Celsius") { Session["temperatureType"] = "Celsius"; } else { Session["temperatureType"] = "Fahrenheit"; } } IParkDAL dal = new ParkSQLDAL(connectionString); List <Park> result = dal.GetAllParks(); return(View("Home", result)); }
public void PrintAllParks() { ParkSQLDAL dal = new ParkSQLDAL(DatabaseConnection); List <Park> parks = dal.GetAllParks(); if (parks.Count > 0) { foreach (Park park in parks) { Console.WriteLine($"{park.ParkID}) {park.ParkName}"); } Console.WriteLine(); Console.WriteLine("Q) quit"); Console.WriteLine(); } else { Console.WriteLine("NO RESULTS"); } }
//GET: public ActionResult DailySurvey() { IParkDAL dal = new ParkSQLDAL(connectionString); List <Park> parkNames = dal.GetAllParks(); List <SelectListItem> parks = new List <SelectListItem>(); foreach (Park p in parkNames) { parks.Add(new SelectListItem { Text = p.ParkName, Value = p.ParkCode }); } ViewBag.ParkNames = parks; ViewBag.ActivityLevels = activityLevel; ViewBag.StateNames = states; return(View()); }
public void PrintParkMenu(int parkID) { bool done = false; int userInput = 0; while (!done) { ParkSQLDAL dal = new ParkSQLDAL(DatabaseConnection); Park park = dal.GetParkInformation(parkID); if (park.Location != null || park.Description != null) { PrintParkInformation(parkID); Console.WriteLine("Select a Command"); Console.WriteLine("1) View Campgrounds"); Console.WriteLine("2) Search For Reservation"); Console.WriteLine("3) Return to Previous Screen"); Console.WriteLine(); Console.Write("Selection: "); try { userInput = int.Parse(Console.ReadLine()); } catch (Exception) { userInput = 0; } switch (userInput) { case 1: PrintCampgrounds(parkID); PrintCampgroundMenu(parkID); break; case 2: SearchForReservation(parkID); break; case 3: done = true; break; default: Console.WriteLine(); Console.WriteLine("Invalid Input. Press enter to continue."); Console.WriteLine(); Console.ReadLine(); Console.WriteLine(); break; } } else { Console.WriteLine(); Console.WriteLine("Invalid Input. Press enter to continue."); Console.WriteLine(); Console.ReadLine(); Console.WriteLine(); done = true; } } }
//GET: public ActionResult DetailPage() { Park result = new Park(); if (!string.IsNullOrEmpty(Request["parkCode"])) { IParkDAL dal = new ParkSQLDAL(connectionString); result = dal.GetParkDetails(Request["parkCode"]); } foreach (Forecast f in result.FiveDayForecasts) { switch (f.WeatherForecast) { case "snow": f.ForecastAdvice += "Please pack snowshoes."; break; case "rain": f.ForecastAdvice += "Please pack raingear and wear weatherproof shoes!"; break; case "thunderstorms": f.ForecastAdvice += "Please seek shelter and avoid hiking on exposed ridges."; break; case "sunny": f.ForecastAdvice += "Please pack sunblock. Only you can prevent forest fires."; break; } if (f.HighTemperature > 75) { f.ForecastAdvice += " Please bring an extra gallon of water."; } if (f.LowTemperature < 20) { f.ForecastAdvice += " Danger, frigid temperatures!"; } if (f.HighTemperature - f.LowTemperature >= 20) { f.ForecastAdvice += " Please wear breathable layers."; } if (f.WeatherForecast != "partly cloudy") { f.ImagePath = "/Content/img/weatherimages/" + f.WeatherForecast + ".png"; } else { f.ImagePath = "/Content/img/weatherimages/partlycloudy.png"; } if (Session["temperatureType"] != null) { if (Session["temperatureType"].ToString() == "Celsius") { f.LowTemperature = (int)((f.LowTemperature - 32) * .5556); f.HighTemperature = (int)((f.HighTemperature - 32) * .5556); } } } return(View(result)); }
public SurveyController(ParkSQLDAL parkSqlDAL, SurveySqlDAL surveySqlDAL) { this.parkSqlDAL = parkSqlDAL; this.surveySqlDAL = surveySqlDAL; }
public HomeController(ParkSQLDAL parkDAL, WeatherSQLDAL weatherDAL) { this.parkDAL = parkDAL; this.weatherDAL = weatherDAL; }