Esempio n. 1
0
        public async Task <PagedResultDto <SchedulerOutputDto> > GetSchedulers()
        {
            var entities = await _SchedulerManager.GetAllSchedulersAsync();

            var listDto = entities.MapTo <List <SchedulerOutputDto> >();

            return(new PagedResultDto <SchedulerOutputDto>(
                       listDto.Count,
                       listDto
                       ));
        }
Esempio n. 2
0
        public override async void Execute(IJobExecutionContext context)
        {
            var schedulerEntities = await _SchedulerManager.GetAllSchedulersAsync();

            var jobGroupEntities = await _JobGroupManager.GetAllJobGroupsAsync();

            var triggerEnities = await _TriggerManager.GetAllTriggersAsync();

            var schedulers = schedulerEntities.Join(jobGroupEntities, a => a.JobGroup_Id, b => b.Id, (a, b) => new { a, b })
                             .Join(triggerEnities, a => a.a.Trigger_Id, c => c.Id, (a, c) => new
            {
                Id        = a.a.Id,
                Name      = a.a.SchedulerName,
                Status    = a.a.Status,
                TypeTable = a.b.TypeTable,
                Job_Id    = a.a.Job_Id,
                CronStr   = c.CronStr
            });

            foreach (var scheduler in schedulers)
            {
                var quartzJobName   = "Scheduler_" + scheduler.Id;
                var quartzGroupName = "BackgroundJobManager";
                if (scheduler.Status)
                {
                    execScheduler(quartzJobName, quartzGroupName, scheduler.CronStr, scheduler.TypeTable, scheduler.Job_Id, -1);
                }
                else
                {
                    _jobManager.DeleteJob(quartzJobName, quartzGroupName);
                }
            }
        }