Пример #1
0
 public static bool ValidarAcceso(string nombrePatente)
 {
     BLL.UsuarioPatente usuPat_BLL = new BLL.UsuarioPatente();
     foreach (BE.Patente patente in BE.ConfigUsuario.permisos)
     {
         if (patente.descripcion == nombrePatente)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
        public static void FijarPermisos(List <BE.UsuarioPatente> usuPatentes, List <BE.Patente> patentes, List <BE.Familia> familias)
        {
            //LISTA DEFINITVA: patentes de familias (1) + patentes individuales (2)
            //CONDICION: activas -Patente & Familia- (a nivel general) & no negadas -Patente- (a nivel usuario)

            //PASO 1: Patente-familia
            BLL.FamiliaPatente famPat_BLL = new BLL.FamiliaPatente();
            foreach (BE.Familia familia in familias)
            {
                if (familia.activo)
                {
                    foreach (BE.Patente patente in famPat_BLL.GetPatentesFamilia(familia.id))
                    {
                        if (!BE.ConfigUsuario.permisos.Any(p => p.id == patente.id))
                        {
                            if (patente.activo)
                            {
                                BE.ConfigUsuario.permisos.Add(patente);
                            }
                        }
                    }
                }
            }

            //PASO 2: Patente-individual
            BE.ConfigUsuario.usuPatentes = usuPatentes;
            BLL.UsuarioPatente usuPat_BLL = new BLL.UsuarioPatente();
            foreach (BE.Patente patente in patentes)
            {
                //QUITAR: Si la patente ya se agregó por la familia pero esta negada individualmente
                if (BE.ConfigUsuario.permisos.Any(p => p.id == patente.id))
                {
                    if (BLL.ConfigUsuario.estaNegada(patente.id))
                    {
                        BE.ConfigUsuario.permisos.RemoveAll(p => p.id == patente.id);
                    }
                }
                //AGREGAR: Si la patente individual no se agregó por la familia, no está negada y está activa
                else
                {
                    if (patente.activo)
                    {
                        if (!BLL.ConfigUsuario.estaNegada(patente.id))
                        {
                            BE.ConfigUsuario.permisos.Add(patente);
                        }
                    }
                }
            }
        }
Пример #3
0
        private void RecalcularDigitosUsuarioPatente()
        {
            //RECALCULO DVH Y DVV DE LA TABLA FAMILIAPATENTE
            BLL.UsuarioPatente       usuPat_BLL   = new BLL.UsuarioPatente();
            BE.UsuarioPatente        usuPat_BE    = new BE.UsuarioPatente();
            List <BE.UsuarioPatente> lista_usuPat = new List <BE.UsuarioPatente>();

            lista_usuPat = usuPat_BLL.SelectAll();
            string cadena = "";

            foreach (BE.UsuarioPatente item in lista_usuPat)
            {
                cadena = item.id_patente.ToString() + item.id_usuario.ToString() + item.patenteNegada.ToString();
                int valorDVH = UTILITIES.DigitoVerificador.ObtenerDVH(cadena);
                usuPat_BLL.UpdateDVH(valorDVH, item.id_patente, item.id_usuario);
            }

            BLL.DigitoVerificador.CalcularDVV("UsuarioPatente");
        }