コード例 #1
0
        private void CmbHospital_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbPolyclinic.Items.Clear();
            cmbPolyclinic.Text = string.Empty;

            polyclinicController = new PolyclinicController();
            polyclinics          = polyclinicController.GetAll();
            int hospitalId = ((Hospital)(cmbHospital.SelectedItem)).HospitalId;

            foreach (Polyclinic polyclinic in polyclinics)
            {
                if (polyclinic.HospitalId == hospitalId)
                {
                    cmbPolyclinic.Items.Add(polyclinic.PolyclinicName);
                }
            }

            hospitalDepartmentController = new HospitalDepartmentController();
            hospitalDepartments          = hospitalDepartmentController.GetAll();


            foreach (HospitalDepartment department in hospitalDepartments)
            {
                appointmentController       = new AppointmentController();
                cmbDepartment.DataSource    = appointmentController.ListDepartment(hospitalId);
                cmbDepartment.DisplayMember = "DepartmentName";
                cmbDepartment.ValueMember   = "DepartmentId";
            }
            cmbDoctor.SelectedIndex = -1;
            cmbDoctor.Text          = string.Empty;
            cmbHour.DataSource      = null;
        }