Exemple #1
0
        /// <summary>
        /// 获取所有任务信息,返回JSON格式数据
        /// </summary>
        /// <returns></returns>
        public List <Dictionary <string, string> > GetAllJob(out string errMsg)
        {
            errMsg = string.Empty;
            if (_scheduler == null)
            {
                errMsg = "远程调度服务未开启,请检查!";
                return(new List <Dictionary <string, string> >());
            }
            List <Dictionary <string, string> > listDic = new List <Dictionary <string, string> >();
            List <JobData>       listJobs = new List <JobData>();
            IList <JobGroupData> list     = _scheduler.Data.JobGroups;

            if (list != null && list.Count > 0)
            {
                foreach (JobGroupData group in list)
                {
                    listJobs.AddRange(group.Jobs);
                }
            }
            if (listJobs != null && listJobs.Count > 0)
            {
                foreach (JobData job in listJobs)
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    JobDetailsData jobData          = _scheduler.GetJobDetailsData(job.Name, job.GroupName);
                    dic["jobGroup"] = job.GroupName;
                    dic["jobName"]  = job.Name;
                    string status = string.Empty;
                    switch (job.Status)
                    {
                    case ActivityStatus.Active:
                        status = "运行中";
                        break;

                    case ActivityStatus.Complete:
                        status = "运行完毕";
                        break;

                    case ActivityStatus.Mixed:
                        status = "运行中";
                        break;

                    case ActivityStatus.Paused:
                        status = "暂停中";
                        break;
                    }
                    dic["jobStatus"] = status;
                    dic["jobType"]   = jobData.JobProperties["Full name"] == null ? string.Empty : jobData.JobProperties["Full name"].ToString();     //任务类型
                    dic["jobDes"]    = jobData.JobProperties["Description"] == null ? string.Empty : jobData.JobProperties["Description"].ToString(); //任务描述
                    dic["viewLog"]   = "查看日志";
                    listDic.Add(dic);
                }
            }
            return(listDic);
        }
Exemple #2
0
        /// <summary>
        /// 获取任务详细信息
        /// </summary>
        /// <param name="jobName"></param>
        /// <param name="jobGroupName"></param>
        /// <returns></returns>
        public JobDetailsData GetJobDetailsData(string jobName, string jobGroupName)
        {
            JobDetailsData jobData = _scheduler.GetJobDetailsData(jobName, jobGroupName);

            return(jobData);
        }