Example #1
0
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            Permisos permisos;
            int      id;

            int.TryParse(PermisoIdNumericUpDown.Text, out id);

            if (PermisoIdNumericUpDown.Value == 0)
            {
                MessageBox.Show("Debes agregar un numero aqui para poder buscar.", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Limpiar();

            permisos = PermisosBLL.Buscar(id);

            if (permisos != null)
            {
                MessageBox.Show("Permiso encontrado!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LlenaCampo(permisos);
            }
            else
            {
                MessageBox.Show("Este Permiso no existe, prueba buscar otro!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #2
0
        private void AgregarButton_Click(object sender, EventArgs e)
        {
            MyErrorProvider.Clear();
            if (DetalleDataGridView.DataSource != null)
            {
                this.Detalle = (List <RolesDetalle>)DetalleDataGridView.DataSource;
            }

            if (PermisoIdComboBox.Text == string.Empty)
            {
                MessageBox.Show("Debes seleccionar un permiso antes de continuar.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Permisos permiso = PermisosBLL.Buscar(PermisoIdComboBox.SelectedIndex + 1);

            this.Detalle.Add(
                new RolesDetalle(
                    ID: 0,
                    RolID: (int)RolIdNumericUpDown.Value,
                    PermisoID: permiso.PermisoID,
                    esAsignado: AsignadoCheckBox.Checked
                    )
                );
            CargarGrid();
            PermisoIdComboBox.Focus();
        }
Example #3
0
        private void AgregarButton_Click(object sender, EventArgs e)
        {
            if (RolesDetalleDataGridView.DataSource != null)
            {
                this.RolDetalle = (List <RolesDetalle>)RolesDetalleDataGridView.DataSource;
            }

            this.RolDetalle.Add(new RolesDetalle
                                (
                                    Id: 0,
                                    RolId: (int)RolesIdNumericUpDown.Value,
                                    PermisoId: (int)PermisosComboBox.SelectedIndex + 1,
                                    esAsignado: esAsignadoCheckBox.Checked
                                )
                                );

            Permisos permiso = PermisosBLL.Buscar((int)PermisosComboBox.SelectedIndex + 1);

            permiso.VecesAsignado = ++permiso.VecesAsignado;

            if (!PermisosBLL.Guardar(permiso))
            {
                MessageBox.Show("Erro al cambian cantidad de veces asignada de permisos!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            CargarGrid();
        }
        private bool ExisteEnBaseDeDatos()
        {
            var permisos = new Permisos();

            permisos = PermisosBLL.Buscar((int)PermisoIdNumericUpDown.Value);

            return(permisos != null);
        }
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            Permiso permiso = PermisosBLL.Buscar((int)PermisosIdNumericUpDown.Value);

            if (EstaEnLaBaseDeDatos())
            {
                LlenarCampos(permiso);
            }
            else
            {
                MessageBox.Show("Usuario No existe.", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private bool LLenaCampos(int id)
        {
            Permisos permisos = PermisosBLL.Buscar(id);

            if (permisos != null)
            {
                PermisoIdNumericUpDown.Value = permisos.PermisoId;
                DescripcionTextBox.Text      = permisos.Descripcion;
                return(true);
            }
            else
            {
                return(false);
            }
        }
        //Este es el evento del boton Buscar, sirve para buscar los datos correspondientes al id ingresado
        private void BuscarPermisoButton_Click(object sender, EventArgs e)
        {
            var permisos = new Permisos();
            int id       = (int)PermisoIdNumericUpDown.Value;

            Limpiar();
            permisos = PermisosBLL.Buscar(id);
            if (permisos != null)
            {
                LLenaCampos(permisos);
            }
            else
            {
                MessageBox.Show("Permiso no encontrado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        //Este es el evento del boton Buscar, sirve para buscar los datos correspondientes al id ingresado
        private void BuscarPermisoButton_Click(object sender, EventArgs e)
        {
            int      id;
            Permisos permisos = new Permisos();

            id = (int)PermisoIdNumericUpDown.Value;

            Limpiar();
            permisos = PermisosBLL.Buscar(id);
            if (permisos != null)
            {
                LLenaCampos(id);
                MessageBox.Show("Usuario encontrado");
            }
            else
            {
                MessageBox.Show("Usuario no encontrado");
            }
        }
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            int      id;
            Permisos permiso = new Permisos();

            int.TryParse(IdNumericUpDown.Text, out id);

            Limpiar();

            permiso = PermisosBLL.Buscar(id);

            if (permiso != null)
            {
                LlenaCampo(permiso);
            }
            else
            {
                MessageBox.Show("Permiso no encontrado", "Id no existente", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #10
0
        private void Buscarbutton_Click(object sender, EventArgs e)
        {
            ErroreserrorProvider.Clear();
            int      id;
            Permisos permiso = new Permisos();

            int.TryParse(IDnumericUpDown.Text, out id);

            Limpiar();

            permiso = PermisosBLL.Buscar(id);

            if (permiso != null)
            {
                LlenarCampos(permiso);
            }
            else
            {
                MessageBox.Show("El permiso no ha sido encontrada o no esta registrada");
            }
        }
Example #11
0
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            Permisos permisos;
            int      id;

            int.TryParse(PermisoIdNumericUpDown.Text, out id);

            Limpiar();

            permisos = PermisosBLL.Buscar(id);

            if (permisos != null)
            {
                MessageBox.Show("Permiso encontrado!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LlenaCampo(permisos);
            }
            else
            {
                MessageBox.Show("Este Permiso no existe, prueba buscar otro!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #12
0
        private bool ExisteEnLaBaseDeDatos()
        {
            Permisos permiso = PermisosBLL.Buscar((int)IDnumericUpDown.Value);

            return(permiso != null);
        }
Example #13
0
        public bool ExisteEnLaBaseDeDatos()
        {
            Permisos permisos = PermisosBLL.Buscar((int)PermisoIdNumericUpDown.Value);

            return(permisos != null);
        }
        private bool EstaEnLaBaseDeDatos()
        {
            Permiso permiso = PermisosBLL.Buscar((int)PermisosIdNumericUpDown.Value);

            return(permiso != null);
        }