Example #1
0
 public IEnumerable <Participante> GetAllGeral(TipoCota cota)
 {
     return(_context.Participantes
            .AsNoTracking()
            .Where(ParticipanteQueries.GetAllGeral(cota))
            .OrderBy(x => x.Nome));
 }
Example #2
0
 public CreateParticipanteCommand(string nome, string cpf, DateTime dt_nascimento, decimal renda, TipoCota cota, string cid)
 {
     Nome          = nome;
     Cpf           = cpf;
     Dt_nascimento = dt_nascimento;
     Renda         = renda;
     Cota          = cota;
     Cid           = cid;
 }
 public static Expression <Func <Participante, bool> > GetAllGeral(TipoCota cota)
 {
     return(x =>
            x.Cota == cota &&
            x.Renda > decimal.Parse("1045.00") &&
            x.Renda < decimal.Parse("5225.00") &&
            x.Cpf.Length == 14 &&
            (DateTime.Now.Year - x.Dt_nascimento.Year) > 15);
 }
Example #4
0
        public List <Participante> GetWinnerGeral(TipoCota cota, int qtd)
        {
            Random rdn = new Random();
            List <Participante>        sorteados = new List <Participante>();
            Participante               sorteado  = new Participante();
            IEnumerable <Participante> lista     = _context.Participantes
                                                   .AsNoTracking()
                                                   .Where(ParticipanteQueries.GetAllGeral(cota));

            for (int i = 1; i <= qtd; i++)
            {
                var result = lista.Where(p => sorteados.All(p2 => p2.Cpf != p.Cpf)).OrderBy(x => rdn.Next()).FirstOrDefault();
                if (result != null)
                {
                    sorteados.Add(result);
                }
            }
            return(sorteados);
        }
 List <Participante> ISorteioRepository.GetWinnerGeral(TipoCota cota, int qtd)
 {
     throw new NotImplementedException();
 }
 public IEnumerable <Participante> GetAllPcd(TipoCota cota)
 {
     throw new NotImplementedException();
 }