public static void AddJobDetailsFromTypes(Type[] types, bool Replace) { QuartzWrapper quartz = new QuartzWrapper(quartzJobStoreSettings.GetQuartzSettings()); quartz.AddJobDetails(quartz.GetJobsFromTypes(types), Replace); quartz.Scheduler = null; quartz = null; }
public void BackupQuartzJobDetails(string Path) { QuartzWrapper quartz = new QuartzWrapper(quartzJobStoreSettings.GetQuartzSettings()); IReadOnlyList <IQuartzServiceJob> jobs = quartz.GetJobsFromTypes(GetJobTypes()); List <IJobDetail> JobDetails = new List <IJobDetail>(); foreach (IJobDetail d in quartz.GetJobs()) { JobDetails.Add(d); } string Json = JsonConvert.SerializeObject(JobDetails); File.WriteAllText(Path, Json); }
public void UpdateQuartzJobData() { QuartzWrapper quartz = new QuartzWrapper(quartzJobStoreSettings.GetQuartzSettings()); IReadOnlyList <IQuartzServiceJob> jobs = quartz.GetJobsFromTypes(GetJobTypes()); foreach (IQuartzServiceJob job in jobs) { IJobDetail d = job.JobDetail.Build(); IJobDetail d2 = quartz.Scheduler.GetJobDetail(d.Key).Result; bool DoUpdate = false; if (d2 != null) { foreach (string Key in d.JobDataMap.Keys) { d2.JobDataMap[Key] = d.JobDataMap[Key]; DoUpdate = true; } if (DoUpdate) { quartz.Scheduler.AddJob(d2, true).GetAwaiter().GetResult(); } } } }
public static void ScheduleJobTypes(Type[] types) { QuartzWrapper quartz = new QuartzWrapper(quartzJobStoreSettings.GetQuartzSettings()); quartz.ScheduleJobTypes(quartz.GetJobsFromTypes(types)); }