/// <summary>
/// Called by the <see cref="IScheduler" /> when a <see cref="ITrigger" />
/// fires that is associated with the <see cref="IJob" />.
/// </summary>
/// <param name="context">The execution context.</param>
/// <remarks>
/// The implementation may wish to set a result object on the
/// JobExecutionContext before this method exits. The result itself
/// is meaningless to Quartz, but may be informative to
/// <see cref="IJobListener" />s or
/// <see cref="ITriggerListener" />s that are watching the job's
/// execution.
/// </remarks>
public virtual void Execute( IJobExecutionContext context )
{
var service = new WorkflowService();
foreach ( var workflow in service.GetActive() )
{
if ( !workflow.LastProcessedDateTime.HasValue ||
DateTime.Now.Subtract( workflow.LastProcessedDateTime.Value ).TotalSeconds >= workflow.WorkflowType.ProcessingIntervalSeconds )
{
var errorMessages = new List<string>();
service.Process( workflow, null, out errorMessages );
}
}
}