Пример #1
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (patientsListView.SelectedItems.Count > 0)
     {
         int     patientId = int.Parse(patientsListView.SelectedItems[0].Tag.ToString());
         Patient patient   = patientManager.GetPatientById(patientId);
         PatientDiseaseManager patientDiseaseManager = new PatientDiseaseManager();
         patientDiseaseManager.DeleteExisting(patient);
         if (patientManager.DeleteByPatientId(patientId))
         {
             Close();
             MessageBox.Show("Patient Successfully Deleted");
         }
         else
         {
             MessageBox.Show("An Error Occured");
         }
     }
     else
     {
         MessageBox.Show("You must Select a row");
     }
 }