예제 #1
0
 /// <summary>
 /// Gets the site settings.
 /// </summary>
 /// <returns></returns>
 public static SiteSettings GetSiteSettings()
 {
     //There should be some caching here even if the site has disabled caching. (there are to many calls to SiteSettings)
       return CacheHelper.CacheObject<SiteSettings>(delegate {
     SiteSettings siteSettings = SiteSettings.Load();
     if (siteSettings == null) {
       siteSettings = new SiteSettings();
     }
     return siteSettings;
       }
     , CACHE_DC_SITE_SETTINGS, CacheLength.GetLongCacheTime, CacheItemPriority.AboveNormal);
 }
 /// <summary>
 /// Saves the specified site settings.
 /// </summary>
 /// <param name="siteSettings">The site settings.</param>
 public void Save(SiteSettings siteSettings)
 {
     try {
     DatabaseConfigurationProvider databaseConfigurationProvider = new DatabaseConfigurationProvider();
     int id = databaseConfigurationProvider.SaveConfiguration(SiteSettings.SECTION_NAME, siteSettings, WebUtility.GetUserName());
     SiteSettingCache.RemoveSiteSettingsFromCache();
     if (id > 0) {
       MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblSiteSettingsSaved"));
     }
     else {
       MasterPage.MessageCenter.DisplayFailureMessage(LocalizationUtility.GetText("lblSiteSettingsNotSaved"));
     }
       }
       catch(Exception ex) {
     Logger.Error("Save", ex);
     MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
       }
 }
 /// <summary>
 /// Loads the site settings.
 /// </summary>
 private void LoadSiteSettings()
 {
     siteSettings = SiteSettingCache.GetSiteSettings(); ;
 }