/**
         * Prints patients at the given practice.
         */
        public static void printPatients(DentalPractice practice)
        {
            List <Patient> patients = practice.getPatients();

            try
            {
                for (int i = 0; i < patients.Count; i++)
                {
                    Console.WriteLine($"{patients[i].getId()}: {patients[i].getName()} - {patients[i].getContactNo()}\n{patients[i].getAddress()}\n"); //writes patient information from the desired practice
                }
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
        }
Esempio n. 2
0
        /**
         * Prints patients at the given practice.
         */
        public static void printPatients(DentalPractice practice)
        {
            List <Patient> patients = practice.getPatients();

            try
            {
                for (int i = 0; i < patients.Count; i++)
                {
                    Console.WriteLine($"{patients[i].getId()}: {patients[i].getName()}");
                }
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
        }
        /**
         * Gets all appointments at a given location.
         */
        public static List <Appointment> getAppointments(DentalPractice practice)
        {
            List <Patient>     patients     = practice.getPatients();    //Gets the patients within the practice/s
            List <Appointment> appointments = new List <Appointment>();; //Creates a list to store appointments.

            try
            {
                for (int i = 0; i < patients.Count; i++)                  //iterates on patients
                {
                    appointments.AddRange(patients[i].getAppointments()); //Adds all appointments for the patient to the appointments list. //addrange takes one list and adds another list to it
                }
            }
            catch (Exception e)
            {
                GeneralFunctions.errorHandler(e);
            }
            return(appointments);
        }
 /**
  * gets a patient with the given id and given practice.
  */
 public static Patient findPatient(DentalPractice practice, string id)
 {
     return(practice.getPatients().Find(patient => patient.getId() == id)); //Returns the patient objects with the given patient ID
 }
 /**
  * Checks a patient with the given id exists at the given practice.
  */
 public static bool patientExists(DentalPractice practice, string id)
 {
     return(practice.getPatients().Exists(patient => patient.getId() == id)); //Checks if a patient at the given location with the given id exists.
 }