private void Fill() { switch (type) { case Enums.CommonOperationType.ODoctor: pnlNurse.Visible = false; pnlDoctor.Visible = true; using (var uow = (AdoNetUnitOfWork)UnitOfWorkFactory.Create(UnitOfWorkFactory.ConnectionType.SQL, Connection.connectionString)) { var docRepos = new DoctorRepository(uow); cmbDoc.ValueMember = "ID"; cmbDoc.DisplayMember = "FullName"; cmbDoc.DataSource = docRepos.GetAllDoctorsL(); cmbDoc.Text = "Choose A Doctor..."; } break; case Enums.CommonOperationType.ONurse: pnlDoctor.Visible = false; pnlNurse.Visible = true; using (var uow = (AdoNetUnitOfWork)UnitOfWorkFactory.Create(UnitOfWorkFactory.ConnectionType.SQL, Connection.connectionString)) { var nurseRepos = new NurseRepository(uow); cmbNurse.ValueMember = "ID"; cmbNurse.DisplayMember = "FullName"; cmbNurse.DataSource = nurseRepos.GetAllNursesL(); cmbNurse.Text = "Choose A Nurse..."; } break; } }