Exemple #1
0
        public void SetConfigItem(string configKey, string configValue)
        {
            SystemConfigItem cfgItem = new SystemConfigItem()
            {
                ConfigKey   = configKey,
                ConfigValue = configValue
            };

            // Save or Update setting item
            SetConfigItem(cfgItem);
        }
Exemple #2
0
        // Methods ....................................................

        public string GetConfigItemValue(string configKey)
        {
            string itemValue = String.Empty;

            SystemConfigItem cfgItem = ConfigItems.FirstOrDefault(s => s.ConfigKey == configKey);

            if (cfgItem != null)
            {
                itemValue = cfgItem.ConfigValue;
            }

            return(itemValue);
        }
Exemple #3
0
        private void SetConfigItem(SystemConfigItem configItem)
        {
            // determine if the config item already exists
            SystemConfigItem cfgItem = ConfigItems.FirstOrDefault(s => s.ConfigKey == configItem.ConfigKey);

            // Create or update
            if (cfgItem == null)
            {
                cfgItem = new SystemConfigItem()
                {
                    ConfigKey   = configItem.ConfigKey,
                    ConfigValue = configItem.ConfigValue
                };

                // Add element to the list
                ConfigItems.Add(cfgItem);
            }
            else
            {
                // Update exiting element in list
                cfgItem.ConfigValue = configItem.ConfigValue;
            }
        }