Exemplo n.º 1
0
        public SchedulerHostedService(IEnumerable <IScheduledTask> scheduledTasks)
        {
            var referenceTime = DateTime.UtcNow;

            foreach (var scheduledTask in scheduledTasks)
            {
                _scheduledTasks.Add(new SchedulerTaskWrapper
                {
                    Schedule    = CrontabSchedule.Parse(scheduledTask.Schedule),
                    Task        = scheduledTask,
                    NextRunTime = referenceTime
                });
            }
        }
Exemplo n.º 2
0
 public MassMailWrapper(MassEmail src)
 {
     this.Source = src;
     try
     {
         this.Schedule = CrontabSchedule.Parse(src.Schedule);
     }
     catch (Exception ex)
     {
         return;
     }
     this.LastRunTime = this.NextRunTime = src.NextSend;
     if (src.NextSend.Year < 2020)
     {
         NextRunTime = Schedule.GetNextOccurrence(DateTime.Now.AddMinutes(-15));
     }
     //Increment();
 }