private static void UpdateOrAddJob(ScheduleJobInfo job) { if (CheckExists(job.JobId)) { DeleteJob(job.JobId); } if (job.JobState == JobState.Normal) { var jobDetail = JobBuilder.Create <HttpJob>() .WithIdentity(job.JobId) .Build(); ITrigger trigger = TriggerBuilder.Create() .WithIdentity(job.JobId) .WithCronSchedule(job.Cron) .Build(); ScheduleJob(jobDetail, trigger); } }
public ScheduleJobInfo UpdateJob(ScheduleJobInfo dto) { var model = dto; using (var trans = SqlMapper.BeginTransaction()) { try { trans.Entity <Models.ScheduleJobInfo>().Set(x => new { x.JobState }, false).Update(model); ScheduleManager.UpdateJob(model); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw ex; } } return(GetJob(model.JobId)); }
public ScheduleJobInfo AddJob(ScheduleJobInfo dto) { var model = dto; model.JobId = Guid.NewGuid().ToString("N").ToLower(); using (var trans = SqlMapper.BeginTransaction()) { try { trans.Entity <Models.ScheduleJobInfo>().Insert(model); ScheduleManager.AddJob(model); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw ex; } } return(GetJob(model.JobId)); }
public ScheduleJobInfo UpdateJob(ScheduleJobInfo dto) { return(_scheduleService.UpdateJob(dto)); }
public ScheduleJobInfo AddJob(ScheduleJobInfo dto) { return(_scheduleService.AddJob(dto)); }
public static void UpdateJob(ScheduleJobInfo job) { UpdateOrAddJob(job); }