Exemplo n.º 1
0
        public Task JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default)
        {
            return(Task.Run(() =>
            {
                //执行前执行
                IJobDetail job = context.JobDetail;
                job.JobDataMap.Put(TaskJobBase.SQL, "SELECT * FROM [ACT_ID_USER]");
                job.JobDataMap.Put(TaskJobBase.ExecutionCount, 1);
                job.JobDataMap.Put(TaskJobBase.BATCHFILES_PATH, ConfigHelper.GetBatchFilesPath(job.Key.Name));

                object path = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\JetSun\3.0\", "ExecutablePath", "");
                string executePath = path == null ? "" : path.ToString();
                SchedulerElement se = ConfigHelper.GetElementByExecutablePath(executePath);
                job.JobDataMap.Put(TaskJobBase.CALLBACK_REGISTRYFILE, se.RegistryFile);
                _logger.Info($"JobToBeExecuted: {se.RegistryFile}");
            }));
        }
Exemplo n.º 2
0
        public static string GetBatchFilesPath(string jobname)
        {
            SchedulerElement item = SchedulerCollection.FirstOrDefault(a => a.JobName == jobname);

            return(item?.BatchFilesPath);
        }
Exemplo n.º 3
0
        public static string GetCustomerName(string jobname)
        {
            SchedulerElement item = SchedulerCollection.FirstOrDefault(a => a.JobName == jobname);

            return(item?.CustomerName);
        }
Exemplo n.º 4
0
        public static SchedulerElement GetElementByExecutablePath(string executablePath)
        {
            SchedulerElement item = SchedulerCollection.FirstOrDefault(a => executablePath.StartsWith(a.BasePath, StringComparison.OrdinalIgnoreCase));

            return(item);
        }