Exemplo n.º 1
0
        public static IDictionary <AddressFormatTable.AddressPart, AddressComponent> GetAddressInfo(Item item, PhysicalAddressType type)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (type != PhysicalAddressType.Business && type != PhysicalAddressType.Home && type != PhysicalAddressType.Other)
            {
                throw new ArgumentOutOfRangeException("type", "type must be Business, Home or Other");
            }
            IDictionary <AddressFormatTable.AddressPart, AddressComponent> dictionary = new Dictionary <AddressFormatTable.AddressPart, AddressComponent>();

            AddressFormatTable.AddressPart[] cultureAddressMap = AddressFormatTable.GetCultureAddressMap(Culture.GetUserCulture().LCID);
            foreach (AddressFormatTable.AddressPart addressPart in cultureAddressMap)
            {
                PropertyDefinition propertyDefinition = AddressFormatTable.LookupAddressProperty(addressPart, type);
                string             property           = ItemUtility.GetProperty <string>(item, propertyDefinition, string.Empty);
                if (property.Length > 0)
                {
                    AddressComponent value = ContactUtilities.ProcessAddressPartInternal(property, addressPart);
                    dictionary[addressPart] = value;
                }
            }
            return(dictionary);
        }
Exemplo n.º 2
0
        public static List <ContactPropertyInfo> GetAddressInfo(PhysicalAddressType type)
        {
            if (type != PhysicalAddressType.Business && type != PhysicalAddressType.Home && type != PhysicalAddressType.Other)
            {
                throw new ArgumentOutOfRangeException("type", "type must be Business, Home or Other");
            }
            List <ContactPropertyInfo> list = new List <ContactPropertyInfo>();

            AddressFormatTable.AddressPart[] cultureAddressMap = AddressFormatTable.GetCultureAddressMap(Culture.GetUserCulture().LCID);
            foreach (AddressFormatTable.AddressPart addressPart in cultureAddressMap)
            {
                ContactPropertyInfo item = ContactUtilities.LookupAddressProperty(addressPart, type);
                list.Add(item);
            }
            return(list);
        }
