You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
780 B

  1. using FluentScheduler;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Sevomin.Models.Helpers.ScheduledTasks
  8. {
  9. public class NewApplication : ITask
  10. {
  11. public async void Execute()
  12. {
  13. var avalins = SevominDbContext.Current.DovominJobs.Where(dj => dj.ApplyDate.Date == DateTime.Now.AddDays(-2).Date).Select(a => a.Job.Avalin);
  14. foreach (var avalin in avalins.Distinct())
  15. {
  16. SevominEmailer emailer = new SevominEmailer();
  17. emailer.EmailType = EmailType.NewApplication;
  18. emailer.Parameters.Add("", "");
  19. await emailer.SendAsync(avalin.Email, "", true);
  20. }
  21. }
  22. }
  23. }