Ejemplo n.º 1
0
 private void GetDiseaseListInDiseaseCheckedListBox()
 {
     DiseaseManager diseaseManager=new DiseaseManager();
     List<Disease> diseaseList=new List<Disease>();
     diseaseList = diseaseManager.GetDiseaseList();
     diseaseCheckedListBox.DataSource = null;
     diseaseCheckedListBox.DataSource = diseaseList;
     diseaseCheckedListBox.ValueMember = "Id";
     diseaseCheckedListBox.DisplayMember = "Name";
 }
Ejemplo n.º 2
0
 private void saveButton_Click(object sender, EventArgs e)
 {
     DiseaseManager diseaseManager=new DiseaseManager();
     Disease disease=new Disease();
     disease.Name = diseaseNameTextBox.Text;
     if (diseaseManager.Save(disease))
     {
         Close();
         MessageBox.Show("Disease Successfully Added");
     }
 }
Ejemplo n.º 3
0
 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();
     }
 }
 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");
     }
 }