예제 #1
0
        private bool Validar()
        {
            bool paso = true;

            if (DescripciontextBox.Text == string.Empty)
            {
                ErroreserrorProvider.SetError(DescripciontextBox, "Este campo no puede quedar vacio");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (RolesBLL.ExisteDescripcion(DescripciontextBox.Text))
            {
                ErroreserrorProvider.SetError(DescripciontextBox, "Esta descripcion ya existe en la base de datos");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (PermisoscomboBox.Text == string.Empty)
            {
                ErroreserrorProvider.SetError(PermisoscomboBox, "Debe seleccion un Id");
                PermisoscomboBox.Focus();
                paso = false;
            }

            if (this.Detalle.Count == 0)
            {
                ErroreserrorProvider.SetError(DetalledataGridView, "Es necesario agregar un permis");
                DetalledataGridView.Focus();
                paso = false;
            }

            return(paso);
        }
예제 #2
0
        private void Agregarbutton_Click(object sender, EventArgs e)
        {
            if (DetalledataGridView.DataSource != null)
            {
                this.Detalle = (List <RolesDetalle>)DetalledataGridView.DataSource;
            }

            this.Detalle.Add(
                new RolesDetalle(
                    id: 0,
                    rolid: (int)IDnumericUpDown.Value,
                    permisoid: Convert.ToInt32(PermisoscomboBox.Text),
                    asigned: AsignadocheckBox.Checked
                    )
                );
            CargarGrid();
            PermisoscomboBox.Focus();
            PermisoscomboBox.Text    = "";
            AsignadocheckBox.Checked = true;
        }