private void Editar() { try { if (Validar()) { PuiCatCfgCatFoliadores pui = new PuiCatCfgCatFoliadores(db); pui.keyCveFoliador = txtClaveClase.Text; pui.cmpDescripcion = txtDescripcion.Text; pui.cmpCveModulo = Convert.ToString(cboCfgModuloSys.SelectedValue); pui.cmpUso = txtUso.Text; if (pui.ActualizaCfgCatFoliador() >= 0) { MessageBoxAdv.Show("Registro Actualizado", "Confirmacion", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Size = this.MinimumSize; } LlenaGridView(); //grdView.CurrentRow.Index = idxG; } } catch (Exception ex) { MessageBoxAdv.Show("Tienes que seleccionar un registro \n" + ex.Message + " " + ex.StackTrace.ToString(), "Error al editar", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmEditar_Click(object sender, EventArgs e) { //if (AcCOPEdit == 1) //{ LimpiarControles(); OpcionControles(true); this.Size = this.MaximumSize; opcion = 2; idxG = grdView.CurrentRow.Index; PuiCatCfgCatFoliadores pui = new PuiCatCfgCatFoliadores(db); pui.keyCveFoliador = grdView[0, grdView.CurrentRow.Index].Value.ToString(); pui.EditarCfgCatFoliador(); txtClaveClase.Text = pui.keyCveFoliador; txtDescripcion.Text = pui.cmpDescripcion; cboCfgModuloSys.SelectedValue = pui.cmpCveModulo; txtUso.Text = pui.cmpUso; txtClaveClase.Enabled = false; /* * } * else * { * MessageBoxAdv.Show("No tienes privilegios suficientes", * "Error al editar registro", MessageBoxButtons.OK, * MessageBoxIcon.Exclamation); * } */ }
private void LlecboCfgCatFoliadores(int EnUso) { PuiCatCfgCatFoliadores lin = new PuiCatCfgCatFoliadores(db); cboCfgCatFoliadores.DataSource = lin.cboCfgCatFoliadores(EnUso); cboCfgCatFoliadores.ValueMember = "CveFoliador"; cboCfgCatFoliadores.DisplayMember = "Descripcion"; }
private void LleCboModuloSys() { PuiCatCfgCatFoliadores lin = new PuiCatCfgCatFoliadores(db); cboCfgModuloSys.DataSource = lin.CboCfgModuloSys(); cboCfgModuloSys.ValueMember = "CveModulo"; cboCfgModuloSys.DisplayMember = "Descripcion"; }
private void cmdBuscar_Click(object sender, EventArgs e) { PuiCatCfgCatFoliadores pui = new PuiCatCfgCatFoliadores(db); DatosTbl = pui.BuscaClase(txtBuscar.Text); DataSet ds = new DataSet(); DatosTbl.Fill(ds); grdView.Rows.Clear(); for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { object[] tmp = ds.Tables[0].Rows[j].ItemArray; grdView.Rows.Add(tmp); } }
private void Agregar() { if (Validar()) { PuiCatCfgCatFoliadores pui = new PuiCatCfgCatFoliadores(db); pui.keyCveFoliador = txtClaveClase.Text; pui.cmpDescripcion = txtDescripcion.Text; pui.cmpCveModulo = Convert.ToString(cboCfgModuloSys.SelectedValue); pui.cmpUso = txtUso.Text; if (pui.AgregarClase() >= 1) { MessageBoxAdv.Show("Registro agregado", "Confirmacion", MessageBoxButtons.OK, MessageBoxIcon.Information); LlenaGridView(); this.Size = this.MinimumSize; } } }
private void cmdEliminar_Click(object sender, EventArgs e) { try { if (MessageBoxAdv.Show("Esta seguro de eliminar el registro " + grdView[0, grdView.CurrentRow.Index].Value.ToString(), "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PuiCatCfgCatFoliadores pui = new PuiCatCfgCatFoliadores(db); pui.keyCveFoliador = grdView[0, grdView.CurrentRow.Index].Value.ToString(); pui.EliminaCfgCatFoliador(); LlenaGridView(); this.Size = this.MinimumSize; } } catch (Exception ex) { MessageBoxAdv.Show("Tienes que seleccionar un registro\n" + ex.Message, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void cmdConsultar_Click(object sender, EventArgs e) { LimpiarControles(); OpcionControles(true); this.Size = this.MaximumSize; opcion = 3; idxG = grdView.CurrentRow.Index; PuiCatCfgCatFoliadores pui = new PuiCatCfgCatFoliadores(db); pui.keyCveFoliador = grdView[0, grdView.CurrentRow.Index].Value.ToString(); pui.EditarCfgCatFoliador(); txtClaveClase.Text = pui.keyCveFoliador; txtDescripcion.Text = pui.cmpDescripcion; cboCfgModuloSys.SelectedValue = pui.cmpCveModulo; txtUso.Text = pui.cmpUso; OpcionControles(false); }
private void LlenaGridView() { PuiCatCfgCatFoliadores pui = new PuiCatCfgCatFoliadores(db); DatosTbl = pui.ListarCfgCatFoliadores(); DataSet Ds = new DataSet(); try { DatosTbl.Fill(Ds); grdView.Rows.Clear(); for (int j = 0; j < Ds.Tables[0].Rows.Count; j++) { object[] tmp = Ds.Tables[0].Rows[j].ItemArray; grdView.Rows.Add(tmp); } } catch (Exception ex) { MessageBoxAdv.Show(ex.Message, "Error al cargar listado", MessageBoxButtons.OK, MessageBoxIcon.Error); } }