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 NewJob : ITask
|
|
{
|
|
public async void Execute()
|
|
{
|
|
var newJobs = JobRepository.Current.ListAll().ToList().Where(j => j.CreateDate.Date >= DateTime.UtcNow.AddDays(-1).Date).ToList();
|
|
if (newJobs.Count > 0)
|
|
{
|
|
foreach (var dovomin in UserRepository.Current.ListAll().Where(u => u is Dovomin && u.EmailConfirmed))
|
|
{
|
|
SevominEmailer emailer = new SevominEmailer();
|
|
emailer.EmailType = EmailType.NewJob;
|
|
emailer.Parameters.Add("display-name", dovomin.DisplayName);
|
|
|
|
await emailer.SendAsync(dovomin.Email, "آگهی استخدام جدید در سومین", true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|