Example #1
0
        public static SiteSettings PopulateSiteSettingsFromIDataReader(IDataReader dr)
        {
            SiteSettings settings = null;

            try {
                settings =  Serializer.ConvertToObject(dr["SettingsXML"] as string,typeof(SiteSettings)) as SiteSettings;

                //When new sites/communities are created, it is very likely they will not have any XML history.
                //Serializer.ConvertToObject will return null if no XML is present.
                if(settings == null)
                    settings = new SiteSettings();
            } catch (Exception exception) {

                if (exception.InnerException is XmlException) {

                    Debug.WriteLine("Critical Error: SiteSettings serialized XML is invalid");
                    CSException csException = new CSException(CSExceptionType.SiteSettingsInvalidXML);

                    throw csException;

                } else {
                    throw exception;
                }

            }

            // read addition data
            settings.SettingsID = (int) dr["SettingsID"];
            settings.SiteDomain = dr["SiteUrl"] as string;
            settings.ForumsDisabled = (bool)dr["Disabled"];
            settings.SiteKey = (Guid)dr["SettingsKey"];
            settings.ApplicationName = dr["ApplicationName"] as string;

            return settings;
        }
Example #2
0
 public abstract void SaveSiteSettings(SiteSettings siteSettings);
Example #3
0
 public static void Save(SiteSettings settings)
 {
     CommonDataProvider dp = CommonDataProvider.Instance();
     dp.SaveSiteSettings(settings);
 }