public void CbbPaciente_SelectedIndexChanged(object sender, EventArgs e) { Paciente paciente = CbbPaciente.SelectedItem as Paciente; Convenio conv = new Convenio(); List <Paciente> list_paciente = MySqlPacienteRepository.GetByNome(paciente.Nome).ToList(); conv = MySqlConvenioRepository.Get(list_paciente.ElementAt(0).ConvenioId); List <Convenio> list_convenio = new List <Convenio>(); list_convenio.Add(conv); CbbConvenio.DataSource = list_convenio; CbbConvenio.DisplayMember = "nome"; CbbConvenio.ValueMember = "id"; Convenio convenio = CbbConvenio.SelectedItem as Convenio; List <MedicoConvenio> listaconv = new List <MedicoConvenio>(); listaconv = MySqlMedicoConvenioRepository.GetByConvenio(convenio.Id).ToList(); List <Medico> listamed = new List <Medico>(); for (int i = 0; i < listaconv.Count; i++) { listamed.Add(listaconv.ElementAt(i).Medico); } CbbMedico.DataSource = listamed; CbbMedico.DisplayMember = "nome"; CbbMedico.ValueMember = "id"; }
private void CbbConvenio_SelectedIndexChanged(object sender, EventArgs e) { Convenio convenio = CbbConvenio.SelectedItem as Convenio; List <MedicoConvenio> listaconv = new List <MedicoConvenio>(); listaconv = MySqlMedicoConvenioRepository.GetByConvenio(convenio.Id).ToList(); List <Medico> listamed = new List <Medico>(); for (int i = 0; i < listaconv.Count; i++) { listamed.Add(listaconv.ElementAt(i).Medico); } CbbMedico.DataSource = listamed; CbbMedico.DisplayMember = "nome"; CbbMedico.ValueMember = "id"; }