private bool Validar()
        {
            bool paso = true;
            errorProvider1.Clear();

            if (DescripciontextBox.Text == string.Empty)
            {
                errorProvider1.SetError(DescripciontextBox, "El campo Descripcion no puede estar vacío");
                DescripciontextBox.Focus();
                paso = false;
            }
            if (RolesBLL.ExisteDescripcion(DescripciontextBox.Text, (int)idnumericUpDown.Value))
            {
                errorProvider1.SetError(DescripciontextBox, "Este Rol ya existe");
                DescripciontextBox.Focus();
                paso = false;
            }
            if (PermisocomboBox.Text == string.Empty)
            {
                errorProvider1.SetError(PermisocomboBox, "Debe seleccionar un Id");
                PermisocomboBox.Focus();
                paso = false;
            }
            if (this.Detalles.Count == 0)
            {
                errorProvider1.SetError(DetalledataGridView, "Debe agregar un Permiso");
                PermisocomboBox.Focus();
                paso = false;
            }

            return paso;
        }
        private bool Validar()
        {
            bool paso = true;

            if (DescripciontextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(DescripciontextBox, "Este Campo no puede estar vacio");
                DescripciontextBox.Focus();
                paso = false;
            }
            if (RolesBLL.ExisteDescripcion(DescripciontextBox.Text, (int)IdnumericUpDown.Value))
            {
                ErrorProvider.SetError(DescripciontextBox, "Esta Descripcion ya existe");
                DescripciontextBox.Focus();
                paso = false;
            }
            if (PermisocomboBox.Text == string.Empty)
            {
                ErrorProvider.SetError(PermisocomboBox, "Debe seleccionar un Permiso Id");
                PermisocomboBox.Focus();
                paso = false;
            }
            if (this.Detalle.Count == 0)
            {
                ErrorProvider.SetError(DetallesdataGridView, "Debe agregar un Permiso");
                DetallesdataGridView.Focus();
                paso = false;
            }

            return(paso);
        }
        private void Agregarbutton_Click(object sender, EventArgs e)
        {
            if (DetalledataGridView.DataSource != null)
                this.Detalles = (List<RolesDetalles>)DetalledataGridView.DataSource;

            this.Detalles.Add(
                new RolesDetalles(
                    id: 0,
                    rolId: (int)idnumericUpDown.Value,
                    permisoId: Convert.ToInt32(PermisocomboBox.Text),
                    EsAsignado: AsignadocheckBox.Checked
                )
            );
            CargaGrid();
            PermisocomboBox.Focus();
            AsignadocheckBox.Checked = false;
        }
        private void Agregarbutton_Click(object sender, EventArgs e)
        {
            if (DetallesdataGridView.DataSource != null)
            {
                this.Detalle = (List <RolesDetalle>)DetallesdataGridView.DataSource;
            }

            this.Detalle.Add(new RolesDetalle()
            {
                RolId      = (int)IdnumericUpDown.Value,
                PermisoId  = Convert.ToInt32(PermisocomboBox.Text),
                EsAsignado = AsignadocheckBox.Checked
            }
                             );
            CargarGrid();
            PermisocomboBox.Focus();
            AsignadocheckBox.Checked = true;
        }