public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { string strvalue = value as string; if (strvalue != null) { AddressBase addr = AddressBase.Factory(strvalue); return(addr); } else { return(new AddressBase()); } }
public static AddressBase GetAddress(Object address, Object type) { AddressBase ret; if (Convert.IsDBNull(address) || Convert.IsDBNull(type)) { ret = new AddressBase(); } else { try { ret = AddressBase.Factory(address.ToString(), (AddressType)(Convert.ToInt32(type))); } catch { ret = new EmptyAddress(); } } return(ret); }