private void frmPuestos_Load(object sender, EventArgs e) { /// _tipoOperacion CONSULTA = 1, EDICION = 2 if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR) { cnx = new SqlConnection(); cnx.ConnectionString = cdn; cmd = new SqlCommand(); cmd.Connection = cnx; ph = new Puestos.Core.PuestosHelper(); ph.Command = cmd; Puestos.Core.Puestos p = new Puestos.Core.Puestos(); p.idpuesto = _idPuesto; List<Puestos.Core.Puestos> lstPuesto; try { cnx.Open(); lstPuesto = ph.obtenerPuesto(p); cnx.Close(); cnx.Dispose(); for (int i = 0; i < lstPuesto.Count; i++) { txtDescripcion.Text = lstPuesto[i].nombre; } } catch (Exception error) { MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error"); } if (_tipoOperacion == GLOBALES.CONSULTAR) { toolTitulo.Text = "Consulta Puesto"; GLOBALES.INHABILITAR(this, typeof(TextBox)); } else toolTitulo.Text = "Edición Puesto"; } }
private void frmPuestos_Load(object sender, EventArgs e) { /// _tipoOperacion CONSULTA = 1, EDICION = 2 if (_tipoOperacion == GLOBALES.CONSULTAR || _tipoOperacion == GLOBALES.MODIFICAR) { cnx = new MySqlConnection(); cnx.ConnectionString = cdn; cmd = new MySqlCommand(); cmd.Connection = cnx; ph = new Puestos.Core.PuestosHelper(); ph.Command = cmd; Puestos.Core.Puestos p = new Puestos.Core.Puestos(); p.id = _idPuesto; List<Puestos.Core.Puestos> lstPuesto; try { cnx.Open(); lstPuesto = ph.obtenerPuesto(p); cnx.Close(); cnx.Dispose(); for (int i = 0; i < lstPuesto.Count; i++) { txtDescripcion.Text = lstPuesto[i].descripcion; } } catch (Exception error) { MessageBox.Show("Error: \r\n \r\n " + error.Message, "Error"); } if (_tipoOperacion == GLOBALES.CONSULTAR) { toolTitulo.Text = "Consulta Puesto"; GLOBALES.INHABILITAR(this, typeof(TextBox)); } else toolTitulo.Text = "Edición Puesto"; } }