Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
                    }
                }
            }
        }
Exemplo n.º 4
0
        public static void ScheduleJobTypes(Type[] types)
        {
            QuartzWrapper quartz = new QuartzWrapper(quartzJobStoreSettings.GetQuartzSettings());

            quartz.ScheduleJobTypes(quartz.GetJobsFromTypes(types));
        }