Ejemplo n.º 1
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     if (dgvDatos.RowCount > 0)
     {
         try
         {
             cTipoPermiso temporal = tipopermisor.retornarPorId(Convert.ToInt32(dgvDatos.CurrentRow.Cells[0].Value));
             tipopermisor.eliminar(temporal);
             MessageBox.Show("SE ELIMINARON LOS DATOS CON EXITO: ", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Actualizar();
         }
         catch (Exception ex)
         {
             MessageBox.Show("ERROR AL ELIMINAR LOS DATOS: " + ex.Message, "ERROR!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 2
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            tipopermiso        = tipopermisor.retornarPorId(Convert.ToInt32(dgvDatos.CurrentRow.Cells[0].Value));
            tipopermiso.nombre = tbNombre.Text;
            if (chbConGoce.Checked)
            {
                tipopermiso.conGoce = "CON GOCE";
            }
            else
            {
                tipopermiso.conGoce = "SIN GOCE";
            }
            tipopermiso.detalle = tbDetalle.Text;

            if (rbtPermiso.Checked)
            {
                tipopermiso.tipo = "PERMISO";
            }
            else
            {
                tipopermiso.tipo = "LICENCIA";
            }

            tipopermiso.limite = Convert.ToInt32(tbPeriodo.Text);


            try
            {
                tipopermisor.modificar(tipopermiso);
                MessageBox.Show("SE MODIFICARON LOS DATOS SATISFACTORIAMENTE: ", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Actualizar();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR AL MODIFICAR LOS DATOS: " + ex.Message, "ERROR!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }