示例#1
0
        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;
            }
        }
        // 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++;
            }
        }