Ejemplo n.º 1
0
 /// <summary>
 /// 添加周期性作业
 /// </summary>
 /// <param name="jobItem"></param>
 /// <returns></returns>
 public bool AddHttprecurringjob(HttpJobItem jobItem)
 {
     try
     {
         RecurringJob.AddOrUpdate(jobItem.JobName, () => HttpJob.Excute(jobItem, jobItem.JobName, null), jobItem.Corn, TimeZoneInfo.Local);
         return(true);
     }
     catch (Exception ex)
     {
         Logger.ErrorException("HttpJobDispatcher.AddHttprecurringjob", ex);
         return(false);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加后台作业
 /// </summary>
 /// <param name="jobItem"></param>
 /// <returns></returns>
 public bool AddHttpbackgroundjob(HttpJobItem jobItem)
 {
     try
     {
         BackgroundJob.Schedule(() => HttpJob.Excute(jobItem, jobItem.JobName, null), TimeSpan.FromMinutes(jobItem.DelayFromMinutes));
         return(true);
     }
     catch (Exception ex)
     {
         Logger.ErrorException("HttpJobDispatcher.AddHttpbackgroundjob", ex);
         return(false);
     }
 }