private void cbxMedicamento_MouseClick(object sender, MouseEventArgs e) { Medicamento_Service MedicamentoS = new Medicamento_Service(); cbxMedicamento.DataSource = MedicamentoS.traerMedicamentos(); }
private void FrmPaciente_Load(object sender, EventArgs e) { rdbMasculino.Checked = true; try { Grupo_SanguineoService TipoSan = new Grupo_SanguineoService(); cbxSangre.DataSource = TipoSan.traerTipoDeSangre(); cbxSangre.DisplayMember = "Nombre1"; cbxSangre.ValueMember = "ID_Grupo_Sanguineo1"; Alergia_Service Alergias = new Alergia_Service(); cbxAlergias.DataSource = Alergias.TraerAlergias(); cbxAlergias.DisplayMember = "Nombre1"; cbxAlergias.ValueMember = "ID_Alergia1"; Medicamento_Service MedicamentoS = new Medicamento_Service(); cbxMedicamento.DataSource = MedicamentoS.traerMedicamentos(); cbxMedicamento.DisplayMember = "Nombre1"; cbxMedicamento.ValueMember = "ID_Medicamento1"; ProvinciaService Provincia = new ProvinciaService(); cbxProvincia.DataSource = null; cbxProvincia.DataSource = Provincia.traerProvincias(); cbxProvincia.DisplayMember = "N_Provincia1"; cbxProvincia.ValueMember = "ID_Provincia1"; if (paciente != null) { txtNombre.Text = paciente.Nombre1; txtApellido.Text = paciente.Apellido1; dtpFechaNac.Text = paciente.Fecha_Nac1; txtDNI.Text = paciente.DNI1; if (paciente.Sexo1 == true) { rdbMasculino.Checked = true; } else { rdbFemenino.Checked = true; } txtDireccion.Text = paciente.Direccion1; lblEdad.Text = Convert.ToString(paciente.Edad1); lblEdad.Visible = true; txtCorreo.Text = paciente.Email1; txtObs.Text = paciente.Obs1; txtAltura.Text = paciente.Antecedente.Altura1.ToString(); txtPeso.Text = paciente.Antecedente.Peso1.ToString(); txtTelefono.Text = paciente.Telefono1.ToString(); cbxProvincia.SelectedValue = paciente.Provincia.ID_Provincia1; cbxLocalidad.SelectedValue = paciente.Localidad.ID_Localidad1; cbxSangre.SelectedValue = paciente.Antecedente.ID_Grupo_Sanguineo1; dgvAlergias.DataSource = T_Alergias.TraerAlergias_P(paciente.ID_Paciente1); ModificarLista = T_Medicamntos.TraerMedicamntos_P(paciente.ID_Paciente1); Medicamento medicag = new Medicamento(); for (int i = 0; i < ModificarLista.Count; i++) { medicag.ID_Medicamento1 = ModificarLista[i].ID_Medicamento1; medicag.Nombre1 = ModificarLista[i].N_Medicamento1; listaM.Add(medicag); } dgvMedicamento.DataSource = listaM; dgvMedicamento.Columns[0].Visible = false; dgvAlergias.Columns[0].Visible = false; if (this.Text == "Vista General") { btnAceptar.Visible = false; txtNombre.Enabled = false; txtApellido.Enabled = false; cbxLocalidad.Enabled = false; cbxProvincia.Enabled = false; txtDNI.Enabled = false; dtpFechaNac.Enabled = false; txtDireccion.Enabled = false; txtTelefono.Enabled = false; txtPeso.Enabled = false; txtAltura.Enabled = false; txtObs.Enabled = false; txtCorreo.Enabled = false; cbxAlergias.Enabled = false; cbxMedicamento.Enabled = false; cbxSangre.Enabled = false; rdbMasculino.Enabled = false; rdbFemenino.Enabled = false; pbxADDA.Visible = false; pbxADDM.Visible = false; ptbAgregarAlergia.Visible = false; pbxDELA.Visible = false; ptbAgregarMedicamento.Visible = false; pbxDELM.Visible = false; dgvAlergias.Enabled = false; dgvMedicamento.Enabled = false; } } else { this.Text = "Creando..."; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }