Exemple #1
0
        public ManagedSchedule[] CreateSchedules()
        {
            List <ManagedSchedule> scheduleCollection = new List <ManagedSchedule>();
            List <JobElement>      jobList            = ConfigurationHelper.GetEnabledJobs();

            foreach (ScheduleElement scheduleType in InstanceConfig.CurrentInstance.ScheduleList)
            {
                ManagedSchedule managedSchedule = new ManagedSchedule();

                foreach (JobElement job in jobList)
                {
                    if (job.ScheduleName == scheduleType.Name)
                    {
                        managedSchedule.listeners.Add(job.Name);
                    }
                }

                // Only add schedule which is used
                if (managedSchedule.listeners.Count > 0)
                {
                    Schedule schedule = new Schedule(scheduleType.Name);
                    managedSchedule.Schedule = schedule;

                    foreach (RuleElement rule in scheduleType.RuleSet)
                    {
                        schedule.AddRule(rule.Second, rule.Minute, rule.Hour, rule.DayOfWeek, rule.DayOfMonth, rule.Month);
                    }

                    scheduleCollection.Add(managedSchedule);
                }
            }

            return(scheduleCollection.ToArray());
        }
Exemple #2
0
 public void AddSchedule(ManagedSchedule schedule)
 {
     scheduleDictionary.Add(schedule.Schedule.Name, schedule);
 }