private void LoadSettings(ModuleInfo module)
        {
            Hashtable settings = new Hashtable(module.ModuleSettings);

            foreach (string key in module.TabModuleSettings.Keys)
            {
                settings[key] = module.TabModuleSettings[key];
            }

            foreach (PropertyInfo propertyInfo in GetProperties())
            {
                if (propertyInfo.CanWrite)
                {
                    string       settingName    = propertyInfo.Name;
                    string       settingDefault = string.Empty;
                    SettingsType settingScope   = SettingsType.TabModule;
                    object       setting        = null;

                    ModuleSettingAttribute settingInfo = GetPropertyAttribute(propertyInfo);

                    if (settingInfo != null)
                    {
                        settingName    = settingInfo.Name;
                        settingDefault = settingInfo.Default;
                        settingScope   = settingInfo.Scope;
                    }

                    switch (settingScope)
                    {
                    case SettingsType.Module:
                    case SettingsType.TabModule:
                        setting = settings[settingName];

                        if (setting == null || string.IsNullOrEmpty(setting.ToString()))
                        {
                            setting = settingDefault;
                        }

                        break;

                    case SettingsType.Portal:
                        setting = PortalController.GetPortalSetting(settingName, _portalId, settingDefault);
                        break;

                    case SettingsType.Host:
                        setting = HostController.Instance.GetString(settingName, settingDefault);
                        break;

                    default:
                        break;
                    }

                    propertyInfo.SetValue(this, Convert.ChangeType(setting, propertyInfo.PropertyType), null);
                }
            }
        }
        public void UpdateSettings()
        {
            ModuleController controller = new ModuleController();

            foreach (PropertyInfo propertyInfo in GetProperties())
            {
                if (propertyInfo.CanRead)
                {
                    string       settingName  = propertyInfo.Name;
                    object       settingValue = propertyInfo.GetValue(this, null);
                    SettingsType settingType  = SettingsType.TabModule;

                    ModuleSettingAttribute settingInfo = GetPropertyAttribute(propertyInfo);

                    if (settingInfo != null)
                    {
                        settingName = settingInfo.Name;
                        if (settingValue == null || string.IsNullOrEmpty(settingValue.ToString()))
                        {
                            settingValue = settingInfo.Default;
                        }
                        settingType = settingInfo.Scope;
                    }

                    switch (settingType)
                    {
                    case SettingsType.Module:
                        controller.UpdateModuleSetting(_moduleId, settingName, settingValue.ToString());
                        break;

                    case SettingsType.TabModule:
                        controller.UpdateTabModuleSetting(_tabModuleId, settingName, settingValue.ToString());
                        break;

                    case SettingsType.Portal:
                        PortalController.UpdatePortalSetting(_portalId, settingName, settingValue.ToString());
                        break;

                    case SettingsType.Host:
                        HostController.Instance.Update(settingName, settingValue.ToString());
                        break;

                    default:
                        break;
                    }
                }
            }
        }