Esempio 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";
 }
Esempio n. 2
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();
     }
 }