public async Task <DResults <VTrigger> > GetTriggers(string jobId) { var list = await _contract.GetTriggersAsync(jobId); await _scheduler.FillTriggersTime(list); return(Succ(list.MapTo <VTrigger>(), -1)); }
private async Task StartHttpJob(JobDto dto, ITrigger trigger) { var builder = JobBuilder.Create <JobHttp>(); var map = new JobDataMap { { Constants.JobData, dto.Detail } }; var jobDetail = builder .WithIdentity(dto.Id) .SetJobData(map) .Build(); if (trigger != null) { await _scheduler.ScheduleJob(jobDetail, trigger); } else { var triggers = new List <ITrigger>(); var list = await _jobContract.GetTriggersAsync(dto.Id); foreach (var triggerDto in list.Where(t => t.Status == TriggerStatus.Enable)) { var triggerBuilder = GetTrigger(triggerDto); if (triggerBuilder == null) { continue; } triggerBuilder.ForJob(jobDetail); triggers.Add(triggerBuilder.Build()); } if (triggers.Any()) { await _scheduler.ScheduleJob(jobDetail, triggers.AsReadOnly(), true); } } }