示例#1
0
        /// <summary>
        ///  Fills exchange address to bpmonline address dictionary.
        /// </summary>
        /// <param name="context"><see cref="SyncContext"/> instance.</param>
        /// <param name="exchangeAddrValues">Exchange address details.</param>
        private void FillAddressDetailsData(SyncContext context, List <ExchangeAddressDetail> exchangeAddrValues)
        {
            if (exchangeAddrValues.Count == 0)
            {
                return;
            }
            var addressDetailHelper = new ExchangeContactAddressDetailHelper(context.UserConnection,
                                                                             exchangeAddrValues);

            AddressesLookupMap = addressDetailHelper.GetAddressesLookupMap();
        }
示例#2
0
        protected override void SetLocalItemValue(Entity detailItem, Exchange.PhysicalAddressKey typeKey)
        {
            var localAddr = detailItem as ContactAddress;

            if (localAddr == null)
            {
                return;
            }
            var contactProvider = Context.RemoteProvider as ExchangeContactSyncProviderImpl;

            if (contactProvider == null)
            {
                return;
            }
            Exchange.PhysicalAddressEntry exchangeAddr = ExchangeUtility.SafeGetValue <Exchange.PhysicalAddressKey,
                                                                                       Exchange.PhysicalAddressEntry, Exchange.PhysicalAddressEntry>(DetailItems, typeKey);
            if (exchangeAddr == null)
            {
                return;
            }
            Dictionary <string, AddressDetail> addressesLookupMap = (contactProvider).AddressesLookupMap;

            if (addressesLookupMap == null)
            {
                return;
            }
            var address = new StringBuilder();

            AppendToAddressString(address, exchangeAddr.Street);
            localAddr.Zip           = exchangeAddr.PostalCode;
            localAddr.AddressTypeId = TypesMap[typeKey];
            if (!addressesLookupMap.Any())
            {
                localAddr.Address = address.ToString();
                return;
            }
            string        cityName    = exchangeAddr.City;
            string        regionName  = exchangeAddr.State;
            string        countryName = exchangeAddr.CountryOrRegion;
            string        addressKey  = ExchangeContactAddressDetailHelper.GetUniqueKey(exchangeAddr);
            AddressDetail mapItem     = default(AddressDetail);

            if (addressesLookupMap.Keys.Contains(addressKey))
            {
                mapItem = addressesLookupMap[addressKey];
            }
            if (mapItem.CityId != Guid.Empty)
            {
                localAddr.CityId = mapItem.CityId;
            }
            else
            {
                localAddr.SetColumnValue("CityId", null);
                AppendToAddressString(address, cityName);
            }
            if (mapItem.RegionId != Guid.Empty)
            {
                localAddr.RegionId = mapItem.RegionId;
            }
            else
            {
                localAddr.SetColumnValue("RegionId", null);
                AppendToAddressString(address, regionName);
            }
            if (mapItem.CountryId != Guid.Empty)
            {
                localAddr.CountryId = mapItem.CountryId;
            }
            else
            {
                localAddr.SetColumnValue("CountryId", null);
                AppendToAddressString(address, countryName);
            }
            localAddr.Address = address.ToString();
        }