public static void AddActionsToScheduler(CoreBusinessLayerService service) { GeolocationActionContext geolocationContext = new GeolocationActionContext(); string[] availableForGeolocation = WorldMapPointsDAL.GetEntitiesAvailableForGeolocation(); int num = 1; foreach (string str1 in availableForGeolocation) { string currentEntity = str1; Scheduler.get_Instance().Add(new ScheduledTask(string.Format("GeolocationJob-{0}", (object)num), (TimerCallback)(o => { string str; if (!Settings.IsAutomaticGeolocationEnabled || !WebSettingsDAL.TryGet(string.Format("{0}_GeolocationField", (object)currentEntity), ref str) || string.IsNullOrWhiteSpace(str)) { return; } GeolocationJobInitializer.log.Info((object)"Starting action execution"); CoreBusinessLayerService businessLayerService = service; ActionDefinition actionDefinition = new ActionDefinition(); actionDefinition.set_ActionTypeID("Geolocation"); actionDefinition.set_Enabled(true); ActionProperties actionProperties = new ActionProperties(); actionProperties.Add("StreetAddress", str); actionProperties.Add("Entity", currentEntity); actionProperties.Add("MapQuestApiKey", WorldMapPointsDAL.GetMapQuestKey()); actionDefinition.set_Properties(actionProperties); GeolocationActionContext geolocationActionContext = geolocationContext; businessLayerService.ExecuteAction(actionDefinition, (ActionContextBase)geolocationActionContext); }), (object)null, Settings.AutomaticGeolocationCheckInterval)); ++num; } }
public static void AddActionsToScheduler( ReportJobConfiguration config, CoreBusinessLayerService service) { if (!config.get_Enabled()) { return; } ReportingActionContext reportingActionContext = new ReportingActionContext(); reportingActionContext.set_AccountID(config.get_AccountID()); reportingActionContext.set_UrlsGroupedByLeftPart(ReportJobInitializer.GroupUrls(config)); reportingActionContext.set_WebsiteID(config.get_WebsiteID()); ReportingActionContext reportingContext = reportingActionContext; MacroContext macroContext = ((ActionContextBase)reportingContext).get_MacroContext(); ReportingContext reportingContext1 = new ReportingContext(); reportingContext1.set_AccountID(config.get_AccountID()); reportingContext1.set_ScheduleName(config.get_Name()); reportingContext1.set_ScheduleDescription(config.get_Description()); reportingContext1.set_LastRun(config.get_LastRun()); reportingContext1.set_WebsiteID(config.get_WebsiteID()); macroContext.Add((ContextBase)reportingContext1); ((ActionContextBase)reportingContext).get_MacroContext().Add((ContextBase) new GenericContext()); int num = 0; if (config.get_Schedules() == null) { return; } using (List <ReportSchedule> .Enumerator enumerator1 = config.get_Schedules().GetEnumerator()) { while (enumerator1.MoveNext()) { ReportSchedule current = enumerator1.Current; DateTime dateTime = !current.get_EndTime().HasValue ? DateTime.MaxValue : current.get_EndTime().Value; Scheduler.get_Instance().Add(new ScheduledTask(string.Format("ReportJob-{0}_{1}", (object)config.get_ReportJobID(), (object)num), (TimerCallback)(o => { ReportJobInitializer.log.Info((object)"Starting action execution"); using (List <ActionDefinition> .Enumerator enumerator = config.get_Actions().GetEnumerator()) { while (enumerator.MoveNext()) { service.ExecuteAction(enumerator.Current, (ActionContextBase)reportingContext); } } config.set_LastRun(new DateTime?(DateTime.Now.ToUniversalTime())); ReportJobDAL.UpdateLastRun(config.get_ReportJobID(), config.get_LastRun()); }), (object)null, current.get_CronExpression(), current.get_StartTime(), dateTime, config.get_LastRun(), current.get_CronExpressionTimeZoneInfo()), true); ++num; } } }
// Token: 0x060003A4 RID: 932 RVA: 0x00017FE4 File Offset: 0x000161E4 public static void AddActionsToScheduler(ReportJobConfiguration config, CoreBusinessLayerService service) { if (!config.Enabled) { return; } ReportingActionContext reportingContext = new ReportingActionContext { AccountID = config.AccountID, UrlsGroupedByLeftPart = ReportJobInitializer.GroupUrls(config), WebsiteID = config.WebsiteID }; reportingContext.MacroContext.Add(new ReportingContext { AccountID = config.AccountID, ScheduleName = config.Name, ScheduleDescription = config.Description, LastRun = config.LastRun, WebsiteID = config.WebsiteID }); reportingContext.MacroContext.Add(new GenericContext()); int num = 0; if (config.Schedules != null) { TimerCallback < > 9__0; foreach (ReportSchedule reportSchedule in config.Schedules) { DateTime dateTime = (reportSchedule.EndTime == null) ? DateTime.MaxValue : reportSchedule.EndTime.Value; string text = string.Format("ReportJob-{0}_{1}", config.ReportJobID, num); TimerCallback timerCallback; if ((timerCallback = < > 9__0) == null) { timerCallback = (< > 9__0 = delegate(object o) { ReportJobInitializer.log.Info("Starting action execution"); foreach (ActionDefinition actionDefinition in config.Actions) { service.ExecuteAction(actionDefinition, reportingContext); } config.LastRun = new DateTime?(DateTime.Now.ToUniversalTime()); ReportJobDAL.UpdateLastRun(config.ReportJobID, config.LastRun); }); } ScheduledTask scheduledTask = new ScheduledTask(text, timerCallback, null, reportSchedule.CronExpression, reportSchedule.StartTime, dateTime, config.LastRun, reportSchedule.CronExpressionTimeZoneInfo); Scheduler.Instance.Add(scheduledTask, true); num++; } } }
// Token: 0x06000431 RID: 1073 RVA: 0x0001C648 File Offset: 0x0001A848 public static void AddActionsToScheduler(CoreBusinessLayerService service) { GeolocationActionContext geolocationContext = new GeolocationActionContext(); string[] entitiesAvailableForGeolocation = WorldMapPointsDAL.GetEntitiesAvailableForGeolocation(); int num = 1; string[] array = entitiesAvailableForGeolocation; for (int i = 0; i < array.Length; i++) { string currentEntity2 = array[i]; string currentEntity = currentEntity2; ScheduledTask scheduledTask = new ScheduledTask(string.Format("GeolocationJob-{0}", num), delegate(object o) { if (!Settings.IsAutomaticGeolocationEnabled) { return; } string text; if (!WebSettingsDAL.TryGet(string.Format("{0}_GeolocationField", currentEntity), ref text)) { return; } if (string.IsNullOrWhiteSpace(text)) { return; } GeolocationJobInitializer.log.Info("Starting action execution"); CoreBusinessLayerService service2 = service; ActionDefinition actionDefinition = new ActionDefinition(); actionDefinition.ActionTypeID = "Geolocation"; actionDefinition.Enabled = true; ActionProperties actionProperties = new ActionProperties(); actionProperties.Add("StreetAddress", text); actionProperties.Add("Entity", currentEntity); actionProperties.Add("MapQuestApiKey", WorldMapPointsDAL.GetMapQuestKey()); actionDefinition.Properties = actionProperties; service2.ExecuteAction(actionDefinition, geolocationContext); }, null, Settings.AutomaticGeolocationCheckInterval); Scheduler.Instance.Add(scheduledTask); num++; } }