Example #1
0
 public UsuarioController(DbWorkFlow db)
 {
     _db = db;
 }
Example #2
0
 public CategoriaController(DbWorkFlow db)
 {
     _db = db;
 }
Example #3
0
        public static Usuario ObterDadosDoUsuarioCorrente(this Controller controller, DbWorkFlow db)
        {
            var loginDoUsuario = controller.User.Identity.Name;

            var usuario = db.Usuario
                          .FirstOrDefault(x => x.Login == loginDoUsuario);

            if (usuario == null)
            {
                throw new Exception("Usuário não encontrado. Entre em contato com o seu gestor");
            }

            return(usuario);
        }
Example #4
0
 public ScriptController(DbWorkFlow db)
 {
     _db = db;
 }
Example #5
0
 public LoginController(DbWorkFlow db, TokenConfigurations tokenConfigurations)
 {
     _db = db;
     _tokenConfigurations = tokenConfigurations;
 }
Example #6
0
 public SetorController(DbWorkFlow db)
 {
     _db = db;
 }
Example #7
0
 public BeneficiarioController(DbWorkFlow db)
 {
     _db = db;
 }
Example #8
0
 public EnderecoController(DbWorkFlow db)
 {
     _db = db;
 }
Example #9
0
 public ChamadoController(DbWorkFlow db)
 {
     _db = db;
 }
Example #10
0
 private static IQueryable <int> ChamadosId(DbWorkFlow db, FiltrosChamado filtros)
 {
     return(db.Historico_chamado.Where(x => x.St_chamado == filtros.St_chamado).Select(x => x.ChamadoId));
 }
Example #11
0
        public static IQueryable <Chamado> SomenteDoFiltros(this IQueryable <Chamado> queryble, DbWorkFlow db, FiltrosChamado filtros)
        {
            if (filtros == null)
            {
                return(queryble);
            }

            if (!string.IsNullOrEmpty(filtros.Nu_protocolo))
            {
                queryble = queryble.Where(x => x.Protocolo.Nu_protocolo == filtros.Nu_protocolo);
            }

            if (!string.IsNullOrEmpty(filtros.St_chamado))
            {
                var chamadosId = ChamadosId(db, filtros);
                queryble = queryble.Where(x => chamadosId.Contains(x.Id));
            }

            if (!string.IsNullOrEmpty(filtros.CpfOuCnpj))
            {
                queryble = queryble.Where(x => x.Beneficiario.Co_cpf_cnpj == filtros.CpfOuCnpj);
            }

            if (filtros.EstaNoSla != null)
            {
                queryble = queryble.Where(x => x.EstaNoSla == filtros.EstaNoSla.GetValueOrDefault());
            }

            if (filtros.Dt_inicio != DateTime.MinValue && filtros.Dt_inicio != DateTime.MinValue)
            {
                queryble = queryble.Where(x => x.Dt_criacao >= filtros.Dt_inicio && x.Dt_criacao <= filtros.Dt_fim);
            }

            if (!string.IsNullOrEmpty(filtros.No_categoria))
            {
                queryble = queryble.Where(x => x.Sub_categoria.Categoria_setor.No_categoria_setor == filtros.No_categoria);
            }

            if (!string.IsNullOrEmpty(filtros.Tp_chamado))
            {
                queryble = queryble.Where(x => x.Tp_chamado == filtros.Tp_chamado);
            }

            if (!string.IsNullOrEmpty(filtros.Autor))
            {
                queryble = queryble.Where(x => x.Beneficiario.No_beneficiario.Equals(filtros.Autor, StringComparison.InvariantCultureIgnoreCase));
            }

            if (filtros.SetorOrigemId != 0)
            {
                var chamadosId = db.Historico_chamado.Where(x => x.SetorOrigemId == filtros.SetorOrigemId && x.St_chamado == Historico_chamado.TP_ABERTO).Select(x => x.ChamadoId);
                queryble = queryble.Where(x => chamadosId.Contains(x.Id));
            }

            return(queryble);
        }
Example #12
0
 public ProtocoloController(DbWorkFlow db)
 {
     _db = db;
 }