/// <summary> /// Gets a configuration value for the selling company. /// </summary> public TValue GetConfiguration <TValue>(String name, TValue defaultValue) { TValue returnValue = defaultValue; // Identify the configuration value for the selling company LocalSellingCompanyConfigModel configuration = this.Configurations.FirstOrDefault(config => String.Equals(config.KeyName, name, StringComparison.OrdinalIgnoreCase)); if (configuration != null) { returnValue = configuration.Value.ConvertTo <TValue>(defaultValue); } return(returnValue); }
/// <summary> /// Gets a configuration value for the selling company. /// </summary> public void SetConfiguration <TValue>(String name, SellingCompanyConfigTypes type, TValue value) { // Identify the configuration for the selling company. LocalSellingCompanyConfigModel configuration = this.Configurations.FirstOrDefault(config => String.Equals(config.KeyName, name, StringComparison.OrdinalIgnoreCase)); if (configuration == null) { configuration = this.Provider.Common.SellingCompanyConfig.Create(); configuration.KeyName = name; } // Set the configuration value. configuration.ValueToUse = type.ConvertTo <Int32>().ConvertTo <Byte>(); configuration.Value = value; }