private void btnEliminar_Click(object sender, EventArgs e) { if (this.dgvRoles.RowCount >= 1) { if (MessageBox.Show("Realmente quiere elimar este registro?", "Aviso...!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { roles nRoles = new Modelo.roles(); nRoles.pkRol = Convert.ToInt32(this.dgvRoles.CurrentRow.Cells[0].Value); nRoles.sNombre = this.dgvRoles.CurrentRow.Cells[1].Value.ToString(); nRoles.bStatus = false; ControladorRol cRoles = new ControladorRol(); cRoles.Modificar(nRoles); this.cargarRoles(); } } }
private void btnGuardar_Click(object sender, EventArgs e) { if (txtRol.Text == "") { ErrorProvider.SetError(txtRol, "Campo necesario"); ErrorProvider.SetIconAlignment(txtRol, ErrorIconAlignment.MiddleRight); txtRol.Focus(); } else { roles nRol = new Modelo.roles(); nRol.sNombre = txtRol.Text.Trim(); ControladorRol cRol = new ControladorRol(); cRol.Guardar(nRol); wMain.cargarRoles(); this.Close(); } }
private void btnGuardar_Click(object sender, EventArgs e) { if (txtRol.Text == "") { ErrorProvider.SetError(txtRol, "Campo necesario"); ErrorProvider.SetIconAlignment(txtRol, ErrorIconAlignment.MiddleRight); txtRol.Focus(); } else { roles nroles = new Modelo.roles(); nroles.pkRol = frmMainRoles.PKROLES; nroles.sNombre = txtRol.Text; ControladorRol croles = new ControladorRol(); croles.Modificar(nroles); wMain.cargarRoles(); this.Close(); } }