private void btnAgregarPermiso_Click(object sender, EventArgs e)
        {
            if (txtIdRecurso.Text == "")
            {
                MessageBox.Show("Todos los valores son requeridos");
                return;
            }
            int    idPermiso    = Convert.ToInt32(1);
            string recursoLegal = txtIdRecurso.Text;

            PermisoBLL permisosBL = new PermisoBLL();
            int        actualizar = permisosBL.agregar(idPermiso, recursoLegal);

            if (actualizar == 1)
            {
                MessageBox.Show("Permiso Agregado");
                this.Hide();
                frmMantenedorPermisos mp = new frmMantenedorPermisos();
                mp.Show();
            }
            else
            {
                MessageBox.Show("Permiso no Agregado");
            }
        }
        private void btnAgregarUnidadInterna_Click(object sender, EventArgs e)
        {
            if (txtDescUnidadInterna.Text == "")
            {
                MessageBox.Show("Todos los valores son requeridos");
                return;
            }
            int    idPermiso    = Convert.ToInt32(1);
            string recursoLegal = txtDescUnidadInterna.Text;

            UnidadInternaBLL unidad = new UnidadInternaBLL();
            int agregar             = unidad.agregar(idPermiso, recursoLegal);

            if (agregar == 1)
            {
                MessageBox.Show("Permiso Agregado");
                this.Hide();
                frmMantenedorPermisos mp = new frmMantenedorPermisos();
                mp.Show();
            }
            else
            {
                MessageBox.Show("Permiso no Agregado");
            }
        }
        private void btnEliminarPermiso_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (DataGridViewRow row in grdPermisos.Rows)
                {
                    if (row.Selected)
                    {
                        int        id         = Convert.ToInt32(row.Cells[0].Value.ToString());
                        PermisoBLL permisosBL = new PermisoBLL();
                        int        eliminar   = permisosBL.eliminar(id);

                        if (eliminar == 1)
                        {
                            MessageBox.Show("Permiso Eliminado");
                            this.Hide();
                            frmMantenedorPermisos mp = new frmMantenedorPermisos();
                            mp.Show();
                        }
                        else
                        {
                            MessageBox.Show("Permiso no eliminado");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Se produjo un error: " + ex.ToString());
            }
        }
Ejemplo n.º 4
0
        private void btnMantenedorUnidades_Click(object sender, EventArgs e)
        {
            frmMantenedorPermisos mp = new frmMantenedorPermisos();

            mp.Show();
        }