コード例 #1
0
        /// <summary>
        /// Display User Specific Query Patient Details
        /// </summary>
        /// <param name="patients"></param>
        public static void DisplayUserQueryPatient(List <Patient> patients)
        {
            try
            {
                int    choice;
                string Id, name, mobileNumber;

                Patient patient;

                bool flag;
                do
                {
                    Console.WriteLine();
                    Console.WriteLine("1. Search Patient By Id");
                    Console.WriteLine("2. Search Patient By Name");
                    Console.WriteLine("3. Search Patient By Mobile Number");
                    Console.WriteLine("4. Exit");
                    Console.Write("Enter Your Choice: ");
                    flag = int.TryParse(Console.ReadLine(), out choice);
                    ErrorMessage(flag);
                } while (!flag);
                switch (choice)
                {
                case 1:
                    Console.WriteLine();
                    Console.Write("Enter the Patient Id: ");
                    Id      = Console.ReadLine();
                    patient = CliniqueManagementSearch.SearchPatientById(patients, Id);
                    if (patient == null)
                    {
                        Console.WriteLine("No Data Present.");
                    }
                    else
                    {
                        Console.WriteLine("No.\tId\tName\tMobile Number\tAge");
                        Console.WriteLine(1 + "\t" + patient.PatientId + "\t" + patient.Name + "\t" + patient.MobileNumber + "\t" + patient.Age);
                    }
                    break;

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

                case 3:
                    Console.WriteLine();
                    Console.Write("Enter the Patient Mobile Number: ");
                    mobileNumber = Console.ReadLine();
                    patient      = CliniqueManagementSearch.SearchPatientByMobileNumber(patients, mobileNumber);
                    if (patient == null)
                    {
                        Console.WriteLine("No Data Present.");
                    }
                    else
                    {
                        Console.WriteLine("No.\tId\tName\tMobile Number\tAge");
                        Console.WriteLine(1 + "\t" + patient.PatientId + "\t" + patient.Name + "\t" + patient.MobileNumber + "\t" + patient.Age);
                    }
                    break;

                case 4:
                    return;

                default:
                    Console.WriteLine("Invalid Choice. !!");
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Message: {0}", e.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Display User Specific Query Doctor Details
        /// </summary>
        /// <param name="doctors"></param>
        public static void DisplayUserQueryDoctor(List <Doctor> doctors)
        {
            try
            {
                int    choice;
                string Id, name, specialization, availability;

                Doctor doctor;

                bool flag;
                do
                {
                    Console.WriteLine();
                    Console.WriteLine("1. Search Doctor By Id");
                    Console.WriteLine("2. Search Doctor By Name");
                    Console.WriteLine("3. Search Doctor By Specialization");
                    Console.WriteLine("4. Search Doctor By Availability");
                    Console.WriteLine("5. Exit");
                    Console.Write("Enter Your Choice: ");
                    flag = int.TryParse(Console.ReadLine(), out choice);
                    ErrorMessage(flag);
                } while (!flag);
                switch (choice)
                {
                case 1:
                    Console.WriteLine();
                    Console.Write("Enter the doctor Id: ");
                    Id     = Console.ReadLine();
                    doctor = CliniqueManagementSearch.SearchDoctorById(doctors, Id);
                    if (doctor == null)
                    {
                        Console.WriteLine("No Data Present.");
                    }
                    else
                    {
                        Console.WriteLine("No.\tId\tName\tSpecialization\tAvailability");
                        Console.WriteLine(1 + "\t" + doctor.DoctorId + "\t" + doctor.Name + "\t" + doctor.Specialization + "\t" + doctor.Availability);
                    }
                    break;

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

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

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

                case 5:
                    return;

                default:
                    Console.WriteLine("Invalid Choice. !!");
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Message: {0}", e.Message);
            }
        }