Exemple #1
0
 public PatientEntryForm(string mode, int patientId)
 {
     InitializeComponent();
     if (mode == "Update")
     {
         PatientManager patientManager = new PatientManager();
         Doctor         doctor         = patientManager.GetDoctorByPatientId(patientId);
         GetDoctorsListInComboBox();
         doctorComboBox.Text = doctor.Name;
         List <Disease> diseaseList    = new List <Disease>();
         DiseaseManager diseaseManager = new DiseaseManager();
         diseaseList = diseaseManager.GetDiseasesBypatientId(patientId);
         foreach (var index in diseaseList)
         {
             diseaseCheckedListBox.SetItemChecked(1, true);
             diseaseCheckedListBox.DataSource    = null;
             diseaseCheckedListBox.DataSource    = diseaseList;
             diseaseCheckedListBox.ValueMember   = "Id";
             diseaseCheckedListBox.DisplayMember = "Name";
         }
     }
     else
     {
         GetDoctorsListInComboBox();
         GetDiseaseListInDiseaseCheckedListBox();
     }
 }
Exemple #2
0
 private void showDiseasesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (patientsListView.SelectedItems.Count > 0)
     {
         int            patientId      = int.Parse(patientsListView.SelectedItems[0].Tag.ToString());
         List <Disease> diseaseList    = new List <Disease>();
         DiseaseManager diseaseManager = new DiseaseManager();
         diseaseList = diseaseManager.GetDiseasesBypatientId(patientId);
         DiseaseListForm diseaseListForm = new DiseaseListForm(diseaseList);
         diseaseListForm.Show();
     }
     else
     {
         MessageBox.Show("A row must be selected");
     }
 }
 public PatientEntryForm(string mode, int patientId)
 {
     InitializeComponent();
     if (mode == "Update")
     {
         Patient patient = patientManager.GetPatientById(patientId);
         patientsNameTextBox.Text = patient.Name;
         Doctor doctor = patientManager.GetDoctorByPatientId(patientId);
         GetDoctorsListInComboBox();
         doctorComboBox.Text = doctor.Name;
         List <Disease> patientDiseaseList = new List <Disease>();
         List <Disease> diseaseList        = new List <Disease>();
         DiseaseManager diseaseManager     = new DiseaseManager();
         patientDiseaseList = diseaseManager.GetDiseasesBypatientId(patientId);
         diseaseList        = diseaseManager.GetDiseaseList();
         diseaseCheckedListBox.DataSource    = null;
         diseaseCheckedListBox.DataSource    = diseaseList;
         diseaseCheckedListBox.ValueMember   = "Id";
         diseaseCheckedListBox.DisplayMember = "Name";
         for (int index = 0; index < diseaseList.Count; index++)
         {
             foreach (var patientIndex in patientDiseaseList)
             {
                 if (diseaseList[index].Id == patientIndex.Id)
                 {
                     diseaseCheckedListBox.SetItemChecked(index, true);
                     break;
                 }
             }
         }
         this.mode      = mode;
         this.patientId = patientId;
     }
     else
     {
         GetDoctorsListInComboBox();
         GetDiseaseListInDiseaseCheckedListBox();
     }
 }
Exemple #4
0
        private void GetPatientListWithDoctor()
        {
            PatientManager       patientManager    = new PatientManager();
            List <PatientDoctor> patientDoctorList = patientManager.GetPatientDoctor();

            foreach (var index in patientDoctorList)
            {
                ListViewItem listViewItem = new ListViewItem(index.PatientName);
                listViewItem.SubItems.Add(index.DoctorName);
                List <Disease> diseaseList    = new List <Disease>();
                DiseaseManager diseaseManager = new DiseaseManager();
                diseaseList = diseaseManager.GetDiseasesBypatientId(index.Id);
                string diseaseString = "";
                foreach (var diseaseIndex in diseaseList)
                {
                    diseaseString += diseaseIndex.Name + "  ";
                }
                listViewItem.SubItems.Add(diseaseString);
                listViewItem.Tag = index.Id;
                patientsListView.Items.Add(listViewItem);
            }
        }