Exemplo n.º 1
0
        public static void SearchPatient(List <Patient> patients)
        {
            try
            {
                int     id;
                string  name, mobile;
                Patient patient;

                bool flag = true;
                while (flag)
                {
                    Console.WriteLine("1. Search by ID");
                    Console.WriteLine("2. Search by Name");
                    Console.WriteLine("3. Search by Mobile Number");
                    Console.WriteLine("4. Exit");
                    int choice = Convert.ToInt32(Console.ReadLine());
                    switch (choice)
                    {
                    case 1:
                        Console.Write("Enter Patient ID: ");
                        id      = Convert.ToInt32(Console.ReadLine());
                        patient = CliniqueManagementSearch.SearchPatientByID(patients, id);
                        if (patients == null)
                        {
                            Console.WriteLine("No Data Present.");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("No.\tId\tName\t\tMobile Number");
                            Console.WriteLine(1 + "\t" + patient.PatientID + "\t" + patient.Name + "\t" + patient.Mobile);
                            Console.WriteLine();
                        }
                        break;

                    case 2:
                        Console.Write("Enter Patient Name: ");
                        name    = Console.ReadLine();
                        patient = CliniqueManagementSearch.SearchPatientByName(patients, name);
                        if (patients == null)
                        {
                            Console.WriteLine("No Data Present.");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("No.\tId\tName\t\tMobile Number");
                            Console.WriteLine(1 + "\t" + patient.PatientID + "\t" + patient.Name + "\t" + patient.Mobile);
                            Console.WriteLine();
                        }
                        break;

                    case 3:
                        Console.Write("Enter Patient Mobile Number: ");
                        mobile  = Console.ReadLine();
                        patient = CliniqueManagementSearch.SearchPatientByName(patients, mobile);
                        if (patients == null)
                        {
                            Console.WriteLine("No Data Present.");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("No.\tId\tName\t\tMobile Number");
                            Console.WriteLine(1 + "\t" + patient.PatientID + "\t" + patient.Name + "\t" + patient.Mobile);
                            Console.WriteLine();
                        }
                        break;

                    case 4:
                        flag = false;
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n");
            }
        }
Exemplo n.º 2
0
        public static void SearchDoctor(List <Doctor> doctors)
        {
            try
            {
                int    id;
                string name, specialization, availability;
                Doctor doctor;

                bool flag = true;
                while (flag)
                {
                    Console.WriteLine("1. Search by ID");
                    Console.WriteLine("2. Search by Name");
                    Console.WriteLine("3. Search by Specialization");
                    Console.WriteLine("4. Search by Availability");
                    Console.WriteLine("5. Exit");
                    Console.Write("Enter your choice: ");
                    int choice = Convert.ToInt32(Console.ReadLine());
                    switch (choice)
                    {
                    case 1:
                        Console.Write("Enter Doctor ID: ");
                        id     = Convert.ToInt32(Console.ReadLine());
                        doctor = CliniqueManagementSearch.SearchDoctorByID(doctors, id);
                        if (doctors == null)
                        {
                            Console.WriteLine("No Data Present.");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("No.\tId\tName\t\tSpecialization\t\tAvailability");
                            Console.WriteLine(1 + "\t" + doctor.DoctorID + "\t" + doctor.Name + "\t" + doctor.Specialization + "\t\t\t" + doctor.Availability);
                            Console.WriteLine();
                        }
                        break;

                    case 2:
                        Console.Write("Enter Doctor Name: ");
                        name   = Console.ReadLine();
                        doctor = CliniqueManagementSearch.SearchDoctorByName(doctors, name);
                        if (doctors == null)
                        {
                            Console.WriteLine("No Data Present.");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("No.\tId\tName\t\tSpecialization\t\tAvailability");
                            Console.WriteLine(1 + "\t" + doctor.DoctorID + "\t" + doctor.Name + "\t" + doctor.Specialization + "\t\t\t" + doctor.Availability);
                            Console.WriteLine();
                        }
                        break;

                    case 3:
                        Console.Write("Enter Doctor Specialization: ");
                        specialization = Console.ReadLine();
                        doctor         = CliniqueManagementSearch.SearchDoctorBySpecialization(doctors, specialization);
                        if (doctors == null)
                        {
                            Console.WriteLine("No Data Present.");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("No.\tId\tName\t\tSpecialization\t\tAvailability");
                            Console.WriteLine(1 + "\t" + doctor.DoctorID + "\t" + doctor.Name + "\t" + doctor.Specialization + "\t\t\t" + doctor.Availability);
                            Console.WriteLine();
                        }
                        break;

                    case 4:
                        Console.Write("Enter Doctor Availability: ");
                        availability = Console.ReadLine();
                        doctor       = CliniqueManagementSearch.SearchDoctorByAvailability(doctors, availability);
                        if (doctors == null)
                        {
                            Console.WriteLine("No Data Present.");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("No.\tId\tName\t\tSpecialization\t\tAvailability");
                            Console.WriteLine(1 + "\t" + doctor.DoctorID + "\t" + doctor.Name + "\t" + doctor.Specialization + "\t\t\t" + doctor.Availability);
                            Console.WriteLine();
                        }
                        break;

                    case 5:
                        flag = false;
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n");
            }
        }