Example #1
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     if (dgvDatos.RowCount > 0)
     {
         try
         {
             cModalidad temporal = modalidadr.retornarPorId(Convert.ToInt32(dgvDatos.CurrentRow.Cells[0].Value));
             modalidadr.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);
         }
     }
 }
Example #2
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            modalidad         = modalidadr.retornarPorId(Convert.ToInt32(dgvDatos.CurrentRow.Cells[0].Value));
            modalidad.nombre  = tbNombre.Text;
            modalidad.detalle = tbDetalle.Text;

            try
            {
                modalidadr.modificar(modalidad);
                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);
            }
        }