Exemplo n.º 1
0
        public void Aceptar()
        {
            try
            {
                obj.Idrol  = int.Parse(idusuario_);
                obj.Nombre = TXTNOMBRE.Text;
                obj.Estado = "HABILITADO";

                if (_evento == "NUEVO")
                {
                    if (obj.Registrar())
                    {
                        obj.RegistrarPermisos();
                        MessageBox.Show("Registrado correctamente");
                        Limpiar();
                    }
                }
                if (_evento == "MODIFICAR")
                {
                    if (obj.Editar())
                    {
                        MessageBox.Show("Registrado correctamente");
                        Close();
                    }
                }
                if (_evento == "HABILITAR")
                {
                    if (obj.DesHabilitar())
                    {
                        MessageBox.Show("Registrado correctamente");
                        Close();
                    }
                }
                if (_evento == "DESHABILITAR")
                {
                    if (obj.Habilitar())
                    {
                        MessageBox.Show("Registrado correctamente");
                        Close();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }