예제 #1
0
        public async Task <ActionResult> ResumeJob(JobKey jobKey)
        {
            var result = await SchedulerCenter.ResumeJobAsync(jobKey);

            return(MyJson(result));
            //if (!result.Success)
            //{
            //    return MyJson(result);
            //}

            //var updateResult = await SysQuartzBll.ModifyTaskState(jobKey.Group, jobKey.Name, MyTriggerState.Normal);
            //return updateResult ? Succeed() : Fail("恢复运行失败");
        }
예제 #2
0
        public async Task <ActionResult> DeleteJob(JobKey jobKey)
        {
            var result = await SchedulerCenter.StopOrDelScheduleJobAsync(jobKey, true);

            return(MyJson(result));
            //if (!result.Success)
            //{
            //    return MyJson(result);
            //}

            //var updateResult = await SysQuartzBll.ModifyTaskState(jobKey.Group, jobKey.Name, MyTriggerState.Delete);
            //return updateResult ? Succeed() : Fail("删除失败");
        }
예제 #3
0
        public async Task <ActionResult> ModifyJob(ScheduleEntityParam entity)
        {
            var result = await SchedulerCenter.StopOrDelScheduleJobAsync(new JobKey(entity.JobName, entity.JobGroup), true);

            if (!result.Success)
            {
                return(MyJson(result));
            }

            result = await SchedulerCenter.AddScheduleJobAsync(entity);

            if (result.Success)
            {
                result = await SysQuartzBll.ModifyTask(entity);
            }

            return(MyJson(result));
        }
예제 #4
0
        public async Task <ActionResult> AddTask(ScheduleEntityParam entity)
        {
            // 判断存在
            if (await SysQuartzBll.ExistTask(entity))
            {
                return(Fail("任务名称已存在,请进行修改原任务,或使用新名称"));
            }

            var result = await SchedulerCenter.AddScheduleJobAsync(entity);

            if (!result.Success)
            {
                return(MyJson(result));
            }

            var addResult = await SysQuartzBll.AddTask(entity);

            return(addResult ? Succeed() : Fail("添加失败"));
        }
예제 #5
0
        private SchedulerCenter GetScheduler()
        {
            string dbProviderName     = Configuration.GetSection("Quartz")["dbProviderName"];
            string connectionString   = Configuration.GetSection("Quartz")["connectionString"];
            string driverDelegateType = string.Empty;

            switch (dbProviderName)
            {
            case "SQLite-Microsoft":
            case "SQLite":
                driverDelegateType = typeof(SQLiteDelegate).AssemblyQualifiedName; break;

            case "MySql":
                driverDelegateType = typeof(MySQLDelegate).AssemblyQualifiedName; break;

            case "OracleODPManaged":
                driverDelegateType = typeof(OracleDelegate).AssemblyQualifiedName; break;

            case "SQLServer":
            case "SQLServerMOT":
                driverDelegateType = typeof(SqlServerDelegate).AssemblyQualifiedName; break;

            case "Npgsql":
                driverDelegateType = typeof(PostgreSQLDelegate).AssemblyQualifiedName; break;

            case "Firebird":
                driverDelegateType = typeof(FirebirdDelegate).AssemblyQualifiedName; break;

            default:
                throw new System.Exception("dbProviderName unreasonable");
            }
            SchedulerCenter schedulerCenter = SchedulerCenter.Instance;

            schedulerCenter.Setting(new DbProvider(dbProviderName, connectionString), driverDelegateType);
            return(schedulerCenter);
        }
예제 #6
0
 public JobController()
 {
     scheduler = SchedulerCenter.Instance;
 }
예제 #7
0
 /// <summary>
 /// 任务调度对象
 /// </summary>
 /// <param name="schedulerCenter"></param>
 public JobController(SchedulerCenter schedulerCenter)
 {
     this.scheduler = schedulerCenter;
 }
예제 #8
0
 public ActionResult ScheduleState()
 {
     return(Succeed(SchedulerCenter.ScheduleAState()));
 }
예제 #9
0
 public async Task <ActionResult> StopSchedule()
 {
     return(Succeed(await SchedulerCenter.StopScheduleAsync()));
 }
예제 #10
0
파일: JobController.cs 프로젝트: uvaa/ytjkb
 /// <summary>
 /// 任务调度对象
 /// </summary>
 /// <param name="schedulerCenter"></param>
 public JobController(SchedulerCenter schedulerCenter, IDistributedCache cache)
 {
     _scheduler = schedulerCenter;
     _cache     = cache;
 }
예제 #11
0
 public HostedService(SchedulerCenter schedulerCenter)
 {
     this.schedulerCenter = schedulerCenter;
 }
예제 #12
0
 /// <summary>
 /// 获取正在运行的Jobs
 /// </summary>
 /// <returns></returns>
 private object GetAllRuningJob()
 {
     return(SchedulerCenter.GetInstance().ScheduleList);
 }
예제 #13
0
 public async Task get_all_job()
 {
     SchedulerCenter scheduler = SchedulerCenter.Instance;
     var             jobs      = await scheduler.GetAllJobAsync();
 }
예제 #14
0
 public HostedService(SchedulerCenter schedulerCenter)
 {
     this.schedulerCenter = schedulerCenter;
     mqttManager          = MqttManager.Instance;
 }