public void ViewAllParks_Successful()
        {
            ParkSqlDAL testClass = new ParkSqlDAL(connectionString);
            Park       newPark   = new Park();

            newPark.ParkName = "Acadia";

            testClass.GetParkInfo(newPark.ParkName);
        }
        public void GetParkInfoTest()
        {
            Park       test       = new Park();
            string     name       = "Fun Park";
            ParkSqlDAL parkSqlDAL = new ParkSqlDAL();

            test = parkSqlDAL.GetParkInfo(name);
            Assert.IsNotNull(test);
            Assert.AreEqual("Fun Park", test.Name);
        }
        private void DisplayParkInfo()
        {
            ParkSqlDAL dal = new ParkSqlDAL(DatabaseConnection);
            Park       p   = dal.GetParkInfo(parkID);

            Console.WriteLine("Park Information Screen");
            Console.WriteLine(p.Name);
            Console.WriteLine("Location: ".PadRight(20) + p.Location);
            Console.WriteLine("Established: ".PadRight(20) + p.EstablishDate);
            Console.WriteLine("Area: ".PadRight(20) + p.Area);
            Console.WriteLine("Annual Visitors: ".PadRight(20) + p.Visitors + "\n");
            Console.WriteLine(p.Description + "\n");
        }
        /// <summary>
        /// Once a park is selected, goes to the data base and gets all the data
        /// for the park, its campgrounds and its sites.
        /// This data shouldn't change super frequently.
        /// </summary>
        /// <param name="park"></param>
        private void GetAllInfo(Park park)
        {
            ParkSqlDAL parkDAL = new ParkSqlDAL(DatabaseConnection);

            parkDAL.GetParkInfo(park);

            CampgroundSqlDAL campgroundDAL = new CampgroundSqlDAL(DatabaseConnection);

            campgroundDAL.GetCampgroundInfo(park);

            SiteSqlDAL siteDAL = new SiteSqlDAL(DatabaseConnection);

            siteDAL.GetSiteInfo(park);
        }
Beispiel #5
0
        public void CMDMenu(int parkChoice)
        {
            ParkSqlDAL parkSql = new ParkSqlDAL(connectionString);
            Park       park    = parkSql.GetParkInfo(parkChoice);
            string     cmdChoice;
            bool       done = false;

            Console.WriteLine("\n" + park.ToString() + "\n");

            while (!done)
            {
                Console.WriteLine();
                Console.Write($"Select a Command" +
                              $"\n\t1) View Campgrounds" +
                              $"\n\t2) Search for Reservation" +
                              $"\n\t3) Return to Previous Screen" +
                              $"\n\tChoice: ");
                cmdChoice = Console.ReadLine();

                while (cmdChoice != "1" && cmdChoice != "2" && cmdChoice != "3")
                {
                    Console.Write("Please enter a valid selection: ");
                    cmdChoice = Console.ReadLine();
                    Console.WriteLine();
                }

                if (cmdChoice == "1")
                {
                    Console.WriteLine();
                    PrintAllCampgrounds();
                }
                else if (cmdChoice == "2")

                {
                    SearchMenu();
                }
                else if (cmdChoice == "3")
                {
                    ParkMenu();
                }
            }
        }
        public void CMDMenu(int parkChoice)
        {
            ParkSqlDAL parkSql = new ParkSqlDAL(connectionString);
            Park       park    = parkSql.GetParkInfo(parkChoice);
            string     cmdChoice;
            bool       done = false;

            Console.WriteLine("\n" + park.ToString() + "\n");

            while (!done)
            {
                Console.WriteLine();
                Console.Write($"Select a Command" +
                              $"\n\t1) View Campgrounds" +
                              $"\n\t2) Search for Reservation" +
                              $"\n\t3) Return to Previous Screen" +
                              $"\n\tChoice: ");
                cmdChoice = Console.ReadLine();

                switch (cmdChoice)
                {
                case "1":
                    Console.WriteLine();
                    PrintAllCampgrounds();
                    break;

                case "2":
                    SearchMenu();
                    done = true;
                    break;

                case "3":
                    ParkMenu();
                    return;

                default:
                    Console.Write("Please enter a valid selection: ");
                    break;
                }
            }
        }
Beispiel #7
0
        private Park GetPark_View(int chosenPark)
        {
            Console.Clear();
            ParkSqlDAL dal  = new ParkSqlDAL(DatabaseConnection);
            Park       park = dal.GetParkInfo(chosenPark);

            if (park.Name == string.Empty || park.Name == null)
            {
                return(park);
            }

            Console.WriteLine($"[{park.Name}]");
            this.PrintInfo("Location", park.Location);
            this.PrintInfo("Established", park.EstablishedDate.ToShortDateString());
            this.PrintInfo("Area", park.Area.ToString("#,# sq km"));
            this.PrintInfo("Annual Visitors", park.AnnualVisitorCount.ToString("#,#"));
            Console.WriteLine();
            Console.WriteLine(park.Description);
            Console.WriteLine();
            return(park);
        }
        private Park GetParkInfo(string parkName)
        {
            ParkSqlDAL dal  = new ParkSqlDAL(DatabaseConnection);
            Park       park = dal.GetParkInfo(parkName);

            if (park != null)
            {
                Console.WriteLine(park.ParkName + " National Park");
                Console.WriteLine("Location:" + "\t" + park.Location);
                Console.WriteLine("Established:" + "\t" + park.EstDate.ToString("MM/dd/yyyy"));
                Console.WriteLine($"Area: {park.Area:###,###,##0} sq km");
                Console.WriteLine($"Annual Visitors: {park.Visitors:###,###,##0}");
                Console.WriteLine();
                Console.WriteLine(park.Description);
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine("**** NO RESULTS ****");
                Console.WriteLine();
            }
            return(park);
        }
Beispiel #9
0
        public void DisplayParkInformation(string name)
        {
            ParkSqlDAL parkSqlDAL = new ParkSqlDAL();
            Park       park       = parkSqlDAL.GetParkInfo(name);

            Console.WriteLine();
            PrintTitleScreen("Park Information Screen");
            Console.WriteLine("Name:".PadRight(17) + park.Name);
            Console.WriteLine("Location:".PadRight(17) + park.Location);
            Console.WriteLine("Established:".PadRight(17) + park.EstablishDate.ToString("yyyy-MM-dd"));
            Console.WriteLine("Area:".PadRight(17) + park.Area.ToString("N0") + (" acres"));
            Console.WriteLine("Annual Visitors:".PadRight(17) + park.AnnualVisitorCount.ToString("N0"));
            Console.WriteLine("Description:".PadRight(17));
            List <string> description = ReformatLargeText(park.Description);

            for (int i = 0; i < description.Count; i++)
            {
                if (i == 0)
                {
                    Console.WriteLine(description[i]);
                }
                Console.WriteLine(description[i]);
            }
        }
Beispiel #10
0
        public void GetParkInfo()
        {
            // Arrange
            ParkSqlDAL dal = new ParkSqlDAL(ConnectionString);
            int        ID  = 0;

            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                conn.Open();
                SqlCommand    command = new SqlCommand("SELECT park_id FROM park", conn);
                SqlDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    ID = Convert.ToInt32(reader["park_id"]);
                }
            }


            // Act
            Park test = dal.GetParkInfo(ID);

            // Assert
            Assert.AreEqual(250000, test.AnnualVisitorCount);
        }