public ConfigParameter(EmailConfigEnum name, String value) : this(name) { this.Value = value; }
private ConfigParameter GetConfigParameter(EmailConfigEnum name) { int paramId = (int)name; String propName = Enum.GetName(typeof(EmailConfigEnum), name); var valueObject = thisType.GetProperty(propName).GetValue(this, null); String value = String.Empty; if (valueObject != null) value = valueObject.ToString(); return new ConfigParameter(name, value); }
public ConfigParameter(EmailConfigEnum name) { this.Id = (int)name; this.Name = Enum.GetName(typeof(EmailConfigEnum), name); }
/// <summary> /// Gets or sets instance properties by ConfigParameter object /// </summary> /// <param name="configParam">Configuration parameter as specified by the ConfigEnum</param> /// <returns>Instance of Configuration parameter object to manage persistence</returns> public ConfigParameter this[EmailConfigEnum configParam] { get { return GetConfigParameter(configParam); } set { if (value.Value != null && value.Value.Length > 0) { PropertyInfo prop = thisType.GetProperty(Enum.GetName(typeof(ConfigEnum), configParam)); Type t = prop.PropertyType; Object o = Convert.ChangeType(value.Value, t); prop.SetValue(this, o, null); } } }