示例#1
0
 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));
 }
示例#2
0
        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);
        }
示例#3
0
        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());
        }
示例#5
0
 private static string ToString(PostalSuburb postalSuburb, bool hasSubdivisionAccess, bool hasSubSubdivisionAccess)
 {
     return(ToString(postalSuburb, true, hasSubdivisionAccess, hasSubSubdivisionAccess));
 }
示例#6
0
 public static string ToString(PostalSuburb postalSuburb, bool suburbFirst)
 {
     return(ToString(postalSuburb, suburbFirst, true, true));
 }