예제 #1
0
        private static async void SetServerSettings()
        {
            Response <SettingModel> responseObj;

            var          communicationManager = new CommunicationManager();
            const string baseRoute            = "settings/";
            const string apiUrl = baseRoute + "GetSettingsToCacheOnStart";
            var          param  = new NameValueCollection();

            param.Add("forceServerCacheReset", "false");

            try
            {
                responseObj = await communicationManager.GetAsync <Response <SettingModel> >(param, apiUrl);

                if (responseObj != null)
                {
                    if (responseObj.ResultCode == 0)
                    {
                        //Cache the settings retrieved from the database for this layer
                        SettingsCacheManager settingsCache = new SettingsCacheManager(responseObj.DataItems, false);
                    }
                }
            }
            catch (Exception ex)
            {
                //Rule/Data-engine is not available. Do not prevent the application from starting
                var logger = new Logger(true);
                logger.Error(ex);
            }
        }
예제 #2
0
        /// <summary>
        /// Gets all of the settings needed for the forgot password functionality
        /// </summary>
        /// <returns></returns>
        private List <SettingModel> GetEmailSettings()
        {
            SettingsCacheManager cacheManager = new SettingsCacheManager();
            List <SettingModel>  settings     = cacheManager.GetAllAppSettings();

            return(settings);
        }
예제 #3
0
 public SuppressingHighlightingSettingsManager(
     [NotNull] Lifetime lifetime,
     [NotNull] ShellPartCatalogSet partsCatalogSet,
     [NotNull] ILanguages allLanguages,
     [NotNull] ISettingsStore settingsStore,
     [NotNull] IEnumerable <ICustomConfigurableSeverityItemProvider> customConfigurableSeverityItemProviders,
     [NotNull] SettingsCacheManager cacheManger)
     : base(lifetime, partsCatalogSet, allLanguages, settingsStore, customConfigurableSeverityItemProviders, cacheManger)
 {
 }
예제 #4
0
 public XmlDocInspectionsSettingsCache(
     Lifetime lifetime,
     SettingsCacheManager settingsCacheManager,
     ISettingsOptimization settingsOptimization,
     ISettingsStore settingsStore)
 {
     _lifetime             = lifetime;
     _settingsCacheManager = settingsCacheManager;
     _settingsOptimization = settingsOptimization;
     _settingsKey          = settingsStore.Schema.GetKey <XmlDocInspectionsSettings>();
 }
        private List <SettingModel> GetFromEmailSettings()
        {
            List <Setting> neededSettings = new List <Setting>()
            {
                Setting.FromDisplayName, Setting.FromEmail, Setting.WebServerUrl
            };
            SettingsCacheManager cacheMgr = new SettingsCacheManager();
            var retrievedSettings         = cacheMgr.GetAppSettingsByEnums(neededSettings);

            return(retrievedSettings);
        }
        public IHttpActionResult GetSettingsToCache(bool forceServerCacheReset)
        {
            var response = settingsDataProvider.GetSettingsToCache();

            if (response.ResultCode == 0)
            {
                //Cache the settings retrieved from the database for this layer
                SettingsCacheManager settingsCache = new SettingsCacheManager(response.DataItems, forceServerCacheReset);
            }

            return(new HttpResult <Response <SettingModel> >(response, Request));
        }
        public IHttpActionResult GetSettingsToCacheOnStart(bool forceServerCacheReset)
        {
            Response <SettingModel> data = settingsRuleEngine.GetSettingsToCache(forceServerCacheReset);

            if (data.ResultCode == 0)
            {
                //Cache the settings retrieved from the database
                SettingsCacheManager settingsCache = new SettingsCacheManager(data.DataItems, forceServerCacheReset);
            }

            return(new HttpResult <Response <SettingModel> >(data, Request));
        }
예제 #8
0
        public ConfigurationReader(string applicationName, string connectionString, int refreshTimerIntervalInMs)
        {
            var settingsCacheManager = new SettingsCacheManager();

            _advancedConfigurationReader = new AdvancedConfigurationReader(
                NullLogger <AdvancedConfigurationReader> .Instance, settingsCacheManager,
                new EmptyCacheMissHandler(),
                new PeriodicJobRunner(NullLogger <PeriodicJobRunner> .Instance,
                                      new ConfigurationUpdaterJob(settingsCacheManager,
                                                                  new ConfigurationStorageClient(NullLogger <ConfigurationStorageClient> .Instance,
                                                                                                 new HttpClient {
                BaseAddress = new Uri(connectionString)
            }),
                                                                  NullLogger <ConfigurationUpdaterJob> .Instance), applicationName,
                                      refreshTimerIntervalInMs));
        }
        public ActionResult GetSettingsToCache(bool forceServerCacheReset = false)
        {
            var response = configurationRepository.GetSettingsToCache(forceServerCacheReset);

            var settingsList = response.ToModel().DataItems;

            //Potentialy cache the settings retrieved from the database if needed
            SettingsCacheManager settingsCache = new SettingsCacheManager(settingsList, forceServerCacheReset);

            //filter all of the settings based on priority user-plugin-application with user being the highest
            var filteredSettings = settingsList.GroupBy(g => g.SettingsID).Select(o => o.OrderByDescending(c => c.SettingsTypeID).First()).ToList();

            //Serialize and convert to js for local caching
            dynamic settings = new ExpandoObject();

            settings.SettingsList = filteredSettings;

            var serializerSettings = new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            var settingsJson = JsonConvert.SerializeObject(settings, Formatting.Indented, serializerSettings);

            var settingsViewModel = new GetSettingsToCacheViewModel()
            {
                SettingsJson = settingsJson
            };

            if (Response != null)
            {
                Response.ContentType = "text/javascript";
            }

            return(View(settingsViewModel));
        }
예제 #10
0
 public SettingsCacheManagerTests()
 {
     _settingsCacheManager = new SettingsCacheManager();
 }