Ejemplo n.º 1
0
        /// <summary>
        /// ########## ########## #### ## ########### ###### ######## # Exchange
        /// <see cref="Exchange.PhysicalAddressEntry"/>.
        /// </summary>
        /// <param name="physicalAddressEntry">##### ######## # Exchange.</param>
        public static string GetUniqueKey(Exchange.PhysicalAddressEntry physicalAddressEntry)
        {
            var addressDetail = new ExchangeAddressDetail(physicalAddressEntry.CountryOrRegion,
                                                          physicalAddressEntry.State, physicalAddressEntry.City);

            return(GetUniqueKey(addressDetail));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ########## ########## ####, ############ ## ######## ######, ######## ####### # ######## ######,
        /// ### ########## ###### ###### ######## Exchange <see cref="ExchangeAddressDetail"/>.
        /// </summary>
        /// <param name="addressDetail">###### ###### ######## Exchange.</param>
        public static string GetUniqueKey(ExchangeAddressDetail addressDetail)
        {
            var key = new StringBuilder();

            key.Append(string.IsNullOrEmpty(addressDetail.CountryName) ? EmptyValueInKey : addressDetail.CountryName);
            key.Append(string.IsNullOrEmpty(addressDetail.RegionName) ? EmptyValueInKey : addressDetail.RegionName);
            key.Append(string.IsNullOrEmpty(addressDetail.CityName) ? EmptyValueInKey : addressDetail.CityName);
            return(key.ToString());
        }
Ejemplo n.º 3
0
 private void TryFillCountry(ExchangeAddressDetail detail, AddressDetail addressDetail)
 {
     if (string.IsNullOrEmpty(detail.CountryName) || addressDetail.CountryId != Guid.Empty)
     {
         return;
     }
     if (CountryMap.ContainsKey(detail.CountryName))
     {
         addressDetail.CountryId = CountryMap[detail.CountryName];
     }
 }
Ejemplo n.º 4
0
        private void TryFillCity(ExchangeAddressDetail detail, AddressDetail addressDetail)
        {
            if (string.IsNullOrEmpty(detail.CityName))
            {
                return;
            }
            var citiesValue = CityMap.Where(e => e.Key.CityName == detail.CityName).ToList();

            if (!citiesValue.Any())
            {
                return;
            }
            if (citiesValue.Count() == 1)
            {
                FillAddressDetail(addressDetail, citiesValue.First().Value);
                return;
            }
            if (string.IsNullOrEmpty(detail.RegionName))
            {
                return;
            }
            citiesValue = citiesValue.Where(e => e.Key.RegionNameConfig.RegionName == detail.RegionName).ToList();
            if (!citiesValue.Any())
            {
                return;
            }
            if (citiesValue.Count() == 1)
            {
                FillAddressDetail(addressDetail, citiesValue.First().Value);
                return;
            }
            if (string.IsNullOrEmpty(detail.CountryName))
            {
                return;
            }
            citiesValue = citiesValue.Where(e => e.Key.RegionNameConfig.CountryName == detail.CountryName).ToList();
            if (citiesValue.Count() == 1)
            {
                FillAddressDetail(addressDetail, citiesValue.First().Value);
            }
        }
Ejemplo n.º 5
0
        private void TryFillRegion(ExchangeAddressDetail detail, AddressDetail addressDetail)
        {
            if (string.IsNullOrEmpty(detail.RegionName) || addressDetail.RegionId != Guid.Empty)
            {
                return;
            }
            var regionsValue = RegionMap.Where(e => e.Key.RegionName == detail.RegionName).ToList();

            if (!regionsValue.Any())
            {
                return;
            }
            KeyValuePair <RegionNameConfig, RegionIdConfig> regionValue;

            if (regionsValue.Count() == 1)
            {
                regionValue            = regionsValue.First();
                addressDetail.RegionId = regionValue.Value.RegionId;
                if (addressDetail.CountryId == Guid.Empty)
                {
                    addressDetail.CountryId = regionValue.Value.CountryId;
                }
            }
            if (string.IsNullOrEmpty(detail.CountryName))
            {
                return;
            }
            regionsValue = regionsValue.Where(e => e.Key.CountryName == detail.CountryName).ToList();
            if (!regionsValue.Any() || regionsValue.Count() != 1)
            {
                return;
            }
            regionValue            = regionsValue.First();
            addressDetail.RegionId = regionValue.Value.RegionId;
            if (addressDetail.CountryId == Guid.Empty)
            {
                addressDetail.CountryId = regionValue.Value.CountryId;
            }
        }