Пример #1
0
        //Called when Server is being shut down.
        //Mark all running jobs to stop.
        public async Task SetStopAllRunningJobsAsync(bool isSync)
        {
            if (isSync)
            {
                //Stop all running Jobs
                var runningJobsList = jobDAL.GetJobsByProcessAndStatus(workerProcessID, JobStatus.Running);
                if (runningJobsList.Count() > 0)
                {
                    jobDAL.SetCommandStop(runningJobsList.Select(x => x.JobID).ToList());
                }
            }
            else
            {
                //Stop all running Jobs
                var runningJobsList = await jobDAL.GetJobsByProcessAndStatusAsync(workerProcessID, JobStatus.Running);

                if (runningJobsList.Count() > 0)
                {
                    await jobDAL.SetCommandStopAsync(runningJobsList.Select(x => x.JobID).ToList());
                }
            }
        }