public void setPractice(string location)
 {
     if (DataSearching.practiceExists(location))
     {
         practice = DataSearching.findPractice(location);
     }
 }
        /**
         * gets a valid practice.
         */
        private string getValidLocation()
        {
            bool   validLocation = false;
            string location      = "";

            do
            {
                location = GeneralFunctions.getOptionalInput("Location: ", true, DataPrinting.printPractices); //requests a location from a user, while printing the list of practices out.

                if (location != "")                                                                            //If location is not null
                {
                    if (DataSearching.practiceExists(location))                                                //Check the pratice provided exsists.
                    {
                        validLocation = true;                                                                  //Changes bool value, marks given location is valid.
                    }
                    else
                    {
                        Console.WriteLine("Invalid Location");
                    }
                }
                else
                {
                    validLocation = true;
                }
            }while (!validLocation); //While valid location is false, run loop.

            return(location);
        }
        /**
         * Shows the staff manager allowing admins to assign staff to locations.
         */
        private void showStaffMgr()
        {
            string response;
            bool   inMenu;

            try
            {
                inMenu = true;
                do
                {
                    DataPrinting.printPractices(); //Find practices and show them
                    Console.Write("Location to manage: (enter empty location to exit)");
                    response = Console.ReadLine();
                    Console.Clear();

                    if (response == "")
                    {
                        inMenu = false;
                    }
                    else if (DataSearching.practiceExists(response))          //Checks if practice exsists with given practice
                    {
                        managePractice(DataSearching.findPractice(response)); //finds practice based on given response
                    }
                    else
                    {
                        Console.WriteLine("Location does not exist.");
                    }
                }while (inMenu);
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
        }
        /**
         * Shows the room editor.
         */
        private void showRoomEditor()
        {
            bool           inMenu;
            string         response = "";
            DentalPractice practiceToAddRoom;

            try
            {
                inMenu = true;

                while (inMenu)
                {
                    DataPrinting.printPractices();
                    Console.WriteLine("Practice to add room to: (Leave blank to cancel)");
                    response = Console.ReadLine();
                    Console.Clear();

                    if (response != "")
                    {
                        if (DataSearching.practiceExists(response))                   //uses response to find the practices that are a valid response
                        {
                            practiceToAddRoom = DataSearching.findPractice(response); // takes response and gets pratice with the given response and location
                            addRoomToPractice(practiceToAddRoom);                     //run method to add practice
                        }
                        else
                        {
                            Console.WriteLine("Practice does not exist.");
                        }
                    }
                    else
                    {
                        inMenu = false;
                    }
                }
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
        }
        /**
         * Provides an interface allowing admin to Remove a room.
         */
        private void removeRoom()
        {
            string         response;
            int            responseInt;
            bool           inMenu;
            bool           invalidResponse;
            DentalPractice practiceToRemoveFrom;
            TreatmentRoom  roomToRemove;

            try
            {
                inMenu = true;

                while (inMenu)
                {
                    DataPrinting.printPractices();
                    Console.Write("Practice to remove room from: (leave blank to cancel)");
                    response = Console.ReadLine();
                    Console.Clear();

                    if (response != "")
                    {
                        if (DataSearching.practiceExists(response))                      //Checks for valid user response
                        {
                            practiceToRemoveFrom = DataSearching.findPractice(response); //Gets practice with given ID
                            invalidResponse      = true;

                            while (inMenu && invalidResponse)
                            {
                                DataPrinting.printRoomsAtPractice(practiceToRemoveFrom); //Shows all rooms in the given practice
                                Console.Write("Select room to remove: (leave blank to cancel)");
                                response = Console.ReadLine();
                                Console.Clear();

                                if (response != "")
                                {
                                    if (int.TryParse(response, out responseInt))                                     //Converts value to int as responseInt
                                    {
                                        if (responseInt > 0 && responseInt <= practiceToRemoveFrom.getRooms().Count) //Checking if response is greater than 0 or less than or equal the given amount of rooms.
                                        {
                                            roomToRemove = practiceToRemoveFrom.getRooms()[responseInt - 1];
                                            deleteRoom(roomToRemove, true); //Removes the room
                                        }
                                        else
                                        {
                                            Console.WriteLine("Invalid room");
                                        }
                                    }
                                    else
                                    {
                                        Console.WriteLine("Enter a number.");
                                    }
                                }
                                else
                                {
                                    invalidResponse = false;//Breaks loop
                                }
                            }
                        }
                        else
                        {
                            Console.WriteLine("Practice not found.");
                        }
                    }
                    else
                    {
                        inMenu = false;
                    }
                }
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
        }
        /**
         * Shows the room managing interface.
         */
        private void showRoomMgr()
        {
            string response;
            int    responseInt;
            bool   inMenu;

            DentalPractice       practice;
            List <TreatmentRoom> rooms;

            try
            {
                inMenu = true;
                bool invalidPractice;
                bool invalidRoom;

                while (inMenu)
                {
                    invalidPractice = true;
                    while (invalidPractice && inMenu)  //Selecting a location and room.
                    {
                        DataPrinting.printPractices(); //Show practices
                        Console.Write("Practice: (leave blank to cancel)");
                        response = Console.ReadLine();
                        Console.Clear();

                        if (response == "")
                        {
                            inMenu = false;                              //if blank, allows loop to break.
                        }
                        else if (DataSearching.practiceExists(response)) //Checks if it is a valid response
                        {
                            invalidPractice = false;
                            invalidRoom     = true;

                            practice = DataSearching.findPractice(response); //Gets practice with given ID
                            rooms    = practice.getRooms();                  //Gets list of rooms

                            while (invalidRoom && inMenu)                    //Selecting a room
                            {
                                DataPrinting.printRoomsAtPractice(practice); //Prints rooms based on practice location
                                Console.WriteLine("Room to manage: (leave blank to cancel)");
                                response = Console.ReadLine();

                                if (response == "")
                                {
                                    invalidRoom = false;
                                }
                                if (int.TryParse(response, out responseInt))
                                {
                                    if (responseInt > 0 && responseInt <= rooms.Count)
                                    {
                                        manageRoom(rooms[responseInt - 1]); //Brings up interface for managing a room. indexing rooms list -1.
                                    }
                                }
                            }
                        }
                        else
                        {
                            Console.WriteLine("Location not found");
                        }
                    }
                }
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
        }