private void ModificarJefeArea_Click(object sender, EventArgs e) { if (ListaJefes.SelectedIndex > 0) { DialogResult resultado = MessageBox.Show("¿Desea modificar el Jefe?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultado == DialogResult.Yes) { using (var a = new ModificarJefe(CadenaConexion, ID_Jefe.GetValueOrDefault())) { a.ShowDialog(); } } } }
public void LlenarAsesores() { using (var context = new Base_Servicio_PracticasEntities(CadenaConexion)) { Dictionary <string, string> diccionario = new Dictionary <string, string>(); var item = context.Asesor_Tecnico.ToList(); diccionario.Add("0", "Seleccione"); foreach (var valores in item) { var nombre = valores.Nombre1_Asesor + " " + valores.Nombre2_Asesor + " " + valores.Apellido_Paterno + " " + valores.Apellido_Materno; var id = valores.ID_Asesor; diccionario.Add(id.ToString(), nombre); } ListaAsesores.DataSource = new BindingSource(diccionario, null); ListaAsesores.DisplayMember = "Value"; ListaAsesores.ValueMember = "Key"; ListaAsesores.SelectedValue = ID_Asesor.ToString(); //// /// Dictionary <string, string> diccionario2 = new Dictionary <string, string>(); var item2 = context.Jefe_Area.ToList(); diccionario2.Add("0", "Seleccione"); foreach (var valores in item2) { var nombre = valores.Nombre1_Jefe + " " + valores.Nombre2_Jefe + " " + valores.Apellido_Paterno_Jefe + " " + valores.Apellido_Materno_Jefe; var id = valores.ID_Jefe_Area; diccionario2.Add(id.ToString(), nombre); } ListaJefes.DataSource = new BindingSource(diccionario2, null); ListaJefes.DisplayMember = "Value"; ListaJefes.ValueMember = "Key"; ListaJefes.SelectedValue = ID_Jefe.ToString(); } }