private static bool Contains(Region region, PostalSuburb postalSuburb) { return((from regionLocality in region.GetLocalities() from regionPostalCode in regionLocality.GetPostalCodes() from regionPostalSuburb in regionPostalCode.GetPostalSuburbs() select regionPostalSuburb).Contains(postalSuburb)); }
private static string ToString(PostalSuburb postalSuburb, bool suburbFirst, bool hasSubdivisionAccess, bool hasSubSubdivisionAccess) { if (hasSubdivisionAccess) { if (hasSubSubdivisionAccess) { // Access to everything. if (suburbFirst) { return(postalSuburb.Name + " " + postalSuburb.CountrySubdivision.ShortName + " " + postalSuburb.PostalCode.Postcode); } return(postalSuburb.PostalCode.Postcode + " " + postalSuburb.Name + " " + postalSuburb.CountrySubdivision.ShortName); } // Access to only the subdivision. return(postalSuburb.CountrySubdivision.ShortName); } if (hasSubSubdivisionAccess) { // Access to only the suburb and postcode. if (suburbFirst) { return(postalSuburb.Name + " " + postalSuburb.PostalCode.Postcode); } return(postalSuburb.PostalCode.Postcode + " " + postalSuburb.Name); } // Access to nothing. return(string.Empty); }
private string Resolve(Country country, PostalSuburb postalSuburb, string location) { // If the location is postcode first, e.g. 3000 Melbourne VIC, then don't flip it to Melbourne VIC 3000. return(string.Compare(location, postalSuburb.ToStringPostcodeFirst(), StringComparison.InvariantCultureIgnoreCase) == 0 ? location : ResolveNamedLocation(country, postalSuburb, location)); }
private void AppendSuburbRecord(StringBuilder sb, string suburb) { if (sb.Length != 0) { sb.Append(';'); } // Resolve the suburb. var locationReference = new LocationReference(); _locationQuery.ResolveLocation(locationReference, Australia, suburb); PostalSuburb postalSuburb = locationReference.PostalSuburb; // Append. sb.Append(postalSuburb.Id).Append(":p=").Append(postalSuburb.ToString()); }
private static string ToString(PostalSuburb postalSuburb, bool hasSubdivisionAccess, bool hasSubSubdivisionAccess) { return(ToString(postalSuburb, true, hasSubdivisionAccess, hasSubSubdivisionAccess)); }
public static string ToString(PostalSuburb postalSuburb, bool suburbFirst) { return(ToString(postalSuburb, suburbFirst, true, true)); }