/// <summary> /// Equivalence comparison which ignores validity range /// </summary> /// <param name="that">The Address to compare to</param> /// <returns>True if all fields other than the validity range are the same, False otherwise</returns> public bool IsSameAddress(Address that) { return (that != null) && ((this._unit == default(string)) ? (that._unit == default(string)) : this._unit.Equals(that._unit, StringComparison.CurrentCultureIgnoreCase)) && ((this._street == default(string)) ? (that._street == default(string)) : this._street.Equals(that._street, StringComparison.CurrentCultureIgnoreCase)) && ((this._city == default(string)) ? (that._city == default(string)) : this._city.Equals(that._city, StringComparison.CurrentCultureIgnoreCase)) && ((this._province == default(string)) ? (that._province == default(string)) : this._province.Equals(that._province, StringComparison.CurrentCultureIgnoreCase)) && ((this._postalCode == default(string)) ? (that._postalCode == default(string)) : this._postalCode.Replace(" ", "").Equals(that._postalCode.Replace(" ", ""), StringComparison.CurrentCultureIgnoreCase)) && ((this._country == default(string)) ? (that._country == default(string)) : this._country.Equals(that._country, StringComparison.CurrentCultureIgnoreCase)) && ((this._type == default(AddressType)) ? (that._type == default(AddressType)) : this._type.Equals(that._type)) && true; }
public Address CreateAddress(AddressDetail addressDetail) { if (addressDetail == null) return null; Address newAddress = new Address(); newAddress.Street = addressDetail.Street; newAddress.Unit = addressDetail.Unit; newAddress.City = addressDetail.City; newAddress.Province = addressDetail.Province; newAddress.PostalCode = addressDetail.PostalCode; newAddress.Country = addressDetail.Country; newAddress.Type = EnumUtils.GetEnumValue<AddressType>(addressDetail.Type); newAddress.ValidRange.From = addressDetail.ValidRangeFrom; newAddress.ValidRange.Until = addressDetail.ValidRangeUntil; return newAddress; }
public AddressDetail CreateAddressDetail(Address address, IPersistenceContext context) { if (address == null) return null; AddressDetail addressDetail = new AddressDetail(); addressDetail.Street = address.Street; addressDetail.Unit = address.Unit; addressDetail.City = address.City; addressDetail.Province = address.Province; addressDetail.PostalCode = address.PostalCode; addressDetail.Country = address.Country; addressDetail.Type = EnumUtils.GetEnumValueInfo(address.Type, context); addressDetail.ValidRangeFrom = address.ValidRange.From; addressDetail.ValidRangeUntil = address.ValidRange.Until; return addressDetail; }