public List<Cheque> Consultar(Cheque cheque, TipoPesquisa tipoPesquisa)
        {
            List<Cheque> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (cheque.ID != 0)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.ID == cheque.ID
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Parcela.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Parcela.HasValue && c.Parcela.Value == cheque.Parcela.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Agencia))
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Agencia.Contains(cheque.Agencia)
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Banco))
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Banco.Contains(cheque.Banco)
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Conta))
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Conta.Contains(cheque.Conta)
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Cpf))
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Cpf.Contains(cheque.Cpf)
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Tipo != 0)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Tipo == cheque.Tipo
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Parcela.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Parcela.HasValue && c.Parcela.Value == cheque.Parcela.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.NumCheque.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.NumCheque.HasValue && c.NumCheque.Value == cheque.NumCheque.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Status.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Status.HasValue && c.Status.Value == cheque.Status.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Valor.HasValue)
                        {

                            resultado = ((from c in resultado
                                          where
                                          c.Valor.HasValue && c.Valor.Value == cheque.Valor.Value
                                          select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (cheque.ID != 0)
                        {
                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.ID == cheque.ID
                                                select c).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Parcela.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Parcela.HasValue && c.Parcela.Value == cheque.Parcela.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Agencia))
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Agencia.Contains(cheque.Agencia)
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Banco))
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Banco.Contains(cheque.Banco)
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Conta))
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Conta.Contains(cheque.Conta)
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(cheque.Cpf))
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Cpf.Contains(cheque.Cpf)
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Tipo != 0)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Tipo == cheque.Tipo
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Parcela.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Parcela.HasValue && c.Parcela.Value == cheque.Parcela.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.NumCheque.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.NumCheque.HasValue && c.NumCheque.Value == cheque.NumCheque.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Status.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Status.HasValue && c.Status.Value == cheque.Status.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (cheque.Valor.HasValue)
                        {

                            resultado.AddRange((from c in Consultar()
                                                where
                                                c.Valor.HasValue && c.Valor.Value == cheque.Valor.Value
                                                select c).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List <PrazoPagamento> Consultar(PrazoPagamento prazoPagamento, TipoPesquisa tipoPesquisa)
        {
            List <PrazoPagamento> prazoPagamentoList = this.prazoPagamentoRepositorio.Consultar(prazoPagamento, tipoPesquisa);

            return(prazoPagamentoList);
        }
        public List<BoletoMensalidade> Consultar(BoletoMensalidade boletoMensalidade, TipoPesquisa tipoPesquisa)
        {
            List<BoletoMensalidade> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {

                        if (boletoMensalidade.ID != 0)
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.ID == boletoMensalidade.ID
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.MatriculaID != 0 && boletoMensalidade.MatriculaID != null)
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.MatriculaID == boletoMensalidade.MatriculaID
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.DataEmissao != default(DateTime))
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.DataEmissao == boletoMensalidade.DataEmissao
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.DataPagamento.HasValue && boletoMensalidade.DataPagamento.Value != default(DateTime))
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.DataPagamento.HasValue && bm.DataPagamento.Value == boletoMensalidade.DataPagamento.Value
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.DataVencimento != default(DateTime))
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.DataVencimento == boletoMensalidade.DataVencimento
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.Desconto.HasValue)
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.Desconto.HasValue && bm.Desconto.Value == boletoMensalidade.Desconto.Value
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(boletoMensalidade.Descricao))
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.Descricao.Contains(boletoMensalidade.Descricao)
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.Multa.HasValue)
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.Multa.HasValue && bm.Multa.Value == boletoMensalidade.Multa.Value
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.Status.HasValue && boletoMensalidade.Status.Value != default(byte))
                        {

                            resultado = ((from bm in resultado
                                          where
                                          bm.Status.HasValue && bm.Status.Value == boletoMensalidade.Status.Value
                                          select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {

                        if (boletoMensalidade.ID != 0)
                        {

                            resultado.AddRange((from bm in Consultar()
                                                where
                                                bm.ID == boletoMensalidade.ID
                                                select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.DataEmissao != default(DateTime))
                        {

                            resultado.AddRange((from bm in Consultar()
                                                where
                                                bm.DataEmissao == boletoMensalidade.DataEmissao
                                                select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.DataPagamento.HasValue && boletoMensalidade.DataPagamento.Value != default(DateTime))
                        {

                            resultado.AddRange((from bm in Consultar()
                                                where
                                                bm.DataPagamento.HasValue && bm.DataPagamento.Value == boletoMensalidade.DataPagamento.Value
                                                select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.DataVencimento != default(DateTime))
                        {

                            resultado.AddRange((from bm in Consultar()
                                                where
                                                bm.DataVencimento == boletoMensalidade.DataVencimento
                                                select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.Desconto.HasValue)
                        {

                            resultado.AddRange((from bm in Consultar()
                                                where
                                                bm.Desconto.HasValue && bm.Desconto.Value == boletoMensalidade.Desconto.Value
                                                select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(boletoMensalidade.Descricao))
                        {

                            resultado.AddRange((from bm in Consultar()
                                                where
                                                bm.Descricao.Contains(boletoMensalidade.Descricao)
                                                select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.Multa.HasValue)
                        {

                            resultado.AddRange((from bm in Consultar()
                                                where
                                                bm.Multa.HasValue && bm.Multa.Value == boletoMensalidade.Multa.Value
                                                select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (boletoMensalidade.Status.HasValue && boletoMensalidade.Status.Value != default(byte))
                        {

                            resultado.AddRange((from bm in Consultar()
                                                where
                                                bm.Status.HasValue && bm.Status.Value == boletoMensalidade.Status.Value
                                                select bm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List<Disciplina> Consultar(Disciplina disciplina, TipoPesquisa tipoPesquisa)
        {
            List<Disciplina> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (disciplina.ID != 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.ID == disciplina.ID
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (disciplina.TipoAvaliacao.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.TipoAvaliacao.HasValue && d.TipoAvaliacao.Value == disciplina.TipoAvaliacao.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(disciplina.Nome))
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Nome.Contains(disciplina.Nome)
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (disciplina.Status.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Status.HasValue && d.Status.Value == disciplina.Status.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (disciplina.ID != 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.ID == disciplina.ID
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (disciplina.TipoAvaliacao.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.TipoAvaliacao.HasValue && d.TipoAvaliacao.Value == disciplina.TipoAvaliacao.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(disciplina.Nome))
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Nome.Contains(disciplina.Nome)
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (disciplina.Status.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Status.HasValue && d.Status.Value == disciplina.Status.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List<SalaPeriodo> Consultar(SalaPeriodo salaPeriodo, TipoPesquisa tipoPesquisa)
        {
            List<SalaPeriodo> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (salaPeriodo.ID != 0)
                        {

                            resultado = ((from sp in resultado
                                          where
                                          sp.ID == salaPeriodo.ID
                                          select sp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (salaPeriodo.Ano.HasValue)
                        {

                            resultado = ((from sp in resultado
                                          where
                                          sp.Ano.HasValue && sp.Ano.Value == salaPeriodo.Ano.Value
                                          select sp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (salaPeriodo.ID != 0)
                        {
                            resultado.AddRange((from sp in Consultar()
                                                where
                                                sp.ID == salaPeriodo.ID
                                                select sp).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        if (salaPeriodo.Ano.HasValue)
                        {
                            resultado.AddRange((from sp in Consultar()
                                                where
                                                sp.Ano.HasValue && sp.Ano.Value == salaPeriodo.Ano.Value
                                                select sp).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
Пример #6
0
        public List <Usuario> Consultar(Usuario usuario, TipoPesquisa tipoPesquisa)
        {
            List <Usuario> usuarioList = this.usuarioRepositorio.Consultar(usuario, tipoPesquisa);

            return(usuarioList);
        }
        public List<ProfessorDisciplinaSala> Consultar(ProfessorDisciplinaSala professorDisciplinaSala, TipoPesquisa tipoPesquisa)
        {
            List<ProfessorDisciplinaSala> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (professorDisciplinaSala.ID != 0)
                        {

                            resultado = ((from pds in resultado
                                          where
                                          pds.ID == professorDisciplinaSala.ID
                                          select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (professorDisciplinaSala.DataPeriodo.HasValue && professorDisciplinaSala.DataPeriodo.Value != default(DateTime))
                        {

                            resultado = ((from pds in resultado
                                          where
                                          pds.DataPeriodo.HasValue && pds.DataPeriodo.Value == professorDisciplinaSala.DataPeriodo.Value
                                          select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        if (professorDisciplinaSala.DisciplinaID.HasValue)
                        {

                            resultado = ((from pds in resultado
                                          where
                                          pds.DisciplinaID.HasValue && pds.DisciplinaID.Value == professorDisciplinaSala.DisciplinaID.Value
                                          select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (professorDisciplinaSala.FuncionarioID.HasValue)
                        {

                            resultado = ((from pds in resultado
                                          where
                                          pds.FuncionarioID.HasValue && pds.FuncionarioID.Value == professorDisciplinaSala.FuncionarioID.Value
                                          select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (professorDisciplinaSala.SalaPeriodoID.HasValue)
                        {

                            resultado = ((from pds in resultado
                                          where
                                          pds.SalaPeriodoID.HasValue && pds.SalaPeriodoID.Value == professorDisciplinaSala.SalaPeriodoID.Value
                                          select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (professorDisciplinaSala.Status.HasValue)
                        {

                            resultado = ((from pds in resultado
                                          where
                                          pds.Status.HasValue && pds.Status.Value == professorDisciplinaSala.Status.Value
                                          select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (professorDisciplinaSala.ID != 0)
                        {

                            resultado.AddRange((from pds in Consultar()
                                                where
                                                pds.ID == professorDisciplinaSala.ID
                                                select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (professorDisciplinaSala.DataPeriodo.HasValue && professorDisciplinaSala.DataPeriodo.Value != default(DateTime))
                        {

                            resultado.AddRange((from pds in Consultar()
                                                where
                                                pds.DataPeriodo.HasValue && pds.DataPeriodo.Value == professorDisciplinaSala.DataPeriodo.Value
                                                select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        if (professorDisciplinaSala.DisciplinaID.HasValue)
                        {

                            resultado.AddRange((from pds in Consultar()
                                                where
                                                pds.DisciplinaID.HasValue && pds.DisciplinaID.Value == professorDisciplinaSala.DisciplinaID.Value
                                                select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (professorDisciplinaSala.FuncionarioID.HasValue)
                        {

                            resultado.AddRange((from pds in Consultar()
                                                where
                                                pds.FuncionarioID.HasValue && pds.FuncionarioID.Value == professorDisciplinaSala.FuncionarioID.Value
                                                select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (professorDisciplinaSala.SalaPeriodoID.HasValue)
                        {

                            resultado.AddRange((from pds in Consultar()
                                                where
                                                pds.SalaPeriodoID.HasValue && pds.SalaPeriodoID.Value == professorDisciplinaSala.SalaPeriodoID.Value
                                                select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (professorDisciplinaSala.Status.HasValue)
                        {

                            resultado.AddRange((from pds in Consultar()
                                                where
                                                pds.Status.HasValue && pds.Status.Value == professorDisciplinaSala.Status.Value
                                                select pds).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
Пример #8
0
        public ClienteViewModelApi Pesquisar(int codigo, string descricao, TipoPesquisa tipoPesquisa)
        {
            if (codigo == 0 && tipoPesquisa == TipoPesquisa.Id)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(descricao) && tipoPesquisa == TipoPesquisa.Descricao)
            {
                return(null);
            }

            if (tipoPesquisa == TipoPesquisa.Tela)
            {
                frmCliente formulario = new frmCliente("000000");
                if (Tela.AbrirFormularioModal(formulario))
                {
                    if (Funcoes.IdSelecionado == 0)
                    {
                        return(null);
                    }

                    return(_clienteApp.ObterPorId(Funcoes.IdSelecionado));
                }
            }

            if (tipoPesquisa == TipoPesquisa.Id && codigo > 0)
            {
                var model = _clienteApp.ObterPorCodigo(codigo);
                if (model == null || model.Codigo == 0)
                {
                    throw new Exception("Registro não encontrado!");
                }
                return(model);
            }

            if (tipoPesquisa == TipoPesquisa.Descricao && descricao.Length > 0)
            {
                var filtro = new ClienteFiltroViewModelApi();
                filtro.Campo     = "Cli_Nome";
                filtro.Valor     = descricao;
                filtro.Ativo     = "A";
                filtro.Restricao = 2;

                var model = _clienteApp.Filtrar(filtro, Funcoes.IdUsuario);

                if (model == null)
                {
                    frmCliente formulario = new frmCliente();
                    if (Tela.AbrirFormularioModal(formulario))
                    {
                        return(_clienteApp.ObterPorId(Funcoes.IdSelecionado));
                    }
                    return(null);
                }
                else
                {
                    if (model.Count() == 1)
                    {
                        return(_clienteApp.ObterPorId(model.First().Id));
                    }
                    else
                    {
                        frmCliente formulario = new frmCliente(descricao);
                        if (Tela.AbrirFormularioModal(formulario))
                        {
                            return(_clienteApp.ObterPorId(Funcoes.IdSelecionado));
                        }
                    }
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
        public List<Matricula> Consultar(Matricula matricula, TipoPesquisa tipoPesquisa)
        {
            List<Matricula> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (matricula.ID != 0)
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.ID == matricula.ID
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.DataMatricula.HasValue && matricula.DataMatricula.Value != default(DateTime))
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.DataMatricula.HasValue && m.DataMatricula.Value == matricula.DataMatricula.Value
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.AlunoID.HasValue && matricula.AlunoID.Value != 0)
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.AlunoID.HasValue && m.AlunoID.Value == matricula.AlunoID.Value
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.Aluno != null)
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.Aluno.Nome.ToLower().Contains(matricula.Aluno.Nome.ToLower())
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.DescontoID.HasValue)
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.DescontoID.HasValue && m.DescontoID.Value == matricula.DescontoID.Value
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.SalaPeriodoID.HasValue)
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.SalaPeriodoID.HasValue && m.SalaPeriodoID.Value == matricula.SalaPeriodoID.Value
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.Valor.HasValue)
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.Valor.HasValue && m.Valor.Value == matricula.Valor.Value
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(matricula.NumMatricula))
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.NumMatricula.Contains(matricula.NumMatricula)
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.Status.HasValue)
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.Status.HasValue && m.Status.Value == matricula.Status.Value
                                          select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (matricula.ID != 0)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.ID == matricula.ID
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.DataMatricula.HasValue && matricula.DataMatricula.Value != default(DateTime))
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.DataMatricula.HasValue && m.DataMatricula.Value == matricula.DataMatricula.Value
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.Aluno != null)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.Aluno.Nome.Contains(matricula.Aluno.Nome)
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.AlunoID.HasValue)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.AlunoID.HasValue && m.AlunoID.Value == matricula.AlunoID.Value
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.DescontoID.HasValue)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.DescontoID.HasValue && m.DescontoID.Value == matricula.DescontoID.Value
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.SalaPeriodoID.HasValue)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.SalaPeriodoID.HasValue && m.SalaPeriodoID.Value == matricula.SalaPeriodoID.Value
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.Valor.HasValue)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.Valor.HasValue && m.Valor.Value == matricula.Valor.Value
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(matricula.NumMatricula))
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.NumMatricula.Contains(matricula.NumMatricula)
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matricula.Status.HasValue)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.Status.HasValue && m.Status.Value == matricula.Status.Value
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
Пример #10
0
 private void SwitchTipoPesquisa()
 {
     clearFields();
     if (mTipoPesquisaSeleccionada == TipoPesquisa.simples)
     {
         mTipoPesquisaSeleccionada = TipoPesquisa.avancada;
         TabControl1.BringToFront();
         ToolBarButtonTipoPesquisa.ImageIndex = 3;
         ToolBarButtonTipoPesquisa.ToolTipText = SharedResourcesOld.CurrentSharedResources.PesquisaSimplesString;
     }
     else
     {
         mTipoPesquisaSeleccionada = TipoPesquisa.simples;
         panel1.BringToFront();
         ToolBarButtonTipoPesquisa.ImageIndex = 4;
         ToolBarButtonTipoPesquisa.ToolTipText = SharedResourcesOld.CurrentSharedResources.PesquisaAvancadaString;
     }
 }
        public List<ChequeBoletoAtividade> Consultar(ChequeBoletoAtividade chequeBoletoAtividade, TipoPesquisa tipoPesquisa)
        {
            List<ChequeBoletoAtividade> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (chequeBoletoAtividade.ID != 0)
                        {

                            resultado = ((from cba in resultado
                                          where
                                          cba.ID == chequeBoletoAtividade.ID
                                          select cba).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoAtividade.BoletoAtividadeID != 0)
                        {

                            resultado = ((from cba in resultado
                                          where
                                          cba.BoletoAtividadeID == chequeBoletoAtividade.BoletoAtividadeID
                                          select cba).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoAtividade.ChequeID != 0)
                        {

                            resultado = ((from cba in resultado
                                          where
                                          cba.ChequeID == chequeBoletoAtividade.ChequeID
                                          select cba).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (chequeBoletoAtividade.ID != 0)
                        {

                            resultado.AddRange((from cba in Consultar()
                                                where
                                                cba.ID == chequeBoletoAtividade.ID
                                                select cba).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoAtividade.BoletoAtividadeID != 0)
                        {

                            resultado.AddRange((from cba in Consultar()
                                                where
                                                cba.BoletoAtividadeID == chequeBoletoAtividade.BoletoAtividadeID
                                                select cba).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoAtividade.ChequeID != 0)
                        {

                            resultado.AddRange((from cba in Consultar()
                                                where
                                                cba.ChequeID == chequeBoletoAtividade.ChequeID
                                                select cba).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List<Desconto> Consultar(Desconto desconto, TipoPesquisa tipoPesquisa)
        {
            List<Desconto> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (desconto.ID != 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.ID == desconto.ID
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(desconto.Descricao))
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Descricao.Contains(desconto.Descricao)
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (desconto.Status.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Status.HasValue && d.Status.Value == desconto.Status.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (desconto.Percentual != 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                           d.Percentual == desconto.Percentual
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (desconto.ID != 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.ID == desconto.ID
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(desconto.Descricao))
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Descricao.Contains(desconto.Descricao)
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (desconto.Status.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Status.HasValue && d.Status.Value == desconto.Status.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (desconto.Percentual != 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                 d.Percentual == desconto.Percentual
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List<Perfil> Consultar(Perfil perfil, TipoPesquisa tipoPesquisa)
        {
            List<Perfil> resultado = Consultar();
            bool pesquisa = false;
            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (perfil.ID != 0)
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.ID == perfil.ID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (perfil.Status.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Status.HasValue && d.Status.Value == perfil.Status.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(perfil.Descricao))
                        {

                            resultado = ((from d in resultado
                                          where
                                           d.Descricao.Contains(perfil.Descricao)
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (perfil.ID != 0)
                        {

                            resultado.AddRange((from p in Consultar()
                                                where
                                                p.ID == perfil.ID
                                                select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (perfil.Status.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Status.HasValue && d.Status.Value == perfil.Status.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(perfil.Descricao))
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                 d.Descricao.Contains(perfil.Descricao)
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List <Escolaridade> Consultar(Escolaridade escolaridade, TipoPesquisa tipoPesquisa)
        {
            List <Escolaridade> escolaridadeList = this.escolaridadeRepositorio.Consultar(escolaridade, tipoPesquisa);

            return(escolaridadeList);
        }
Пример #15
0
        public static string AplicarMascaraPorTipo(string nome, TipoPesquisa tipoPesquisa)
        {
            string[] nomeArray;
            string   retorno;

            switch (tipoPesquisa)
            {
            case TipoPesquisa.Nome:
                nomeArray = nome.Split(' ');
                string valorMascarado = "";
                if (nomeArray.Length == 2)
                {
                    var nomemeio = nomeArray.Skip(1);

                    foreach (var item in nomemeio.Take(nomemeio.Count() - 1))
                    {
                        valorMascarado = string.Format("{0} {1}", valorMascarado, item);
                    }

                    retorno = string.Concat("{0} {1}", nomeArray.First(), string.Concat(Enumerable.Repeat('#', valorMascarado.Length).ToArray()));
                }
                else if (nomeArray.Length > 2)
                {
                    var nomemeio = nomeArray.Skip(1);

                    foreach (var item in nomemeio.Take(nomemeio.Count() - 1))
                    {
                        valorMascarado = string.Format("{0} {1}", valorMascarado, item).Trim();
                    }
                    retorno = string.Format("{0} {2} {1}", nomeArray.First(), nomeArray.Last(), string.Concat(Enumerable.Repeat('#', valorMascarado.Length).ToArray()));
                }
                else
                {
                    retorno = nomeArray.FirstOrDefault();
                }
                break;

            case TipoPesquisa.CPF:
                if (nome.Length == 11)
                {
                    retorno = string.Format("{0}{1}", string.Concat(nome.Take(9).ToArray()), string.Concat(Enumerable.Repeat('#', 2).ToArray()));
                }
                else
                {
                    retorno = string.Format("{0}{1}", string.Concat(nome.Take(11).ToArray()), string.Concat(Enumerable.Repeat('#', 3).ToArray()));
                }
                break;

            case TipoPesquisa.Email:
                MailAddress addr = new MailAddress(nome);
                retorno = string.Concat("{0}@{1}", addr.User, string.Concat(Enumerable.Repeat('#', addr.Host.Length).ToArray()));
                break;

            //case TipoPesquisa.Endereco:
            //    retorno ="";
            //    break;
            //case TipoPesquisa.Telefone:
            //    retorno = string.Concat("#####{0}", nome.Substring(5));
            //    break;
            case TipoPesquisa.Nenhum:
                retorno = nome;
                break;

            default:
                retorno = nome;
                break;
            }
            return(retorno);
        }
Пример #16
0
        public List <Perfil> Consultar(Perfil perfil, TipoPesquisa tipoPesquisa)
        {
            List <Perfil> perfilList = this.perfilRepositorio.Consultar(perfil, tipoPesquisa);

            return(perfilList);
        }
        public List <SalaPeriodo> Consultar(SalaPeriodo salaPeriodo, TipoPesquisa tipoPesquisa)
        {
            List <SalaPeriodo> salaPeriodoList = this.salaPeriodoRepositorio.Consultar(salaPeriodo, tipoPesquisa);

            return(salaPeriodoList);
        }
Пример #18
0
        public List <Lider> Consultar(Lider lider, TipoPesquisa tipoPesquisa)
        {
            List <Lider> liderList = this.liderRepositorio.Consultar(lider, tipoPesquisa);

            return(liderList);
        }
Пример #19
0
        public List <ContasAPagar> Consultar(ContasAPagar contasAPagar, TipoPesquisa tipoPesquisa)
        {
            List <ContasAPagar> contasAPagarList = this.contasAPagarRepositorio.Consultar(contasAPagar, tipoPesquisa);

            return(contasAPagarList);
        }
Пример #20
0
        public CidadeViewModel Pesquisar(int codigo, string descricao, TipoPesquisa tipoPesquisa)
        {
            if (codigo == 0 && tipoPesquisa == TipoPesquisa.Id)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(descricao) && tipoPesquisa == TipoPesquisa.Descricao)
            {
                return(null);
            }

            if (tipoPesquisa == TipoPesquisa.Tela)
            {
                frmCidade formulario = new frmCidade("");
                if (Tela.AbrirFormularioModal(formulario))
                {
                    if (Funcoes.IdSelecionado == 0)
                    {
                        return(null);
                    }

                    return(_cidadeApp.ObterPorId(Funcoes.IdSelecionado));
                }
            }

            if (tipoPesquisa == TipoPesquisa.Id && codigo > 0)
            {
                var model = _cidadeApp.ObterPorCodigo(codigo);
                if (model == null || model.Codigo == 0)
                {
                    throw new Exception("Registro não encontrado!");
                }
                return(model);
            }

            if (tipoPesquisa == TipoPesquisa.Descricao && descricao.Length > 0)
            {
                var model = _cidadeApp.Filtrar("Cid_Nome", descricao);
                if (model == null)
                {
                    frmCidade formulario = new frmCidade();
                    if (Tela.AbrirFormularioModal(formulario))
                    {
                        return(_cidadeApp.ObterPorId(Funcoes.IdSelecionado));
                    }
                    return(null);
                }
                else
                {
                    if (model.Count() == 1)
                    {
                        return(_cidadeApp.ObterPorId(model.First().Id));
                    }
                    else
                    {
                        frmCidade formulario = new frmCidade(descricao);
                        if (Tela.AbrirFormularioModal(formulario))
                        {
                            return(_cidadeApp.ObterPorId(Funcoes.IdSelecionado));
                        }
                    }
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Пример #21
0
        public List <Localidades> Consultar(Localidades localidade, TipoPesquisa tipoPesquisa)
        {
            List <Localidades> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (localidade.ID != 0)
                {
                    resultado = ((from p in resultado
                                  where
                                  p.ID == localidade.ID
                                  select p).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (!string.IsNullOrEmpty(localidade.Descricao))
                {
                    resultado = ((from p in resultado
                                  where
                                  p.Descricao.Contains(localidade.Descricao)
                                  select p).ToList());


                    resultado = resultado.Distinct().ToList();
                }



                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (localidade.ID != 0)
                {
                    resultado.AddRange((from p in resultado
                                        where
                                        p.ID == localidade.ID
                                        select p).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (!string.IsNullOrEmpty(localidade.Descricao))
                {
                    resultado.AddRange((from p in resultado
                                        where
                                        p.Descricao.Contains(localidade.Descricao)
                                        select p).ToList());


                    resultado = resultado.Distinct().ToList();
                }



                break;
            }
                #endregion
            }

            return(resultado);
        }
        public List<Atividade> Consultar(Atividade atividade, TipoPesquisa tipoPesquisa)
        {
            List<Atividade> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (atividade.ID != 0)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.ID == atividade.ID
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(atividade.Nome))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Nome.Contains(atividade.Nome)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(atividade.Descricao))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Descricao.Contains(atividade.Descricao)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (atividade.Status.HasValue)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Status.HasValue && a.Status.Value == atividade.Status.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (atividade.ID != 0)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.ID == atividade.ID
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(atividade.Nome))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nome.Contains(atividade.Nome)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(atividade.Descricao))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Descricao.Contains(atividade.Descricao)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (atividade.Status.HasValue)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Status.HasValue && a.Status.Value == atividade.Status.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
Пример #23
0
        public List <Cliente> Consultar(Cliente cliente, TipoPesquisa tipoPesquisa)
        {
            List <Cliente> clienteList = this.clienteRepositorio.Consultar(cliente, tipoPesquisa);

            return(clienteList);
        }
        public List<Turma> Consultar(Turma turma, TipoPesquisa tipoPesquisa)
        {
            List<Turma> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (turma.ID != 0)
                        {

                            resultado = ((from t in resultado
                                          where
                                          t.ID == turma.ID
                                          select t).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(turma.Nome))
                        {

                            resultado = ((from t in resultado
                                          where
                                          t.Nome.Contains(turma.Nome)
                                          select t).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (turma.Status.HasValue)
                        {

                            resultado = ((from t in resultado
                                          where
                                          t.Status.HasValue && t.Status.Value == turma.Status.Value
                                          select t).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (turma.ID != 0)
                        {

                            resultado.AddRange((from t in Consultar()
                                                where
                                                t.ID == turma.ID
                                                select t).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(turma.Nome))
                        {

                            resultado.AddRange((from t in Consultar()
                                                where
                                                t.Nome.Contains(turma.Nome)
                                                select t).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (turma.Status.HasValue)
                        {

                            resultado.AddRange((from t in Consultar()
                                                where
                                                t.Status.HasValue && t.Status.Value == turma.Status.Value
                                                select t).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
Пример #25
0
        public List <Serie> Consultar(Serie serie, TipoPesquisa tipoPesquisa)
        {
            List <Serie> serieList = this.serieRepositorio.Consultar(serie, tipoPesquisa);

            return(serieList);
        }
        public List<Postagem> Consultar(Postagem postagem, TipoPesquisa tipoPesquisa)
        {
            List<Postagem> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (postagem.ID != 0)
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.ID == postagem.ID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(postagem.Titulo))
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.Titulo.Contains(postagem.Titulo)
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                       }

                        if (postagem.Pagina != 0)
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.Pagina  == postagem.Pagina
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (postagem.Local != 0)
                        {

                            resultado =((from p in resultado
                                          where
                                          p.Local  == postagem.Local
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (postagem.Tipo != 0)
                        {

                            resultado =((from p in resultado
                                          where
                                          p.Tipo  == postagem.Tipo
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (postagem.EmDestaque.HasValue)
                        {

                            resultado =((from p in resultado
                                          where
                                          p.EmDestaque.HasValue && p.EmDestaque.Value== postagem.EmDestaque
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                       break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (postagem.ID != 0)
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.ID == postagem.ID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(postagem.Titulo))
                        {

                            resultado.AddRange ((from p in resultado
                                          where
                                          p.Titulo.Contains(postagem.Titulo)
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                       }

                        if (postagem.Pagina != 0)
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.Pagina  == postagem.Pagina
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (postagem.Local != 0)
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.Local  == postagem.Local
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (postagem.Tipo != 0)
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.Tipo  == postagem.Tipo
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (postagem.EmDestaque.HasValue)
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.EmDestaque.HasValue && p.EmDestaque.Value == postagem.EmDestaque
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                       break;
                    }
                #endregion
            }

            return resultado;
        }
Пример #27
0
        public List <MatriculaVinculo> Consultar(MatriculaVinculo matriculaVinculo, TipoPesquisa tipoPesquisa)
        {
            List <MatriculaVinculo> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (matriculaVinculo.ID != 0)
                {
                    resultado = ((from m in resultado
                                  where
                                  m.ID == matriculaVinculo.ID
                                  select m).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                if (matriculaVinculo.MatriculaMestreID != 0)
                {
                    resultado = ((from m in resultado
                                  where
                                  m.MatriculaMestreID == matriculaVinculo.MatriculaMestreID
                                  select m).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                if (matriculaVinculo.MatriculaDependenteID != 0)
                {
                    resultado = ((from m in resultado
                                  where
                                  m.MatriculaDependenteID == matriculaVinculo.MatriculaDependenteID
                                  select m).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                if (matriculaVinculo.ID != 0)
                {
                    resultado = ((from m in resultado
                                  where
                                  m.ID == matriculaVinculo.ID
                                  select m).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                if (matriculaVinculo.Status.HasValue)
                {
                    resultado = ((from m in resultado
                                  where
                                  m.Status.HasValue && m.Status.Value == matriculaVinculo.Status.Value
                                  select m).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (matriculaVinculo.ID != 0)
                {
                    resultado.AddRange((from m in Consultar()
                                        where
                                        m.ID == matriculaVinculo.ID
                                        select m).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (matriculaVinculo.MatriculaMestreID != 0)
                {
                    resultado.AddRange((from m in Consultar()
                                        where
                                        m.MatriculaMestreID == matriculaVinculo.MatriculaMestreID
                                        select m).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (matriculaVinculo.MatriculaDependenteID != 0)
                {
                    resultado.AddRange((from m in Consultar()
                                        where
                                        m.MatriculaDependenteID == matriculaVinculo.MatriculaDependenteID
                                        select m).ToList());

                    resultado = resultado.Distinct().ToList();
                }


                if (matriculaVinculo.Status.HasValue)
                {
                    resultado.AddRange((from m in Consultar()
                                        where
                                        m.Status.HasValue && m.Status.Value == matriculaVinculo.Status.Value
                                        select m).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                break;
            }

                #endregion
            default:
                break;
            }

            return(resultado);
        }
Пример #28
0
        public List <Despesa> Consultar(Despesa Despesa, TipoPesquisa tipoPesquisa)
        {
            List <Despesa> DespesaList = this.DespesaRepositorio.Consultar(Despesa, tipoPesquisa);

            return(DespesaList);
        }
        public List <ProfessorDisciplinaSala> Consultar(ProfessorDisciplinaSala professorDisciplinaSala, TipoPesquisa tipoPesquisa)
        {
            List <ProfessorDisciplinaSala> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (professorDisciplinaSala.ID != 0)
                {
                    resultado = ((from pds in resultado
                                  where
                                  pds.ID == professorDisciplinaSala.ID
                                  select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (professorDisciplinaSala.DataPeriodo.HasValue && professorDisciplinaSala.DataPeriodo.Value != default(DateTime))
                {
                    resultado = ((from pds in resultado
                                  where
                                  pds.DataPeriodo.HasValue && pds.DataPeriodo.Value == professorDisciplinaSala.DataPeriodo.Value
                                  select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }
                if (professorDisciplinaSala.DisciplinaID.HasValue)
                {
                    resultado = ((from pds in resultado
                                  where
                                  pds.DisciplinaID.HasValue && pds.DisciplinaID.Value == professorDisciplinaSala.DisciplinaID.Value
                                  select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (professorDisciplinaSala.FuncionarioID.HasValue)
                {
                    resultado = ((from pds in resultado
                                  where
                                  pds.FuncionarioID.HasValue && pds.FuncionarioID.Value == professorDisciplinaSala.FuncionarioID.Value
                                  select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (professorDisciplinaSala.SalaPeriodoID.HasValue)
                {
                    resultado = ((from pds in resultado
                                  where
                                  pds.SalaPeriodoID.HasValue && pds.SalaPeriodoID.Value == professorDisciplinaSala.SalaPeriodoID.Value
                                  select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (professorDisciplinaSala.Status.HasValue)
                {
                    resultado = ((from pds in resultado
                                  where
                                  pds.Status.HasValue && pds.Status.Value == professorDisciplinaSala.Status.Value
                                  select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (professorDisciplinaSala.ID != 0)
                {
                    resultado.AddRange((from pds in Consultar()
                                        where
                                        pds.ID == professorDisciplinaSala.ID
                                        select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (professorDisciplinaSala.DataPeriodo.HasValue && professorDisciplinaSala.DataPeriodo.Value != default(DateTime))
                {
                    resultado.AddRange((from pds in Consultar()
                                        where
                                        pds.DataPeriodo.HasValue && pds.DataPeriodo.Value == professorDisciplinaSala.DataPeriodo.Value
                                        select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }
                if (professorDisciplinaSala.DisciplinaID.HasValue)
                {
                    resultado.AddRange((from pds in Consultar()
                                        where
                                        pds.DisciplinaID.HasValue && pds.DisciplinaID.Value == professorDisciplinaSala.DisciplinaID.Value
                                        select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (professorDisciplinaSala.FuncionarioID.HasValue)
                {
                    resultado.AddRange((from pds in Consultar()
                                        where
                                        pds.FuncionarioID.HasValue && pds.FuncionarioID.Value == professorDisciplinaSala.FuncionarioID.Value
                                        select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (professorDisciplinaSala.SalaPeriodoID.HasValue)
                {
                    resultado.AddRange((from pds in Consultar()
                                        where
                                        pds.SalaPeriodoID.HasValue && pds.SalaPeriodoID.Value == professorDisciplinaSala.SalaPeriodoID.Value
                                        select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (professorDisciplinaSala.Status.HasValue)
                {
                    resultado.AddRange((from pds in Consultar()
                                        where
                                        pds.Status.HasValue && pds.Status.Value == professorDisciplinaSala.Status.Value
                                        select pds).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                break;
            }

                #endregion
            default:
                break;
            }

            return(resultado);
        }
Пример #30
0
        public List <Cliente> Consultar(Cliente cliente, TipoPesquisa tipoPesquisa)
        {
            List <Cliente> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (cliente.id != 0)
                {
                    resultado = ((from c in resultado
                                  where
                                  c.id == cliente.id
                                  select c).ToList());

                    resultado = resultado.Distinct().ToList();
                }
                else
                {
                    if (cliente.area_id != 0)
                    {
                        resultado = ((from c in resultado
                                      where
                                      c.area_id == cliente.area_id
                                      select c).ToList());

                        resultado = resultado.Distinct().ToList();
                    }
                }

                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (cliente.id != 0)
                {
                    resultado.AddRange((from c in Consultar()
                                        where
                                        c.id == cliente.id
                                        select c).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                if (cliente.area_id != 0)
                {
                    resultado.AddRange((from c in Consultar()
                                        where
                                        c.area_id == cliente.area_id
                                        select c).ToList());
                    resultado = resultado.Distinct().ToList();
                }


                break;
            }

                #endregion
            default:
                break;
            }

            return(resultado);
        }
        public List<Funcionario> Consultar(Funcionario funcionario, TipoPesquisa tipoPesquisa)
        {
            List<Funcionario> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        #region ID
                        if (funcionario.ID != 0)
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.ID == funcionario.ID
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Alergico
                        if (!string.IsNullOrEmpty(funcionario.Alergico))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Alergico.Contains(funcionario.Alergico)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Bairro
                        if (!string.IsNullOrEmpty(funcionario.Bairro))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Bairro.Contains(funcionario.Bairro)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Cargo
                        if (!string.IsNullOrEmpty(funcionario.Cargo))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Cargo.Contains(funcionario.Cargo)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Cep
                        if (!string.IsNullOrEmpty(funcionario.Cep))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Cep.Contains(funcionario.Cep)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Cidade
                        if (!string.IsNullOrEmpty(funcionario.Cidade))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Cidade.Contains(funcionario.Cidade)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Cpf
                        if (!string.IsNullOrEmpty(funcionario.Cpf))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Cpf.Contains(funcionario.Cpf)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Ctps
                        if (!string.IsNullOrEmpty(funcionario.Ctps))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Ctps.Contains(funcionario.Ctps)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region ContatoEmergencia
                        if (!string.IsNullOrEmpty(funcionario.ContatoEmergencia))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.ContatoEmergencia.Contains(funcionario.ContatoEmergencia)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region ComplementoEndereco
                        if (!string.IsNullOrEmpty(funcionario.ComplementoEndereco))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.ComplementoEndereco.Contains(funcionario.ComplementoEndereco)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region DataEfetivacao
                        if (funcionario.DataEfetivacao.HasValue && funcionario.DataEfetivacao.Value != default(DateTime))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.DataEfetivacao.HasValue && f.DataEfetivacao.Value == funcionario.DataEfetivacao.Value
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Edificio
                        if (!string.IsNullOrEmpty(funcionario.Edificio))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.ComplementoEndereco.Contains(funcionario.ComplementoEndereco)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region EstadoCivil
                        if (!string.IsNullOrEmpty(funcionario.EstadoCivil))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.EstadoCivil.Contains(funcionario.EstadoCivil)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Email
                        if (!string.IsNullOrEmpty(funcionario.Email))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Email.Contains(funcionario.Email)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region FiliacaoPai
                        if (!string.IsNullOrEmpty(funcionario.FiliacaoPai))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.FiliacaoPai.Contains(funcionario.FiliacaoPai)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region FiliacaoMae
                        if (!string.IsNullOrEmpty(funcionario.FiliacaoMae))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.FiliacaoMae.Contains(funcionario.FiliacaoMae)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Fone
                        if (!string.IsNullOrEmpty(funcionario.Fone))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Fone.Contains(funcionario.Fone)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region FoneOpcional
                        if (!string.IsNullOrEmpty(funcionario.FoneOpcional))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.FoneOpcional.Contains(funcionario.FoneOpcional)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region FoneEmergencia
                        if (!string.IsNullOrEmpty(funcionario.FoneEmergencia))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.FoneEmergencia.Contains(funcionario.FoneEmergencia)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Login
                        if (!string.IsNullOrEmpty(funcionario.Login))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Login.Contains(funcionario.Login)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Logradouro
                        if (!string.IsNullOrEmpty(funcionario.Logradouro))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Logradouro.Contains(funcionario.Logradouro)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Nascimento
                        if (funcionario.Nascimento.HasValue && funcionario.Nascimento.Value != default(DateTime))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Nascimento.HasValue && f.Nascimento.Value == funcionario.Nascimento
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Nacionalidade
                        if (!string.IsNullOrEmpty(funcionario.Nacionalidade))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Nacionalidade.Contains(funcionario.Nacionalidade)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Naturalidade
                        if (!string.IsNullOrEmpty(funcionario.Naturalidade))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Naturalidade.Contains(funcionario.Naturalidade)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Nome
                        if (!string.IsNullOrEmpty(funcionario.Nome))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Nome.Contains(funcionario.Nome)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region PerfilID
                        if (funcionario.PerfilID != 0 && funcionario.PerfilID != null)
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.PerfilID == funcionario.PerfilID
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Pis
                        if (!string.IsNullOrEmpty(funcionario.Pis))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Pis.Contains(funcionario.Pis)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Rg
                        if (!string.IsNullOrEmpty(funcionario.Rg))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Rg.Contains(funcionario.Rg)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Sexo
                        if (funcionario.Sexo.HasValue)
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Sexo.HasValue && f.Sexo.Value == funcionario.Sexo.Value
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Serie
                        if (!string.IsNullOrEmpty(funcionario.Serie))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Serie.Contains(funcionario.Serie)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Senha
                        if (!string.IsNullOrEmpty(funcionario.Senha))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Senha.Contains(funcionario.Senha)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Status
                        if (funcionario.Status.HasValue)
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Status.HasValue && f.Status.Value == funcionario.Status.Value
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Uf
                        if (!string.IsNullOrEmpty(funcionario.Uf))
                        {

                            resultado = ((from f in resultado
                                          where
                                          f.Uf.Contains(funcionario.Uf)
                                          select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        #region ID
                        if (funcionario.ID != 0)
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.ID == funcionario.ID
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Alergico
                        if (!string.IsNullOrEmpty(funcionario.Alergico))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Alergico.Contains(funcionario.Alergico)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Bairro
                        if (!string.IsNullOrEmpty(funcionario.Bairro))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Bairro.Contains(funcionario.Bairro)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Cargo
                        if (!string.IsNullOrEmpty(funcionario.Cargo))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Cargo.Contains(funcionario.Cargo)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Cep
                        if (!string.IsNullOrEmpty(funcionario.Cep))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Cep.Contains(funcionario.Cep)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Cidade
                        if (!string.IsNullOrEmpty(funcionario.Cidade))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Cidade.Contains(funcionario.Cidade)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region ComplementoEndereco
                        if (!string.IsNullOrEmpty(funcionario.ComplementoEndereco))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.ComplementoEndereco.Contains(funcionario.ComplementoEndereco)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region ContatoEmergencia
                        if (!string.IsNullOrEmpty(funcionario.ContatoEmergencia))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.ContatoEmergencia.Contains(funcionario.ContatoEmergencia)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Cpf
                        if (!string.IsNullOrEmpty(funcionario.Cpf))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Cpf.Contains(funcionario.Cpf)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Ctps
                        if (!string.IsNullOrEmpty(funcionario.Ctps))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Ctps.Contains(funcionario.Ctps)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region DataEfetivacao
                        if (funcionario.DataEfetivacao.HasValue && funcionario.DataEfetivacao.Value != default(DateTime))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.DataEfetivacao.HasValue && f.DataEfetivacao.Value == funcionario.DataEfetivacao.Value
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Edificio
                        if (!string.IsNullOrEmpty(funcionario.Edificio))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Edificio.Contains(funcionario.Edificio)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region EstadoCivil
                        if (!string.IsNullOrEmpty(funcionario.EstadoCivil))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.EstadoCivil.Contains(funcionario.EstadoCivil)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Email
                        if (!string.IsNullOrEmpty(funcionario.Email))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Email.Contains(funcionario.Email)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region FiliacaoPai
                        if (!string.IsNullOrEmpty(funcionario.FiliacaoPai))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.FiliacaoPai.Contains(funcionario.FiliacaoPai)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region FiliacaoMae
                        if (!string.IsNullOrEmpty(funcionario.FiliacaoMae))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.FiliacaoMae.Contains(funcionario.FiliacaoMae)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Fone
                        if (!string.IsNullOrEmpty(funcionario.Fone))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Fone.Contains(funcionario.Fone)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region FoneEmergencia
                        if (!string.IsNullOrEmpty(funcionario.FoneEmergencia))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.FoneEmergencia.Contains(funcionario.FoneEmergencia)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region FoneOpcional
                        if (!string.IsNullOrEmpty(funcionario.FoneOpcional))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.FoneOpcional.Contains(funcionario.FoneOpcional)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Login
                        if (!string.IsNullOrEmpty(funcionario.Login))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Login.Contains(funcionario.Login)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Logradouro
                        if (!string.IsNullOrEmpty(funcionario.Logradouro))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Logradouro.Contains(funcionario.Logradouro)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Nascimento
                        if (funcionario.Nascimento.HasValue && funcionario.Nascimento.Value != default(DateTime))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Nascimento.HasValue && f.Nascimento.Value == funcionario.Nascimento
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Naturalidade
                        if (!string.IsNullOrEmpty(funcionario.Naturalidade))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Naturalidade.Contains(funcionario.Naturalidade)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Nacionalidade
                        if (!string.IsNullOrEmpty(funcionario.Nacionalidade))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Nacionalidade.Contains(funcionario.Nacionalidade)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Nome
                        if (!string.IsNullOrEmpty(funcionario.Nome))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Nome.Contains(funcionario.Nome)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Rg
                        if (!string.IsNullOrEmpty(funcionario.Rg))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Rg.Contains(funcionario.Rg)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region PerfilID
                        if (funcionario.PerfilID != 0)
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.PerfilID == funcionario.PerfilID
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Senha
                        if (!string.IsNullOrEmpty(funcionario.Senha))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Senha.Contains(funcionario.Senha)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Sexo
                        if (funcionario.Sexo.HasValue)
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Sexo.HasValue && f.Sexo.Value == funcionario.Sexo.Value
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Uf
                        if (!string.IsNullOrEmpty(funcionario.Uf))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Uf.Contains(funcionario.Uf)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Serie
                        if (!string.IsNullOrEmpty(funcionario.Serie))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Serie.Contains(funcionario.Serie)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Pis
                        if (!string.IsNullOrEmpty(funcionario.Pis))
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Pis.Contains(funcionario.Pis)
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        #region Status
                        if (funcionario.Status.HasValue)
                        {

                            resultado.AddRange((from f in Consultar()
                                                where
                                                f.Status.HasValue && f.Status.Value == funcionario.Status.Value
                                                select f).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                        #endregion

                        break;
                    }
                #endregion

                default:
                    break;
            }

            return resultado;
        }
Пример #32
0
        public List <Area> Consultar(Area area, TipoPesquisa tipoPesquisa)
        {
            List <Area> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (area.ID != 0)
                {
                    resultado = ((from t in resultado
                                  where
                                  t.ID == area.ID
                                  select t).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (!string.IsNullOrEmpty(area.descricao))
                {
                    resultado = ((from t in resultado
                                  where
                                  t.descricao.Contains(area.descricao)
                                  select t).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                //if (area.Status.HasValue)
                //{

                //    resultado = ((from t in resultado
                //                  where
                //                  t.Status.HasValue && t.Status.Value == area.Status.Value
                //                  select t).ToList());

                //    resultado = resultado.Distinct().ToList();
                //}

                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (area.ID != 0)
                {
                    resultado.AddRange((from t in Consultar()
                                        where
                                        t.ID == area.ID
                                        select t).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (!string.IsNullOrEmpty(area.descricao))
                {
                    resultado.AddRange((from t in Consultar()
                                        where
                                        t.descricao.Contains(area.descricao)
                                        select t).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                //if (area.Status.HasValue)
                //{

                //    resultado.AddRange((from t in Consultar()
                //                        where
                //                        t.Status.HasValue && t.Status.Value == area.Status.Value
                //                        select t).ToList());

                //    resultado = resultado.Distinct().ToList();
                //}

                break;
            }

                #endregion
            default:
                break;
            }

            return(resultado);
        }
Пример #33
0
        public List <SalaPeriodo> Consultar(SalaPeriodo salaPeriodo, TipoPesquisa tipoPesquisa)
        {
            List <SalaPeriodo> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (salaPeriodo.ID != 0)
                {
                    resultado = ((from sp in resultado
                                  where
                                  sp.ID == salaPeriodo.ID
                                  select sp).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (salaPeriodo.Ano.HasValue)
                {
                    resultado = ((from sp in resultado
                                  where
                                  sp.Ano.HasValue && sp.Ano.Value == salaPeriodo.Ano.Value
                                  select sp).ToList());

                    resultado = resultado.Distinct().ToList();
                }



                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (salaPeriodo.ID != 0)
                {
                    resultado.AddRange((from sp in Consultar()
                                        where
                                        sp.ID == salaPeriodo.ID
                                        select sp).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                if (salaPeriodo.Ano.HasValue)
                {
                    resultado.AddRange((from sp in Consultar()
                                        where
                                        sp.Ano.HasValue && sp.Ano.Value == salaPeriodo.Ano.Value
                                        select sp).ToList());
                    resultado = resultado.Distinct().ToList();
                }



                break;
            }

                #endregion
            default:
                break;
            }

            return(resultado);
        }
        public List<Aluno> Consultar(Aluno aluno, TipoPesquisa tipoPesquisa)
        {
            List<Aluno> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (aluno.ID != 0)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.ID == aluno.ID
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Nascimento.HasValue && aluno.Nascimento.Value != default(DateTime))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Nascimento.HasValue && a.Nascimento.Value == aluno.Nascimento.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Alergico))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Alergico.Contains(aluno.Alergico)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Bairro))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Bairro.Contains(aluno.Bairro)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Cep))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Cep.Contains(aluno.Cep)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Cidade))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Cidade.Contains(aluno.Cidade)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.ComplementoEndereco))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.ComplementoEndereco.Contains(aluno.ComplementoEndereco)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.DescricaoMedica))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.DescricaoMedica.Contains(aluno.DescricaoMedica)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Email))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Email.Contains(aluno.Email)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.FatorRh.HasValue)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FatorRh.HasValue && a.FatorRh.Value == aluno.FatorRh.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneAluno))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FoneAluno.Contains(aluno.FoneAluno)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneEmergencia))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FoneEmergencia.Contains(aluno.FoneEmergencia)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneMedico))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FoneMedico.Contains(aluno.FoneMedico)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneResidencia))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FoneResidencia.Contains(aluno.FoneResidencia)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.GrupoSanguineo))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.GrupoSanguineo.Contains(aluno.GrupoSanguineo)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Hospital))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Hospital.Contains(aluno.Hospital)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Login))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Login.Contains(aluno.Login)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Logradouro))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Logradouro.Contains(aluno.Logradouro)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Nacionalidade))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Nacionalidade.Contains(aluno.Nacionalidade)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Nascimento.HasValue && aluno.Nascimento.Value != default(DateTime))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Nascimento.HasValue && a.Nascimento.Value == aluno.Nascimento
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Naturalidade))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Naturalidade.Contains(aluno.Naturalidade)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Nome))
                        {

                            resultado = ((from a in resultado
                                          where
                                           a.Nome.ToUpper().Contains(aluno.Nome.ToUpper())
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.NomeMedico))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.NomeMedico.Contains(aluno.NomeMedico)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.PerfilID != 0 && aluno.PerfilID != null)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.PerfilID == aluno.PerfilID
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.PlanoSaude))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.PlanoSaude.Contains(aluno.PlanoSaude)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Senha))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Senha.Contains(aluno.Senha)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Sexo.HasValue)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Sexo.HasValue && a.Sexo.Value == aluno.Sexo.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.SituacaoEspecial))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.SituacaoEspecial.Contains(aluno.SituacaoEspecial)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Uf))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Uf.Contains(aluno.Uf)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Contato))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Contato.Contains(aluno.Contato)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Status.HasValue)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Status.HasValue && a.Status.Value == aluno.Status.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (aluno.ID != 0)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.ID == aluno.ID
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Nascimento.HasValue && aluno.Nascimento.Value != default(DateTime))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nascimento.HasValue && a.Nascimento.Value == aluno.Nascimento.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Alergico))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Alergico.Contains(aluno.Alergico)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Bairro))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Bairro.Contains(aluno.Bairro)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Cep))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Cep.Contains(aluno.Cep)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Cidade))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Cidade.Contains(aluno.Cidade)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.ComplementoEndereco))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.ComplementoEndereco.Contains(aluno.ComplementoEndereco)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.DescricaoMedica))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.DescricaoMedica.Contains(aluno.DescricaoMedica)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Email))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Email.Contains(aluno.Email)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.FatorRh.HasValue)
                        {
                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FatorRh.HasValue && a.FatorRh.Value == aluno.FatorRh.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneAluno))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FoneAluno.Contains(aluno.FoneAluno)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneEmergencia))
                        {
                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FoneEmergencia.Contains(aluno.FoneEmergencia)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneMedico))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FoneMedico.Contains(aluno.FoneMedico)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneResidencia))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FoneResidencia.Contains(aluno.FoneResidencia)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.GrupoSanguineo))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.GrupoSanguineo.Contains(aluno.GrupoSanguineo)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Hospital))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Hospital.Contains(aluno.Hospital)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Login))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Login.Contains(aluno.Login)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Logradouro))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Logradouro.Contains(aluno.Logradouro)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Nacionalidade))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nacionalidade.Contains(aluno.Nacionalidade)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Nascimento.HasValue && aluno.Nascimento.Value != default(DateTime))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nascimento.HasValue && a.Nascimento.Value == aluno.Nascimento
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Naturalidade))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Naturalidade.Contains(aluno.Naturalidade)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Nome))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nome.ToUpper().Contains(aluno.Nome.ToUpper())
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.NomeMedico))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.NomeMedico.Contains(aluno.NomeMedico)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.PerfilID != 0 && aluno.PerfilID != null)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.PerfilID == aluno.PerfilID
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.PlanoSaude))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.PlanoSaude.Contains(aluno.PlanoSaude)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Senha))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Senha.Contains(aluno.Senha)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Sexo.HasValue)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Sexo.HasValue && a.Sexo.Value == aluno.Sexo.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.SituacaoEspecial))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.SituacaoEspecial.Contains(aluno.SituacaoEspecial)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Uf))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Uf.Contains(aluno.Uf)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Contato))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Contato.Contains(aluno.Contato)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Status.HasValue)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Status.HasValue && a.Status.Value == aluno.Status.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion

                default:
                    break;
            }

            return resultado;
        }
        public List <Disciplina> Consultar(Disciplina disciplina, TipoPesquisa tipoPesquisa)
        {
            List <Disciplina> disciplinaList = this.disciplinaRepositorio.Consultar(disciplina, tipoPesquisa);

            return(disciplinaList);
        }
Пример #36
0
        public List <Lancamento> Consultar(Lancamento lancamento, TipoPesquisa tipoPesquisa)
        {
            List <Lancamento> lancamentoList = this.lancamentoRepositorio.Consultar(lancamento, tipoPesquisa);

            return(lancamentoList);
        }
        public List <UsuarioArea> Consultar(UsuarioArea usuarioArea, TipoPesquisa tipoPesquisa)
        {
            List <UsuarioArea> usuarioAreaList = this.usuarioAreaRepositorio.Consultar(usuarioArea, tipoPesquisa);

            return(usuarioAreaList);
        }
Пример #38
0
        public List <Funcionario> Consultar(Funcionario funcionario, TipoPesquisa tipoPesquisa)
        {
            List <Funcionario> funcionarioList = this.funcionarioRepositorio.Consultar(funcionario, tipoPesquisa);

            return(funcionarioList);
        }
        public List <BoletoAtividade> Consultar(BoletoAtividade boletoAtividade, TipoPesquisa tipoPesquisa)
        {
            List <BoletoAtividade> boletoAtividadeList = this.boletoAtividadeRepositorio.Consultar(boletoAtividade, tipoPesquisa);

            return(boletoAtividadeList);
        }
Пример #40
0
        public List <Emprestimo> Consultar(Emprestimo emprestimo, TipoPesquisa tipoPesquisa)
        {
            List <Emprestimo> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (emprestimo.ID != 0)
                {
                    resultado = ((from c in resultado
                                  where
                                  c.ID == emprestimo.ID
                                  select c).ToList());

                    resultado = resultado.Distinct().ToList();
                }
                else
                {
                    if (emprestimo.cliente_id != 0)
                    {
                        resultado = ((from c in resultado
                                      where
                                      c.cliente_id == emprestimo.cliente_id
                                      select c).ToList());

                        resultado = resultado.Distinct().ToList();
                    }

                    if (emprestimo.area_id != 0)
                    {
                        resultado = ((from c in resultado
                                      where
                                      c.area_id == emprestimo.area_id
                                      select c).ToList());

                        resultado = resultado.Distinct().ToList();
                    }

                    if (emprestimo.data_emprestimo != default(DateTime))
                    {
                        resultado = ((from c in resultado
                                      where
                                      c.data_emprestimo.Date.Equals(emprestimo.data_emprestimo.Date)
                                      select c).ToList());

                        resultado = resultado.Distinct().ToList();
                    }
                }
                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (emprestimo.ID != 0)
                {
                    resultado.AddRange((from c in Consultar()
                                        where
                                        c.ID == emprestimo.ID
                                        select c).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                if (emprestimo.cliente_id != 0)
                {
                    resultado.AddRange((from c in Consultar()
                                        where
                                        c.cliente_id == emprestimo.cliente_id
                                        select c).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                break;
            }

                #endregion
            default:
                break;
            }

            return(resultado);
        }
        public List<ResponsavelAluno> Consultar(ResponsavelAluno responsavelAluno, TipoPesquisa tipoPesquisa)
        {
            List<ResponsavelAluno> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (responsavelAluno.ID != 0)
                        {

                            resultado = ((from ra in resultado
                                          where
                                          ra.ID == responsavelAluno.ID
                                          select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.AlunoID != 0)
                        {

                            resultado = ((from ra in resultado
                                          where
                                          ra.AlunoID == responsavelAluno.AlunoID
                                          select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.Aluno != null && !string.IsNullOrEmpty(responsavelAluno.Aluno.Nome))
                        {

                            resultado = ((from ra in resultado
                                          where
                                          ra.Aluno.Nome.Contains(responsavelAluno.Aluno.Nome)
                                          select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.Responsavel != null && !string.IsNullOrEmpty(responsavelAluno.Responsavel.Nome))
                        {

                            resultado = ((from ra in resultado
                                          where
                                          ra.Responsavel.Nome.Contains(responsavelAluno.Responsavel.Nome)
                                          select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.ResponsavelID != 0)
                        {

                            resultado = ((from ra in resultado
                                          where
                                          ra.ResponsavelID == responsavelAluno.ResponsavelID
                                          select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavelAluno.Restricoes))
                        {

                            resultado = ((from ra in resultado
                                          where
                                           ra.Restricoes!=null && ra.Restricoes.Contains(responsavelAluno.Restricoes)
                                          select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.Status.HasValue)
                        {

                            resultado = ((from ra in resultado
                                          where
                                          ra.Status.HasValue && ra.Status.Value == responsavelAluno.Status.Value
                                          select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.ResideCom.HasValue)
                        {

                            resultado = ((from ra in resultado
                                          where
                                          ra.ResideCom.HasValue && ra.ResideCom.Value == responsavelAluno.ResideCom.Value
                                          select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (responsavelAluno.ID != 0)
                        {

                            resultado.AddRange((from ra in Consultar()
                                                where
                                                ra.ID == responsavelAluno.ID
                                                select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.Aluno != null && !string.IsNullOrEmpty(responsavelAluno.Aluno.Nome))
                        {

                            resultado.AddRange((from ra in Consultar()
                                                where
                                                ra.Aluno.Nome.Contains(responsavelAluno.Aluno.Nome)
                                                select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.Responsavel != null && !string.IsNullOrEmpty(responsavelAluno.Responsavel.Nome))
                        {

                            resultado.AddRange((from ra in Consultar()
                                                where
                                                ra.Responsavel.Nome.Contains(responsavelAluno.Responsavel.Nome)
                                                select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.AlunoID != 0)
                        {

                            resultado.AddRange((from ra in Consultar()
                                                where
                                                ra.AlunoID == responsavelAluno.AlunoID
                                                select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.ResponsavelID != 0)
                        {

                            resultado.AddRange((from ra in Consultar()
                                                where
                                                ra.ResponsavelID == responsavelAluno.ResponsavelID
                                                select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavelAluno.Restricoes))
                        {

                            resultado.AddRange((from ra in Consultar()
                                                where
                                                ra.Restricoes!= null && ra.Restricoes.Contains(responsavelAluno.Restricoes)
                                                select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.Status.HasValue)
                        {

                            resultado.AddRange((from ra in Consultar()
                                                where
                                                ra.Status.HasValue && ra.Status.Value == responsavelAluno.Status.Value
                                                select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavelAluno.ResideCom.HasValue)
                        {

                            resultado.AddRange((from ra in Consultar()
                                                where
                                                ra.ResideCom.HasValue && ra.ResideCom.Value == responsavelAluno.ResideCom.Value
                                                select ra).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List<ContasAPagar> Consultar(ContasAPagar contasAPagar, TipoPesquisa tipoPesquisa)
        {
            List<ContasAPagar> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (contasAPagar.ID != 0)
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.ID == contasAPagar.ID
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.DataPagamento.HasValue && contasAPagar.DataPagamento.Value != default(DateTime))
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.DataPagamento.HasValue && cp.DataPagamento.Value == contasAPagar.DataPagamento.Value
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.DataVencimento != default(DateTime))
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.DataVencimento == contasAPagar.DataVencimento
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Desconto.HasValue)
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.Desconto.HasValue && cp.Desconto.Value == contasAPagar.Desconto.Value
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(contasAPagar.Descricao))
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.Descricao.Contains(contasAPagar.Descricao)
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Multa.HasValue)
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.Multa.HasValue && cp.Multa.Value == contasAPagar.Multa.Value
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Parcela.HasValue)
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.Parcela.HasValue && cp.Parcela.Value == contasAPagar.Parcela.Value
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Status.HasValue)
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.Status.HasValue && cp.Status.Value == contasAPagar.Status.Value
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Valor.HasValue)
                        {

                            resultado = ((from cp in resultado
                                          where
                                          cp.Valor.HasValue && cp.Valor.Value == contasAPagar.Valor.Value
                                          select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (contasAPagar.ID != 0)
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.ID == contasAPagar.ID
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.DataPagamento.HasValue && contasAPagar.DataPagamento.Value != default(DateTime))
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.DataPagamento.HasValue && cp.DataPagamento.Value == contasAPagar.DataPagamento.Value
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.DataVencimento != default(DateTime))
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.DataVencimento == contasAPagar.DataVencimento
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Desconto.HasValue)
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.Desconto.HasValue && cp.Desconto.Value == contasAPagar.Desconto.Value
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(contasAPagar.Descricao))
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.Descricao.Contains(contasAPagar.Descricao)
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Multa.HasValue)
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.Multa.HasValue && cp.Multa.Value == contasAPagar.Multa.Value
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Parcela.HasValue)
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.Parcela.HasValue && cp.Parcela.Value == contasAPagar.Parcela.Value
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Status.HasValue)
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.Status.HasValue && cp.Status.Value == contasAPagar.Status.Value
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (contasAPagar.Valor.HasValue)
                        {

                            resultado.AddRange((from cp in Consultar()
                                                where
                                                cp.Valor.HasValue && cp.Valor.Value == contasAPagar.Valor.Value
                                                select cp).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
Пример #43
0
        public List <Video> Consultar(Video video, TipoPesquisa tipoPesquisa)
        {
            List <Video> videoList = this.videoRepositorio.Consultar(video, tipoPesquisa);

            return(videoList);
        }
Пример #44
0
        public List <Usuario> Consultar(Usuario usuario, TipoPesquisa tipoPesquisa)
        {
            List <Usuario> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (usuario.ID != 0)
                {
                    resultado = ((from c in resultado
                                  where
                                  c.ID == usuario.ID
                                  select c).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                //if (!string.IsNullOrEmpty(usuario.login) &&
                //   !string.IsNullOrEmpty(usuario.senha))
                {
                    resultado = ((from c in resultado
                                  where
                                  c.login.Equals(usuario.login) &&
                                  c.senha.Equals(usuario.senha)
                                  select c).ToList());

                    resultado = resultado.Distinct().ToList();
                }


                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (usuario.ID != 0)
                {
                    resultado.AddRange((from c in Consultar()
                                        where
                                        c.ID == usuario.ID
                                        select c).ToList());
                    resultado = resultado.Distinct().ToList();
                }

                if (!string.IsNullOrEmpty(usuario.login) &&
                    !string.IsNullOrEmpty(usuario.senha))
                {
                    resultado.AddRange((from c in resultado
                                        where
                                        c.login.Equals(usuario.login) &&
                                        c.senha.Equals(usuario.senha)
                                        select c).ToList());

                    resultado = resultado.Distinct().ToList();
                }


                break;
            }

                #endregion
            default:
                break;
            }

            return(resultado);
        }
        public List<MatriculaVinculo> Consultar(MatriculaVinculo matriculaVinculo, TipoPesquisa tipoPesquisa)
        {
            List<MatriculaVinculo> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (matriculaVinculo.ID != 0)
                        {
                            resultado = ((from m in resultado
                                          where
                                          m.ID == matriculaVinculo.ID
                                          select m).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        if (matriculaVinculo.MatriculaMestreID != 0)
                        {
                            resultado = ((from m in resultado
                                          where
                                          m.MatriculaMestreID == matriculaVinculo.MatriculaMestreID
                                          select m).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        if (matriculaVinculo.MatriculaDependenteID != 0)
                        {
                            resultado = ((from m in resultado
                                          where
                                          m.MatriculaDependenteID == matriculaVinculo.MatriculaDependenteID
                                          select m).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        if (matriculaVinculo.ID != 0)
                        {
                            resultado = ((from m in resultado
                                          where
                                          m.ID == matriculaVinculo.ID
                                          select m).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        if (matriculaVinculo.Status.HasValue)
                        {

                            resultado = ((from m in resultado
                                          where
                                          m.Status.HasValue && m.Status.Value == matriculaVinculo.Status.Value
                                          select m).ToList());
                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (matriculaVinculo.ID != 0)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.ID == matriculaVinculo.ID
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matriculaVinculo.MatriculaMestreID != 0)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.MatriculaMestreID == matriculaVinculo.MatriculaMestreID
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matriculaVinculo.MatriculaDependenteID != 0)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.MatriculaDependenteID == matriculaVinculo.MatriculaDependenteID
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (matriculaVinculo.Status.HasValue)
                        {

                            resultado.AddRange((from m in Consultar()
                                                where
                                                m.Status.HasValue && m.Status.Value == matriculaVinculo.Status.Value
                                                select m).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List<AtividadeTurma> Consultar(AtividadeTurma atividadeTurma, TipoPesquisa tipoPesquisa)
        {
            List<AtividadeTurma> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {

                        if (atividadeTurma.ID != 0)
                        {

                            resultado = ((from ad in resultado
                                          where
                                          ad.ID == atividadeTurma.ID
                                          select ad).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (atividadeTurma.AtividadeID.HasValue && atividadeTurma.AtividadeID.Value != 0)
                        {

                            resultado = ((from ad in resultado
                                          where
                                          ad.AtividadeID.HasValue && ad.AtividadeID.Value == atividadeTurma.AtividadeID.Value
                                          select ad).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (atividadeTurma.Status.HasValue && atividadeTurma.Status.Value != default(byte))
                        {

                            resultado = ((from ad in resultado
                                          where
                                          ad.Status.HasValue && ad.Status.Value == atividadeTurma.Status.Value
                                          select ad).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {

                        if (atividadeTurma.ID != 0)
                        {

                            resultado.AddRange((from ad in Consultar()
                                                where
                                                ad.ID == atividadeTurma.ID
                                                select ad).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (atividadeTurma.AtividadeID.HasValue && atividadeTurma.AtividadeID.Value != 0)
                        {

                            resultado.AddRange((from ad in Consultar()
                                                where
                                                ad.AtividadeID.HasValue && ad.AtividadeID.Value == atividadeTurma.AtividadeID.Value
                                                select ad).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (atividadeTurma.Status.HasValue && atividadeTurma.Status.Value != default(byte))
                        {

                            resultado.AddRange((from ad in Consultar()
                                                where
                                                ad.Status.HasValue && ad.Status.Value == atividadeTurma.Status.Value
                                                select ad).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List<Dependencia> Consultar(Dependencia dependencia, TipoPesquisa tipoPesquisa)
        {
            List<Dependencia> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (dependencia.ID != 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.ID == dependencia.ID
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Aprovado.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Aprovado.HasValue && d.Aprovado.Value == dependencia.Aprovado.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.ProfessorDisciplinaSalaID.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.ProfessorDisciplinaSalaID.HasValue && d.ProfessorDisciplinaSalaID.Value == dependencia.ProfessorDisciplinaSalaID.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Rec.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Rec.HasValue && d.Rec.Value == dependencia.Rec.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.RecFinal.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.RecFinal.HasValue && d.RecFinal.Value == dependencia.RecFinal.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Vp.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Vp.HasValue && d.Vp.Value == dependencia.Vp.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Vc1 <= 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Vc1 == dependencia.Vc1
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Vc2 <= 0)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Vc2 == dependencia.Vc2
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Status.HasValue)
                        {

                            resultado = ((from d in resultado
                                          where
                                          d.Status.HasValue && d.Rec.Value == dependencia.Status.Value
                                          select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (dependencia.ID != 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.ID == dependencia.ID
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Aprovado.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Aprovado.HasValue && d.Aprovado.Value == dependencia.Aprovado.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.ProfessorDisciplinaSalaID.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.ProfessorDisciplinaSalaID.HasValue && d.ProfessorDisciplinaSalaID.Value == dependencia.ProfessorDisciplinaSalaID.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Rec.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Rec.HasValue && d.Rec.Value == dependencia.Rec.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.RecFinal.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.RecFinal.HasValue && d.RecFinal.Value == dependencia.RecFinal.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Vp.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Vp.HasValue && d.Vp.Value == dependencia.Vp.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Vc1 <= 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Vc1 == dependencia.Vc1
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Vc2 <= 0)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Vc2 == dependencia.Vc2
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (dependencia.Status.HasValue)
                        {

                            resultado.AddRange((from d in Consultar()
                                                where
                                                d.Status.HasValue && d.Rec.Value == dependencia.Status.Value
                                                select d).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
        public List<Imagem> Consultar(Imagem imagem, TipoPesquisa tipoPesquisa)
        {
            List<Imagem> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {

                        if (imagem.ID != 0)
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.ID == imagem.ID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(imagem.Titulo))
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.Titulo.Contains(imagem.Titulo)
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                       }

                        if (imagem.PostagemID != 0)
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.PostagemID == imagem.PostagemID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                       break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                     if (imagem.ID != 0)
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.ID == imagem.ID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(imagem.Titulo))
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.Titulo.Contains(imagem.Titulo)
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                       }

                        if (imagem.PostagemID != 0)
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.PostagemID == imagem.PostagemID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }
                       break;
                    }
                #endregion
            }

            return resultado;
        }
Пример #49
0
        public List <EstadoCivilTipo> Consultar(EstadoCivilTipo estadoCivilTipo, TipoPesquisa tipoPesquisa)
        {
            List <EstadoCivilTipo> estadoCivilTipoList = this.estadoCivilTipoRepositorio.Consultar(estadoCivilTipo, tipoPesquisa);

            return(estadoCivilTipoList);
        }
        public List<Usuario> Consultar(Usuario usuario, TipoPesquisa tipoPesquisa)
        {
            List<Usuario> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (usuario.ID != 0)
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.ID == usuario.ID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                       // if (!string.IsNullOrEmpty(usuario.Nome))
                       // {

                       //     resultado = ((from p in resultado
                       //                   where
                       //                   p.Nome.Contains(usuario.Nome)
                       //                   select p).ToList());

                       //     resultado = resultado.Distinct().ToList();
                       //}

                       if (!string.IsNullOrEmpty(usuario.Login) && !string.IsNullOrEmpty(usuario.Senha) )
                        {

                            resultado = ((from p in resultado
                                          where
                                          p.Login.Equals(usuario.Login) && p.Senha.Equals(usuario.Senha)
                                          select p).ToList());
                            resultado = resultado.Distinct().ToList();
                       } else
                       {
                        if (!string.IsNullOrEmpty(usuario.Login))
                            {

                                resultado = ((from p in resultado
                                              where
                                              p.Login.Equals(usuario.Login)
                                              select p).ToList());
                                resultado = resultado.Distinct().ToList();
                           }
                       }
                       break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                         if (usuario.ID != 0)
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.ID == usuario.ID
                                          select p).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                       // if (!string.IsNullOrEmpty(usuario.Nome))
                       // {

                       //     resultado.AddRange((from p in resultado
                       //                   where
                       //                   p.Nome.Contains(usuario.Nome)
                       //                   select p).ToList());

                       //     resultado = resultado.Distinct().ToList();
                       //}

                       if (!string.IsNullOrEmpty(usuario.Login) && !string.IsNullOrEmpty(usuario.Senha) )
                        {

                            resultado.AddRange((from p in resultado
                                          where
                                          p.Login.Equals(usuario.Login) && p.Senha.Equals(usuario.Senha)
                                          select p).ToList());
                            resultado = resultado.Distinct().ToList();
                       } else
                       {
                        if (!string.IsNullOrEmpty(usuario.Login))
                            {

                                resultado.AddRange((from p in resultado
                                              where
                                              p.Login.Equals(usuario.Login)
                                              select p).ToList());
                                resultado = resultado.Distinct().ToList();
                           }
                       }
                       break;
                    }
                #endregion
            }

            return resultado;
        }
Пример #51
0
        public List<Area> Consultar(Area area, TipoPesquisa tipoPesquisa)
        {
            List<Area> areaList = this.areaRepositorio.Consultar(area,tipoPesquisa);           

            return areaList;
        }
        public List<Serie> Consultar(Serie serie, TipoPesquisa tipoPesquisa)
        {
            List<Serie> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (serie.ID != 0)
                        {

                            resultado = ((from s in resultado
                                          where
                                          s.ID == serie.ID
                                          select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(serie.Nome))
                        {

                            resultado = ((from s in resultado
                                          where
                                          s.Nome.Contains(serie.Nome)
                                          select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (serie.Status.HasValue)
                        {

                            resultado = ((from s in resultado
                                          where
                                          s.Status.HasValue && s.Status.Value == serie.Status.Value
                                          select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (serie.ID != 0)
                        {

                            resultado.AddRange((from s in Consultar()
                                                where
                                                s.ID == serie.ID
                                                select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(serie.Nome))
                        {

                            resultado.AddRange((from s in Consultar()
                                                where
                                                s.Nome.Contains(serie.Nome)
                                                select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (serie.Status.HasValue)
                        {

                            resultado.AddRange((from s in Consultar()
                                                where
                                                s.Status.HasValue && s.Status.Value == serie.Status.Value
                                                select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
Пример #53
0
        public List <Partido> Consultar(Partido partido, TipoPesquisa tipoPesquisa)
        {
            List <Partido> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
            case TipoPesquisa.E:
            {
                if (partido.ID != 0)
                {
                    resultado = ((from p in resultado
                                  where
                                  p.ID == partido.ID
                                  select p).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (!string.IsNullOrEmpty(partido.Titulo))
                {
                    resultado = ((from p in resultado
                                  where
                                  p.Titulo.Contains(partido.Titulo)
                                  select p).ToList());


                    resultado = resultado.Distinct().ToList();
                }

                if (!string.IsNullOrEmpty(partido.SubTitulo))
                {
                    resultado = ((from p in resultado
                                  where
                                  p.SubTitulo.Contains(partido.SubTitulo)
                                  select p).ToList());


                    resultado = resultado.Distinct().ToList();
                }

                break;
            }

                #endregion
                #region Case Ou
            case TipoPesquisa.Ou:
            {
                if (partido.ID != 0)
                {
                    resultado.AddRange((from p in resultado
                                        where
                                        p.ID == partido.ID
                                        select p).ToList());

                    resultado = resultado.Distinct().ToList();
                }

                if (!string.IsNullOrEmpty(partido.Titulo))
                {
                    resultado.AddRange((from p in resultado
                                        where
                                        p.Titulo.Contains(partido.Titulo)
                                        select p).ToList());


                    resultado = resultado.Distinct().ToList();
                }


                if (!string.IsNullOrEmpty(partido.SubTitulo))
                {
                    resultado.AddRange((from p in resultado
                                        where
                                        p.SubTitulo.Contains(partido.SubTitulo)
                                        select p).ToList());


                    resultado = resultado.Distinct().ToList();
                }


                break;
            }
                #endregion
            }

            return(resultado);
        }
        public List<Responsavel> Consultar(Responsavel responsavel, TipoPesquisa tipoPesquisa)
        {
            List<Responsavel> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (responsavel.ID != 0)
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.ID == responsavel.ID
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.Nascimento.HasValue && responsavel.Nascimento.Value != default(DateTime))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Nascimento.HasValue && r.Nascimento.Value == responsavel.Nascimento.Value
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.LocalTrabalho))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.LocalTrabalho.Contains(responsavel.LocalTrabalho)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Cpf))
                        {

                            resultado = ((from r in resultado
                                          where
                                        r.Cpf != null && r.Cpf.Contains(responsavel.Cpf)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Bairro))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Bairro.Contains(responsavel.Bairro)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Cep))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Cep.Contains(responsavel.Cep)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Cidade))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Cidade.Contains(responsavel.Cidade)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.ComplementoEndereco))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.ComplementoEndereco.Contains(responsavel.ComplementoEndereco)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Profissao))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Profissao.Contains(responsavel.Profissao)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Rg))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Rg.Contains(responsavel.Rg)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Email))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Email.Contains(responsavel.Email)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Fone))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Fone.Contains(responsavel.Fone)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.FoneTrabalho))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.FoneTrabalho.Contains(responsavel.FoneTrabalho)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Login))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Login.Contains(responsavel.Login)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Logradouro))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Logradouro.Contains(responsavel.Logradouro)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.Nascimento.HasValue && responsavel.Nascimento.Value != default(DateTime))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Nascimento.HasValue && r.Nascimento.Value == responsavel.Nascimento
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Nome))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Nome.Contains(responsavel.Nome)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.PerfilID!= null && responsavel.PerfilID != 0)
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.PerfilID == responsavel.PerfilID
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Senha))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Senha.Contains(responsavel.Senha)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.Sexo.HasValue)
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Sexo.HasValue && r.Sexo.Value == responsavel.Sexo.Value
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Uf))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Uf.Contains(responsavel.Uf)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.FoneOpcional))
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.FoneOpcional.Contains(responsavel.FoneOpcional)
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.Status.HasValue)
                        {

                            resultado = ((from r in resultado
                                          where
                                          r.Status.HasValue && r.Status.Value == responsavel.Status.Value
                                          select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (responsavel.ID != 0)
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.ID == responsavel.ID
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.Nascimento.HasValue && responsavel.Nascimento.Value != default(DateTime))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Nascimento.HasValue && r.Nascimento.Value == responsavel.Nascimento.Value
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.LocalTrabalho))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.LocalTrabalho.Contains(responsavel.LocalTrabalho)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Cpf))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Cpf.Contains(responsavel.Cpf)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Bairro))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Bairro.Contains(responsavel.Bairro)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Cep))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Cep.Contains(responsavel.Cep)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Cidade))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Cidade.Contains(responsavel.Cidade)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.ComplementoEndereco))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.ComplementoEndereco.Contains(responsavel.ComplementoEndereco)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Profissao))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Profissao.Contains(responsavel.Profissao)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Rg))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Rg.Contains(responsavel.Rg)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Email))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Email.Contains(responsavel.Email)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Fone))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Fone.Contains(responsavel.Fone)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.FoneTrabalho))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.FoneTrabalho.Contains(responsavel.FoneTrabalho)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Login))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Login.Contains(responsavel.Login)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Logradouro))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Logradouro.Contains(responsavel.Logradouro)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.Nascimento.HasValue && responsavel.Nascimento.Value != default(DateTime))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Nascimento.HasValue && r.Nascimento.Value == responsavel.Nascimento
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Nome))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Nome.Contains(responsavel.Nome)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.PerfilID != 0)
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.PerfilID == responsavel.PerfilID
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Senha))
                        {
                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Senha.Contains(responsavel.Senha)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.Sexo.HasValue)
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Sexo.HasValue && r.Sexo.Value == responsavel.Sexo.Value
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.Uf))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Uf.Contains(responsavel.Uf)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(responsavel.FoneOpcional))
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.FoneOpcional.Contains(responsavel.FoneOpcional)
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (responsavel.Status.HasValue)
                        {

                            resultado.AddRange((from r in Consultar()
                                                where
                                                r.Status.HasValue && r.Status.Value == responsavel.Status.Value
                                                select r).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion

                default:
                    break;
            }

            return resultado;
        }
        public List<ChequeBoletoMensalidade> Consultar(ChequeBoletoMensalidade chequeBoletoMensalidade, TipoPesquisa tipoPesquisa)
        {
            List<ChequeBoletoMensalidade> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (chequeBoletoMensalidade.ID != 0)
                        {

                            resultado = ((from cbm in resultado
                                          where
                                          cbm.ID == chequeBoletoMensalidade.ID
                                          select cbm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoMensalidade.BoletoMensalidadeID != 0)
                        {

                            resultado = ((from cbm in resultado
                                          where
                                          cbm.BoletoMensalidadeID == chequeBoletoMensalidade.BoletoMensalidadeID
                                          select cbm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoMensalidade.ChequeID != 0)
                        {

                            resultado = ((from cbm in resultado
                                          where
                                          cbm.ChequeID == chequeBoletoMensalidade.ChequeID
                                          select cbm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoMensalidade.Status.HasValue)
                        {

                            resultado = ((from cbm in resultado
                                          where
                                          cbm.Status.HasValue && cbm.Status.Value == chequeBoletoMensalidade.Status.Value
                                          select cbm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (chequeBoletoMensalidade.ID != 0)
                        {

                            resultado.AddRange((from cbm in Consultar()
                                                where
                                                cbm.ID == chequeBoletoMensalidade.ID
                                                select cbm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoMensalidade.BoletoMensalidadeID != 0)
                        {

                            resultado.AddRange((from cbm in Consultar()
                                                where
                                                cbm.BoletoMensalidadeID == chequeBoletoMensalidade.BoletoMensalidadeID
                                                select cbm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoMensalidade.ChequeID != 0)
                        {

                            resultado.AddRange((from cbm in Consultar()
                                                where
                                                cbm.ChequeID == chequeBoletoMensalidade.ChequeID
                                                select cbm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (chequeBoletoMensalidade.Status.HasValue)
                        {

                            resultado.AddRange((from cbm in Consultar()
                                                where
                                                cbm.Status.HasValue && cbm.Status.Value == chequeBoletoMensalidade.Status.Value
                                                select cbm).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }