示例#1
0
        public JobSchedule GetSchedule()
        {
            var jobKey = new JobKey(JobName, JobGroup);

            var trigger = Instance.GetTriggersOfJob(jobKey).FirstOrDefault();

            var js = new JobSchedule();

            if (trigger != null)
            {
                js.Name         = trigger.Key.Name;
                js.Group        = trigger.Key.Group;
                js.Description  = trigger.Description;
                js.Priority     = trigger.Priority;
                js.TriggerType  = trigger.GetType().Name;
                js.TriggerState = Instance.GetTriggerState(trigger.Key).ToString();

                DateTimeOffset?startTime = trigger.StartTimeUtc;
                js.StartTime = TimeZone.CurrentTimeZone.ToLocalTime(startTime.Value.DateTime);

                var nextFireTime = trigger.GetNextFireTimeUtc();
                if (nextFireTime.HasValue)
                {
                    js.NextFire = TimeZone.CurrentTimeZone.ToLocalTime(nextFireTime.Value.DateTime);
                }

                var previousFireTime = trigger.GetPreviousFireTimeUtc();
                if (previousFireTime.HasValue)
                {
                    js.LastFire = TimeZone.CurrentTimeZone.ToLocalTime(previousFireTime.Value.DateTime);
                }
            }

            return(js);
        }
示例#2
0
            public JobSchedule GetSchedule()
            {
                var jobKey = new JobKey(JobName, JobGroup);

                var trigger = Instance.GetTriggersOfJob(jobKey).FirstOrDefault();

                var js = new JobSchedule();

                if (trigger != null)
                {
                    js.Name = trigger.Key.Name;
                    js.Group = trigger.Key.Group;
                    js.Description = trigger.Description;
                    js.Priority = trigger.Priority;
                    js.TriggerType = trigger.GetType().Name;
                    js.TriggerState = Instance.GetTriggerState(trigger.Key).ToString();

                    DateTimeOffset? startTime = trigger.StartTimeUtc;
                    js.StartTime = TimeZone.CurrentTimeZone.ToLocalTime(startTime.Value.DateTime);

                    var nextFireTime = trigger.GetNextFireTimeUtc();
                    if (nextFireTime.HasValue)
                    {
                        js.NextFire = TimeZone.CurrentTimeZone.ToLocalTime(nextFireTime.Value.DateTime);
                    }

                    var previousFireTime = trigger.GetPreviousFireTimeUtc();
                    if (previousFireTime.HasValue)
                    {
                        js.LastFire = TimeZone.CurrentTimeZone.ToLocalTime(previousFireTime.Value.DateTime);
                    }
                }

                return js;
            }
示例#3
0
        public List <JobSchedule> GetSchedules()
        {
            var jcs = new List <JobSchedule>();

            foreach (var group in Instance.GetJobGroupNames())
            {
                var groupMatcher = GroupMatcher <JobKey> .GroupContains(group);

                var jobKeys = Instance.GetJobKeys(groupMatcher);

                foreach (var jobKey in jobKeys)
                {
                    var triggers = Instance.GetTriggersOfJob(jobKey);
                    foreach (var trigger in triggers)
                    {
                        var js = new JobSchedule();
                        js.Name         = jobKey.Name;
                        js.Group        = jobKey.Group;
                        js.TriggerType  = trigger.GetType().Name;
                        js.TriggerState = Instance.GetTriggerState(trigger.Key).ToString();
                        js.Priority     = trigger.Priority;

                        DateTimeOffset?startTime = trigger.StartTimeUtc;
                        js.StartTime = TimeZone.CurrentTimeZone.ToLocalTime(startTime.Value.DateTime);

                        DateTimeOffset?nextFireTime = trigger.GetNextFireTimeUtc();
                        if (nextFireTime.HasValue)
                        {
                            js.NextFire = TimeZone.CurrentTimeZone.ToLocalTime(nextFireTime.Value.DateTime);
                        }

                        DateTimeOffset?previousFireTime = trigger.GetPreviousFireTimeUtc();
                        if (previousFireTime.HasValue)
                        {
                            js.LastFire = TimeZone.CurrentTimeZone.ToLocalTime(previousFireTime.Value.DateTime);
                        }

                        jcs.Add(js);
                    }
                }
            }
            return(jcs);
        }
示例#4
0
            public List<JobSchedule> GetSchedules(string groupName)
            {
                var jcs = new List<JobSchedule>();

                var groupMatcher = GroupMatcher<JobKey>.GroupContains(groupName);
                var jobKeys = Instance.GetJobKeys(groupMatcher);

                foreach (var jobKey in jobKeys)
                {
                    var triggers = Instance.GetTriggersOfJob(jobKey);
                    foreach (var trigger in triggers)
                    {
                        var js = new JobSchedule();
                        js.Name = jobKey.Name;
                        js.Description = trigger.Description;
                        js.Group = jobKey.Group;
                        js.TriggerType = trigger.GetType().Name;
                        js.TriggerState = Instance.GetTriggerState(trigger.Key).ToString();
                        js.Priority = trigger.Priority;

                        DateTimeOffset? startTime = trigger.StartTimeUtc;
                        js.StartTime = TimeZone.CurrentTimeZone.ToLocalTime(startTime.Value.DateTime);

                        DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
                        if (nextFireTime.HasValue)
                        {
                            js.NextFire = TimeZone.CurrentTimeZone.ToLocalTime(nextFireTime.Value.DateTime);
                        }

                        DateTimeOffset? previousFireTime = trigger.GetPreviousFireTimeUtc();
                        if (previousFireTime.HasValue)
                        {
                            js.LastFire = TimeZone.CurrentTimeZone.ToLocalTime(previousFireTime.Value.DateTime);
                        }

                        jcs.Add(js);
                    }
                }
                return jcs;
            }