static void Work()
 {
     PreencherFila();
     using (ReprografiaContext db = new ReprografiaContext())
     {
         var emails = db.Emails.Where(m => !m.Enviado);
         EnviarEmails(emails);
         db.SaveChanges();
     }
 }
        static private IEnumerable<EmailCobrancaAvaliacao> PreencherFila()
        {
            List<EmailCobrancaAvaliacao> result = new List<EmailCobrancaAvaliacao>();
            using (var db = new ReprografiaContext())
            {
                //Colocar na fila de emails avaliacoes com menos de 2 dias ate o prazo final
                //DateTime dateFilter = DateTime.Now.AddDays(100);
                DateTime dateFilter = DateTime.Now.AddDays(2);
                var avaliacoesPrestesAExpirar = db.Avaliacoes
                    .Where(a => a.DataLimite <= dateFilter);

                foreach (var avaliacao in avaliacoesPrestesAExpirar)
                {
                    EmailCobrancaAvaliacao email = new EmailCobrancaAvaliacao(avaliacao);
                    result.Add(email);
                    db.Emails.Add(email);
                }
                db.SaveChanges();
            }
            return result;
        }