public override string ToString() { StringBuilder str = new StringBuilder(); String addrStr = base.ToString(); if (!string.IsNullOrEmpty(addrStr)) { str.AppendLine(addrStr); } if (!string.IsNullOrEmpty(InternalLocation.GetValueOrDefault())) { str.AppendLine(InternalLocation.GetValueOrDefault()); } if (!string.IsNullOrEmpty(PostalBox.GetValueOrDefault())) { str.AppendLine(PostalBox.GetValueOrDefault()); } if (!string.IsNullOrEmpty(Town.GetValueOrDefault())) { str.AppendLine(Town.GetValueOrDefault()); } if (!string.IsNullOrEmpty(Region.GetValueOrDefault())) { str.AppendLine(Region.GetValueOrDefault()); } if (!string.IsNullOrEmpty(PostalCode.GetValueOrDefault())) { str.AppendLine(PostalCode.GetValueOrDefault()); } if (!string.IsNullOrEmpty(Country.GetValueOrDefault())) { str.AppendLine(Country.GetValueOrDefault()); } return(str.ToString().Trim()); }
public override string WhereRule() { string baseErr = base.WhereRule(); if (string.IsNullOrEmpty(InternalLocation.GetValueOrDefault()) && (AddressLines == null || AddressLines.Count == 0) && string.IsNullOrEmpty(Town.GetValueOrDefault()) && string.IsNullOrEmpty(Region.GetValueOrDefault()) && string.IsNullOrEmpty(Country.GetValueOrDefault())) { baseErr += "PostalAddress: At least one attribute of internal location, address lines, town, region or country must be asserted."; } return(baseErr); }