Exemplo n.º 1
0
 private Abstractions.Address Convert(ContactAddress contactAddress)
 {
     Abstractions.Address address = new Abstractions.Address();
     address.City          = contactAddress.Locality;
     address.Country       = contactAddress.Country;
     address.Label         = contactAddress.Description;
     address.PostalCode    = contactAddress.PostalCode;
     address.Region        = contactAddress.Region;
     address.StreetAddress = contactAddress.StreetAddress;
     address.Type          = Convert(contactAddress.Kind);
     return(address);
 }
Exemplo n.º 2
0
    internal static Address GetAddress(ICursor c, Resources resources)
    {
      Address a = new Address();
      a.Country = c.GetString(StructuredPostal.Country);
      a.Region = c.GetString(StructuredPostal.Region);
      a.City = c.GetString(StructuredPostal.City);
      a.PostalCode = c.GetString(StructuredPostal.Postcode);

      AddressDataKind kind = (AddressDataKind)c.GetInt(c.GetColumnIndex(CommonColumns.Type));
      a.Type = kind.ToAddressType();
      a.Label = (kind != AddressDataKind.Custom)
            ? StructuredPostal.GetTypeLabel(resources, kind, String.Empty)
            : c.GetString(CommonColumns.Label);

      string street = c.GetString(StructuredPostal.Street);
      string pobox = c.GetString(StructuredPostal.Pobox);
      if (street != null)
        a.StreetAddress = street;
      if (pobox != null)
      {
        if (street != null)
          a.StreetAddress += Environment.NewLine;

        a.StreetAddress += pobox;
      }
      return a;
    }