Exemplo n.º 3
0
        public static IDictionary <AddressFormatTable.AddressPart, AddressComponent> GetAddressInfo(IADOrgPerson orgPerson)
        {
            if (orgPerson == null)
            {
                throw new ArgumentNullException("orgPerson");
            }
            IDictionary <AddressFormatTable.AddressPart, AddressComponent> dictionary = new Dictionary <AddressFormatTable.AddressPart, AddressComponent>();

            AddressFormatTable.AddressPart[] cultureAddressMap = AddressFormatTable.GetCultureAddressMap(Culture.GetUserCulture().LCID);
            foreach (AddressFormatTable.AddressPart addressPart in cultureAddressMap)
            {
                PropertyDefinition property = AddressFormatTable.LookupAddressPropertyAd(addressPart);
                string             adorgPersonStringPropertyValue = ContactUtilities.GetADOrgPersonStringPropertyValue(orgPerson, property);
                if (!string.IsNullOrEmpty(adorgPersonStringPropertyValue))
                {
                    AddressComponent value = ContactUtilities.ProcessAddressPartInternal(adorgPersonStringPropertyValue, addressPart);
                    dictionary[addressPart] = value;
                }
            }
            return(dictionary);
        }
 // Token: 0x060006D9 RID: 1753 RVA: 0x00035FC4 File Offset: 0x000341C4
 // Note: this type is marked as 'beforefieldinit'.
 static AddressFormatTable()
 {
     AddressFormatTable.AddressPart[] array = new AddressFormatTable.AddressPart[5];
     array[0] = AddressFormatTable.AddressPart.PostalCode;
     array[1] = AddressFormatTable.AddressPart.Country;
     array[2] = AddressFormatTable.AddressPart.State;
     array[3] = AddressFormatTable.AddressPart.City;
     AddressFormatTable.zhTWAddressFormat = array;
     AddressFormatTable.AddressPart[] array2 = new AddressFormatTable.AddressPart[5];
     array2[0] = AddressFormatTable.AddressPart.Country;
     array2[1] = AddressFormatTable.AddressPart.PostalCode;
     array2[2] = AddressFormatTable.AddressPart.State;
     array2[3] = AddressFormatTable.AddressPart.City;
     AddressFormatTable.RussianAddressFormat = array2;
     AddressFormatTable.AddressPart[] array3 = new AddressFormatTable.AddressPart[5];
     array3[0] = AddressFormatTable.AddressPart.Country;
     array3[1] = AddressFormatTable.AddressPart.State;
     array3[2] = AddressFormatTable.AddressPart.City;
     array3[3] = AddressFormatTable.AddressPart.PostalCode;
     AddressFormatTable.zhMOAddressFormat     = array3;
     AddressFormatTable.AmericanAddressFormat = new AddressFormatTable.AddressPart[]
     {
         AddressFormatTable.AddressPart.Street,
         AddressFormatTable.AddressPart.City,
         AddressFormatTable.AddressPart.State,
         AddressFormatTable.AddressPart.PostalCode,
         AddressFormatTable.AddressPart.Country
     };
     AddressFormatTable.EuropeanAddressFormat = new AddressFormatTable.AddressPart[]
     {
         AddressFormatTable.AddressPart.Street,
         AddressFormatTable.AddressPart.PostalCode,
         AddressFormatTable.AddressPart.City,
         AddressFormatTable.AddressPart.State,
         AddressFormatTable.AddressPart.Country
     };
     AddressFormatTable.JapaneseAddressFormat = new AddressFormatTable.AddressPart[]
     {
         AddressFormatTable.AddressPart.PostalCode,
         AddressFormatTable.AddressPart.State,
         AddressFormatTable.AddressPart.City,
         AddressFormatTable.AddressPart.Street,
         AddressFormatTable.AddressPart.Country
     };
     AddressFormatTable.TurkishAddressFormat = new AddressFormatTable.AddressPart[]
     {
         AddressFormatTable.AddressPart.Street,
         AddressFormatTable.AddressPart.PostalCode,
         AddressFormatTable.AddressPart.State,
         AddressFormatTable.AddressPart.City,
         AddressFormatTable.AddressPart.Country
     };
     AddressFormatTable.OmanAddressFormat = new AddressFormatTable.AddressPart[]
     {
         AddressFormatTable.AddressPart.Street,
         AddressFormatTable.AddressPart.City,
         AddressFormatTable.AddressPart.State,
         AddressFormatTable.AddressPart.Country,
         AddressFormatTable.AddressPart.PostalCode
     };
     AddressFormatTable.EgyptianAddressFormat = new AddressFormatTable.AddressPart[]
     {
         AddressFormatTable.AddressPart.Street,
         AddressFormatTable.AddressPart.Country,
         AddressFormatTable.AddressPart.City,
         AddressFormatTable.AddressPart.State,
         AddressFormatTable.AddressPart.PostalCode
     };
     AddressFormatTable.HungarianAddressFormat = new AddressFormatTable.AddressPart[]
     {
         AddressFormatTable.AddressPart.City,
         AddressFormatTable.AddressPart.Street,
         AddressFormatTable.AddressPart.PostalCode,
         AddressFormatTable.AddressPart.State,
         AddressFormatTable.AddressPart.Country
     };
     AddressFormatTable.IndonesianAddressFormat = new AddressFormatTable.AddressPart[]
     {
         AddressFormatTable.AddressPart.Street,
         AddressFormatTable.AddressPart.City,
         AddressFormatTable.AddressPart.PostalCode,
         AddressFormatTable.AddressPart.State,
         AddressFormatTable.AddressPart.Country
     };
     AddressFormatTable.HomeAddressParts = new PropertyDefinition[]
     {
         ContactSchema.HomeStreet,
         ContactSchema.HomeCity,
         ContactSchema.HomeState,
         ContactSchema.HomePostalCode,
         ContactSchema.HomeCountry
     };
     AddressFormatTable.BusinessAddressParts = new PropertyDefinition[]
     {
         ContactSchema.WorkAddressStreet,
         ContactSchema.WorkAddressCity,
         ContactSchema.WorkAddressState,
         ContactSchema.WorkAddressPostalCode,
         ContactSchema.WorkAddressCountry
     };
     AddressFormatTable.OtherAddressParts = new PropertyDefinition[]
     {
         ContactSchema.OtherStreet,
         ContactSchema.OtherCity,
         ContactSchema.OtherState,
         ContactSchema.OtherPostalCode,
         ContactSchema.OtherCountry
     };
     AddressFormatTable.BusinessAdAddressParts = new PropertyDefinition[]
     {
         ADOrgPersonSchema.StreetAddress,
         ADOrgPersonSchema.City,
         ADOrgPersonSchema.StateOrProvince,
         ADOrgPersonSchema.PostalCode,
         ADOrgPersonSchema.Co
     };
     AddressFormatTable.addressPropertyTable = AddressFormatTable.LoadAddressPropertyTable();
     AddressFormatTable.cultureAddressMap    = AddressFormatTable.LoadCultureAddressMap();
 }