Exemple #1
0
        private bool ValidarDesasignacionPatente(int idFamilia, int idPatente)
        {
            Service.Familia familiaService = new Service.Familia();
            Service.Patente patenteService = new Service.Patente();

            if (familiaService.ObtenerUsuariosAsignados(new Entity.Familia {
                Id = idFamilia
            }) == 0)
            {
                return(true);
            }

            foreach (Entity.Familia item in familiaService.Listar().Where(f => f.Id != idFamilia))
            {
                if (item.Permisos.Any(p => p.Id == idPatente))
                {
                    if (familiaService.ObtenerUsuariosAsignados(item) > 0)
                    {
                        return(true);
                    }
                }
            }

            if (patenteService.ObtenerUsuariosAsignados(idPatente) > 0)
            {
                return(true);
            }

            return(false);
        }
Exemple #2
0
        private bool ValidarDesasignacion(int idPatente, int idUsuario)
        {
            Service.Familia familiaService = new Service.Familia();
            Service.Patente patenteService = new Service.Patente();

            foreach (Entity.Familia item in familiaService.Listar())
            {
                if (item.Permisos.Any(p => p.Id == idPatente))
                {
                    if (familiaService.ObtenerUsuariosAsignados(item) > 0)
                    {
                        return(true);
                    }
                }
            }

            if (this.ObtenerUsuariosAsignados(idPatente, idUsuario) > 0)
            {
                return(true);
            }

            return(false);
        }