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.
 
 
 
 

25 lines
851 B

using FluentScheduler;
using Sevomin.Models.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sevomin.Models.Helpers.ScheduledTasks
{
public class ExpiringJob : ITask
{
public async void Execute()
{
var expiringJobs = JobRepository.Current.ListAll().Where(j => j.ExpireDate.Date == DateTime.Now.AddDays(-2).Date);
foreach (var job in expiringJobs)
{
SevominEmailer emailer = new SevominEmailer();
emailer.EmailType = EmailType.ExpiringJob;
emailer.Parameters.Add("", "");
await emailer.SendAsync(string.IsNullOrWhiteSpace(job.ContactPersonEMail) ? job.Avalin.Email : job.ContactPersonEMail, "", true);
}
}
}
}