/// <summary> /// Default constructor. /// </summary> /// <param name="owner">Owner vCard.</param> internal DeliveryAddressCollection(vCard owner) { m_pOwner = owner; m_pCollection = new List <DeliveryAddress>(); foreach (Item item in owner.Items.Get("ADR")) { m_pCollection.Add(DeliveryAddress.Parse(item)); } }
/// <summary> /// Add new delivery address to the collection. /// </summary> /// <param name="type">Delivery address type. Note: This value can be flagged value !</param> /// <param name="postOfficeAddress">Post office address.</param> /// <param name="extendedAddress">Extended address.</param> /// <param name="street">Street name.</param> /// <param name="locality">Locality(city).</param> /// <param name="region">Region.</param> /// <param name="postalCode">Postal code.</param> /// <param name="country">Country.</param> public void Add(DeliveryAddressType_enum type, string postOfficeAddress, string extendedAddress, string street, string locality, string region, string postalCode, string country) { string value = "" + postOfficeAddress + ";" + extendedAddress + ";" + street + ";" + locality + ";" + region + ";" + postalCode + ";" + country; Item item = m_pOwner.Items.Add("ADR", DeliveryAddress.AddressTypeToString(type), ""); item.SetDecodedValue(value); m_pCollection.Add(new DeliveryAddress(item, type, postOfficeAddress, extendedAddress, street, locality, region, postalCode, country)); }
/// <summary> /// Add new delivery address to the collection. /// </summary> /// <param name="type">Delivery address type. Note: This value can be flagged value !</param> /// <param name="postOfficeAddress">Post office address.</param> /// <param name="extendedAddress">Extended address.</param> /// <param name="street">Street name.</param> /// <param name="locality">Locality(city).</param> /// <param name="region">Region.</param> /// <param name="postalCode">Postal code.</param> /// <param name="country">Country.</param> public void Add(DeliveryAddressType_enum type, string postOfficeAddress, string extendedAddress, string street, string locality, string region, string postalCode, string country) { string value = "" + vCard_Utils.Encode(m_pOwner.Version, m_pOwner.Charset, postOfficeAddress) + ";" + vCard_Utils.Encode(m_pOwner.Version, m_pOwner.Charset, extendedAddress) + ";" + vCard_Utils.Encode(m_pOwner.Version, m_pOwner.Charset, street) + ";" + vCard_Utils.Encode(m_pOwner.Version, m_pOwner.Charset, locality) + ";" + vCard_Utils.Encode(m_pOwner.Version, m_pOwner.Charset, region) + ";" + vCard_Utils.Encode(m_pOwner.Version, m_pOwner.Charset, postalCode) + ";" + vCard_Utils.Encode(m_pOwner.Version, m_pOwner.Charset, country); Item item = m_pOwner.Items.Add("ADR", DeliveryAddress.AddressTypeToString(type), ""); item.FoldLongLines = false; if (m_pOwner.Version.StartsWith("2")) { item.ParametersString += ";ENCODING=QUOTED-PRINTABLE"; } item.ParametersString += ";CHARSET=" + m_pOwner.Charset.WebName; item.Value = value; m_pCollection.Add(new DeliveryAddress(item, type, postOfficeAddress, extendedAddress, street, locality, region, postalCode, country)); }
/// <summary> /// Removes specified item from the collection. /// </summary> /// <param name="item">Item to remove.</param> public void Remove(DeliveryAddress item) { m_pOwner.Items.Remove(item.Item); m_pCollection.Remove(item); }