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]);
        }
Пример #2
0
        public void GetParkInformationTest()
        {
            ParkSQLDAL parkDAL = new ParkSQLDAL(connectionString);
            Park       park    = parkDAL.GetParkInformation(1);

            Assert.IsNotNull(park);
        }
Пример #3
0
        // 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));
        }
Пример #5
0
        public void GetParksTest()
        {
            ParkSQLDAL  park  = new ParkSQLDAL(connectionString);
            List <Park> parks = park.GetAllParks();

            Assert.IsNotNull(parks);
        }
Пример #6
0
        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();
            }
        }
Пример #7
0
        public void GetParksTest()
        {
            ParkSQLDAL  dal       = new ParkSQLDAL(connectionString);
            List <Park> parksList = dal.GetParks();

            Assert.IsNotNull(parksList);
            Assert.IsTrue(parksList.Count > 0);
        }
Пример #8
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);
        }
Пример #9
0
        private void GetAllParksLongDisplay()
        {
            ParkSQLDAL  dal   = new ParkSQLDAL(connectionString);
            List <Park> parks = dal.GetAllParksWithFullDescription();

            foreach (var park in parks)
            {
                Console.WriteLine(park);
            }
        }
Пример #10
0
        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);
        }
Пример #11
0
        public void GetAllParks()
        {
            //Arrange
            ParkSQLDAL parkDAL = new ParkSQLDAL(connectionString);

            //Act
            int parkCount = parkDAL.GetAllParksShortened().Count;

            //Assert
            Assert.IsNotNull(parkCount);
            Assert.AreEqual(numberOfParks, parkCount);
        }
Пример #12
0
        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));
        }
Пример #15
0
        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));
        }
Пример #16
0
        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");
            }
        }
Пример #17
0
        //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());
        }
Пример #18
0
        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;
                }
            }
        }
Пример #19
0
        //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));
        }
Пример #20
0
 public SurveyController(ParkSQLDAL parkSqlDAL, SurveySqlDAL surveySqlDAL)
 {
     this.parkSqlDAL   = parkSqlDAL;
     this.surveySqlDAL = surveySqlDAL;
 }
 public HomeController(ParkSQLDAL parkDAL, WeatherSQLDAL weatherDAL)
 {
     this.parkDAL    = parkDAL;
     this.weatherDAL = weatherDAL;
 }