Ejemplo n.º 1
0
        public void GetCampgroundsTest()
        {
            List <CampGround> result = new List <CampGround>();

            CampGroundSqlDAL campgrounds = new CampGroundSqlDAL(connectionString);

            result = campgrounds.GetCampGrounds(1);

            Assert.AreEqual(3, result.Count);
        }
Ejemplo n.º 2
0
        public void GetParkInfo(Park park)
        {
            const string command_ViewCampgrounds   = "1";
            const string command_SearchReservation = "2";
            const string command_ReturnToPrevious  = "3";

            CampGroundSqlDAL  campground     = new CampGroundSqlDAL(connectionString);
            List <CampGround> allCampgrounds = campground.GetCampGrounds(park.ParkId);

            Console.Clear();
            Console.WriteLine("{0, -10}", park.Name);
            Console.WriteLine("Location: {0, -10}", park.Location);
            Console.WriteLine("Established: " + park.EstablishDate.ToString("MM/dd/yyyy"));
            Console.WriteLine("Area: {0:n0} sq km", park.Area);
            Console.WriteLine("Annual Visitors: {0:n0}", park.Visitors);
            Console.WriteLine();
            Console.WriteLine(park.Description);
            Console.WriteLine();
            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();
            string command = Console.ReadLine();

            switch (command.ToLower())
            {
            case command_ViewCampgrounds:
                ViewCampGrounds(park.ParkId);
                break;

            case command_SearchReservation:
                SearchReservation(park.ParkId, command);
                break;

            case command_ReturnToPrevious:
                ViewParks();
                break;

            default:
                Console.WriteLine("The command provided was not a valid command, please try again.");

                break;
            }
        }
Ejemplo n.º 3
0
        public void ViewCampGrounds(int parkId)
        {
            const string command_SearchReservation = "1";
            const string command_ReturnToPrevious  = "2";

            CampGroundSqlDAL  campground     = new CampGroundSqlDAL(connectionString);
            List <CampGround> allCampgrounds = campground.GetCampGrounds(parkId);

            Console.Clear();
            Console.WriteLine("{0,-11}{1,-25}{2,-10}{3,-10}{4, -10}", " ", "Name", "Open", "Close", "Daily Fee");
            foreach (CampGround item in allCampgrounds)
            {
                Console.WriteLine("#{0,-10}{1,-25}{2,-10}{3,-10}${4,-10:0.00}", item.CampgroundId, item.Name, item.OpenFrom, item.OpenTo, item.DailyFee);
                Console.WriteLine();
            }
            Console.WriteLine("Select a Command");
            Console.WriteLine("1) Search for Available Reservations");
            Console.WriteLine("2) Return to Parks");
            Console.WriteLine();
            string command = Console.ReadLine();

            Console.WriteLine();

            switch (command.ToLower())
            {
            case command_SearchReservation:
                SearchReservation(parkId, command);

                break;

            case command_ReturnToPrevious:
                ViewParks();
                break;

            default:
                Console.WriteLine("The command provided was not a valid command, please try again.");

                break;
            }
        }