private void Btn_bsucarperfil_Click(object sender, EventArgs e) { string perfil = tbx_buscarperfil.Text; bool modificar = false; try { DataTable dtModulos = logic.ConsultaLogicaPerfil(perfil); foreach (DataRow row in dtModulos.Rows) { if (row[0] != null) { modificar = true; } txtcodigo.Text = (row[0].ToString()); txtnombre.Text = (row[1].ToString()); txtdesc.Text = (row[2].ToString()); if (row[3].ToString() == "1") { rbhabilitado.Checked = true; rbinhabilitado.Checked = false; } if (row[3].ToString() == "0") { rbinhabilitado.Checked = true; rbhabilitado.Checked = false; } } if (modificar == true) { btn_modif.Enabled = true; btn_ingresar.Enabled = false; txtcodigo.Enabled = false; txtnombre.Enabled = false; txtdesc.Enabled = false; rbhabilitado.Enabled = false; rbinhabilitado.Enabled = false; } else { btn_modif.Enabled = false; MessageBox.Show("No se encontró el perfil buscado"); } } catch (InvalidOperationException ex) { Console.WriteLine(ex); } }
private void Button1_Click(object sender, EventArgs e) { string consulta = txt_buscar.Text; bool modificar = false; try { DataTable mostrar = logic.ConsultaLogicaPerfil(consulta); foreach (DataRow row in mostrar.Rows) { if (row[0] != null) { modificar = true; } txt_id.Text = (row[0].ToString()); txt_nombre.Text = (row[4].ToString()); txt_monto.Text = (row[7].ToString()); txt_moneda.Text = (row[11].ToString()); txt_area.Text = (row[15].ToString()); txt_des.Text = (row[6].ToString()); } if (modificar == true) { txt_id.Enabled = false; txt_nombre.Enabled = false; txt_monto.Enabled = false; txt_moneda.Enabled = false; txt_area.Enabled = false; txt_des.Enabled = false; } else { limpiar(); MessageBox.Show("No se encontró el Presupuesto Buscado"); } } catch (InvalidOperationException ex) { Console.WriteLine(ex); } }