}//MainMenu

        private int MainMenuDisplayAllParks()
        {
            int numberOfParks = 0;

            FlowerLine();

            ParkDAL      parkDal = new ParkDAL(DatabaseConnection);
            IList <Park> parks   = parkDal.GetAllParks();

            numberOfParks = parks.Count;

            if (numberOfParks > 0)
            {
                foreach (Park park in parks)
                {
                    Console.WriteLine(park.ToString());
                }
            }
            else //no parks returned
            {
                Console.WriteLine("**** NO RESULTS ****");
            }

            return(numberOfParks);
        }//DisplayAll
        public List <Park> GetAllParks()
        {
            ParkDAL dal = new ParkDAL(DatabaseConnectionString);

            List <Park> parks = dal.GetAllParks();

            return(parks);
        }
Пример #3
0
        public List <Park> PrintAllParks()
        {
            ParkDAL     dal     = new ParkDAL();
            List <Park> parks   = dal.GetAllParks();
            int         counter = 1;

            foreach (Park park in parks)
            {
                Console.WriteLine(counter + ")" + " " + park.Name);
                counter++;
            }
            Console.WriteLine("0) Quit Program");
            return(parks);
        }
Пример #4
0
        public void ParkInformation(string parkId)
        {
            ParkDAL          thisPark     = new ParkDAL(connectionString);
            List <ParkModel> parkInfoList = thisPark.GetAllParks();

            Console.WriteLine("Park Information");

            for (int i = 0; i < parkInfoList.Count; i++)//loops through to build park information from park model
            {
                if (parkId == parkInfoList[i].ParkId.ToString())
                {
                    Console.WriteLine(parkInfoList[i].ParkName + " National Park");
                    Console.WriteLine("Location:" + parkInfoList[i].ParkLocation.PadLeft(20));
                    Console.WriteLine("Established:".PadRight(24) + parkInfoList[i].ParkEstablishDate.Date.ToShortDateString());
                    Console.WriteLine("Area:" + parkInfoList[i].Area.ToString().PadLeft(24) + " sq km");
                    Console.WriteLine("Annual Visitors:" + parkInfoList[i].Visitors.ToString().PadLeft(15));
                    Console.WriteLine();
                    WrapText(parkInfoList[i].ParkDescription);
                }
            }
        }
        private void DisplayParks()
        {  //this diplays all of the parks in the DB
            ParkDAL      dal   = new ParkDAL(DatabaseConnection);
            IList <Park> parks = dal.GetAllParks();

            Console.WriteLine("PARK LISTING" + Environment.NewLine);
            Console.WriteLine(("").PadRight(5) + ("Park ID").PadRight(10) + ("Name").PadRight(5));
            if (parks.Count > 0)
            {
                foreach (Park park in parks)
                {
                    Console.WriteLine((park.Rownumber.ToString()).PadRight(5) + park.ParkId.ToString().PadRight(10) + (park.Name).PadRight(30));
                }
            }
            else
            {
                Console.WriteLine("**** NO RESULTS ****");
            }
            Console.WriteLine();
            Console.WriteLine("Q".PadRight(5) + "Quit");
            Console.WriteLine();
            ChooseDisplayParkInfo();
        }
Пример #6
0
        public void ParkMenu()
        {
            ParkDAL          allParks      = new ParkDAL(connectionString);
            List <ParkModel> compiledParks = allParks.GetAllParks();//creates list of parks for menu

            Console.WriteLine("Select a Park for Further Details ");

            for (int i = 0; i < compiledParks.Count; i++)//loops through the list to display each park name in database
            {
                Console.WriteLine($"{compiledParks[i].ParkId}) {compiledParks[i].ParkName}");
            }
            Console.WriteLine($"Press Q to Quit");
            Console.WriteLine();
            string parkId = Console.ReadLine();

            foreach (ParkModel item in compiledParks)//loop to check if user input matches park id
            {
                if (parkId.ToLower() == "q")
                {
                    Environment.Exit(0);
                }
                else if (parkId != item.ParkId.ToString())
                {
                    //Console.WriteLine("Please Select Valid Option");
                    //Console.ReadLine();
                    //Console.Clear();
                    //SEE IF YOU CAN FIGURE OUT HOW TO NOT WRITE THSI MESSAGE 10000 TIMES
                    //Console.WriteLine("Please make a valid selection ");
                }
                else
                {
                    Console.Clear();
                    ParkInformationMenu(parkId);
                }
            }
        }