using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace UniversalEditor.ObjectModels.Contact { public class ContactPhysicalAddress : ICloneable, IContactLabelContainer, IContactComplexType { public class ContactPhysicalAddressCollection : System.Collections.ObjectModel.Collection { } #region IContactComplexType members private bool mvarIsEmpty = false; public bool IsEmpty { get { return mvarIsEmpty; } set { mvarIsEmpty = value; } } private Guid mvarElementID = Guid.Empty; public Guid ElementID { get { return mvarElementID; } set { mvarElementID = value; } } private DateTime? mvarModificationDate = null; public DateTime? ModificationDate { get { return mvarModificationDate; } set { mvarModificationDate = value; } } #endregion private ContactGenericField mvarCountry = ContactGenericField.Empty; public ContactGenericField Country { get { return mvarCountry; } set { mvarCountry = value; } } private ContactGenericField mvarPostalCode = ContactGenericField.Empty; public ContactGenericField PostalCode { get { return mvarPostalCode; } set { mvarPostalCode = value; } } private ContactGenericField mvarRegion = ContactGenericField.Empty; public ContactGenericField Region { get { return mvarRegion; } set { mvarRegion = value; } } private ContactGenericField mvarLocality = ContactGenericField.Empty; public ContactGenericField Locality { get { return mvarLocality; } set { mvarLocality = value; } } private ContactGenericField mvarStreetAddress = ContactGenericField.Empty; public ContactGenericField StreetAddress { get { return mvarStreetAddress; } set { mvarStreetAddress = value; } } private ContactLabel.ContactLabelCollection mvarLabels = new ContactLabel.ContactLabelCollection(); public ContactLabel.ContactLabelCollection Labels { get { return mvarLabels; } } public object Clone() { ContactPhysicalAddress clone = new ContactPhysicalAddress(); clone.Country = mvarCountry; clone.ElementID = mvarElementID; foreach (ContactLabel item in mvarLabels) { clone.Labels.Add(item.Clone() as ContactLabel); } clone.IsEmpty = mvarIsEmpty; clone.Locality = mvarLocality; clone.ModificationDate = mvarModificationDate; clone.PostalCode = mvarPostalCode; clone.Region = mvarRegion; clone.StreetAddress = mvarStreetAddress; return clone; } public string ToString (bool multiline) { StringBuilder sb = new StringBuilder (); sb.Append (StreetAddress); if (multiline) { sb.Append (System.Environment.NewLine); } else { sb.Append (", "); } sb.Append (Locality); sb.Append (", "); sb.Append (Region); sb.Append (' '); sb.Append (PostalCode); return sb.ToString (); } public override string ToString () { return ToString (false); } } }