示例#1
0
        private void docSearchButton_Click(object sender, RoutedEventArgs e)
        {
            if (docSearchTextBox.Text != "")
            {
                int docCount = 0;
                IEnumerable <Doctor> doctors;
                switch (docSearchComboBox.Text)
                {
                case "Full Name":
                    doctors = from doctor in dataClasses.Doctors
                              where SqlMethods.Like(doctor.Display_Name, $"%{docSearchTextBox.Text}%")
                              select doctor;

                    break;

                case "Last Name":
                    doctors = from doctor in dataClasses.Doctors
                              where SqlMethods.Like(doctor.Last_Name, $"%{docSearchTextBox.Text}%")
                              select doctor;
                    break;

                case "Address":
                    doctors = from doctor in dataClasses.Doctors
                              where SqlMethods.Like(doctor.Address, $"%{docSearchTextBox.Text}%")
                              select doctor;
                    break;

                case "Cell Phone":
                    doctors = from doctor in dataClasses.Doctors
                              where doctor.Cell_Number == (docSearchTextBox.Text)
                              select doctor;
                    break;

                case "Home Phone":
                    doctors = from doctor in dataClasses.Doctors
                              where doctor.Phone_Number == (docSearchTextBox.Text)
                              select doctor;
                    break;

                default:
                    doctors = from doctor in dataClasses.Doctors select doctor;
                    break;
                }

                foreach (Doctor doct in doctors)
                {
                    docCount++;
                }
                if (docCount == 0)
                {
                    MessageBox.Show("No patient found please refine search or add new patient");
                }
                else if (docCount == 1)
                {
                    Doctor doc = doctors.First();
                    PopulateFields(doc.Id);
                }
                else
                {
                    MultiPatientPopup multiPatientPopup = new MultiPatientPopup(doctors, this);
                    multiPatientPopup.Show();
                }
            }
        }
示例#2
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            if (patientSearchTextBox.Text != "")
            {
                int patCount = 0;
                IEnumerable <Patient> patients;
                switch (searchbyComboBox.Text)
                {
                case "Full Name":
                    patients = from patient in dataClasses.Patients
                               where SqlMethods.Like(patient.Display_Name, $"%{patientSearchTextBox.Text}%")
                               select patient;

                    break;

                case "Last Name":
                    patients = from patient in dataClasses.Patients
                               where SqlMethods.Like(patient.Last_Name, $"%{patientSearchTextBox.Text}%")
                               select patient;
                    break;

                case "SSN":
                    patients = from patient in dataClasses.Patients
                               where patient.SSN == patientSearchTextBox.Text
                               select patient;
                    break;

                case "Address":
                    patients = from patient in dataClasses.Patients
                               where SqlMethods.Like(patient.Address, $"%{patientSearchTextBox.Text}%")
                               select patient;
                    break;

                case "Cell Phone":
                    patients = from patient in dataClasses.Patients
                               where patient.Cell_Number == (patientSearchTextBox.Text)
                               select patient;
                    break;

                case "Home Phone":
                    patients = from patient in dataClasses.Patients
                               where patient.Home_Number == (patientSearchTextBox.Text)
                               select patient;
                    break;

                default:
                    patients = from patient in dataClasses.Patients select patient;
                    break;
                }

                foreach (Patient pati in patients)
                {
                    patCount++;
                }
                if (patCount == 0)
                {
                    MessageBox.Show("No patient found please refine search or add new patient");
                }
                else if (patCount == 1)
                {
                    Patient pati = patients.First();
                    PopulateFields(pati.Id);
                }
                else
                {
                    MultiPatientPopup multiPatientPopup = new MultiPatientPopup(patients, this);
                    multiPatientPopup.Show();
                }
            }
        }