Пример #1
0
 private void patientsearchbutton_Click(object sender, EventArgs e)
 {
     if (patientsearchcomboBox.SelectedItem == null)
     {
         MessageBox.Show("Please select your search type");
     }
     else
     {
         if (patientsearchtextBox.Text == "")
         {
             MessageBox.Show("Please type your search");
         }
         else
         {
             if (patientsearchcomboBox.SelectedItem.ToString() == "Name")
             {
                 pdataGridView.DataSource = null;
                 pdataGridView.Rows.Clear();
                 List <Patient> plist = da.getPatientByName(patientsearchtextBox.Text);
                 if (plist.Count != 0)
                 {
                     foreach (var item in plist)
                     {
                         pdataGridView.Rows.Add(item.Name, item.Contactno, item.Status, item.Roomno, "details", "edit", "checkout", item.id);
                     }
                 }
                 else
                 {
                     MessageBox.Show("No results found");
                 }
             }
             else if (patientsearchcomboBox.SelectedItem.ToString() == "Roomno")
             {
                 pdataGridView.DataSource = null;
                 pdataGridView.Rows.Clear();
                 List <Patient> plist = da.getPatientByroom(patientsearchtextBox.Text);
                 if (plist.Count != 0)
                 {
                     foreach (var item in plist)
                     {
                         pdataGridView.Rows.Add(item.Name, item.Contactno, item.Status, item.Roomno, "details", "edit", "checkout", item.id);
                     }
                 }
                 else
                 {
                     MessageBox.Show("No results found");
                 }
             }
         }
     }
 }