コード例 #1
0
 private void DisplayMapLocations(List <DeliveryOption> locations)
 {
     if (locations.Count > 0)
     {
         phMap.Controls.Clear();
         Mapper = (HLGoogleMapper)LoadControl("../HLGoogleMapper.ascx");
         phMap.Controls.Add(Mapper);
         // if there are not geographic poinst then locate by the address
         if (locations.Any(p => string.IsNullOrEmpty(p.GeographicPoint)))
         {
             var addressList = PickupLocations.Select(c => c.Address).ToList();
             Mapper.DispalyAddressOnMap(addressList);
         }
         else
         {
             var mappingLocations = (from loc in locations
                                     select
                                     new DeliveryOption()
             {
                 CourierType = loc.CourierType,
                 CourierStoreId = loc.CourierStoreId,
                 Address = loc.Address,
                 DisplayName = loc.DisplayName,
                 GeographicPoint = loc.GeographicPoint
             }).ToList();
             mappingLocations.ForEach(x => x.DisplayName = x.CourierType + " # " + x.CourierStoreId + "<br/> " + x.Address.Line1 + " " + x.Address.Line2 + " " + x.Address.City + " " + x.Address.PostalCode);
             Mapper.DispalyAddressOnMap(mappingLocations);
         }
     }
 }
コード例 #2
0
        private void PopulatePickupInfoDataList()
        {
            var provider = ProductsBase.GetShippingProvider();

            if (provider != null)
            {
                ShippingAddress_V02 shippingAddress = null;

                shippingAddress = new ShippingAddress_V02
                {
                    Address = new Address_V01
                    {
                        Country = this.ProductsBase.CountryCode,
                        StateProvinceTerritory = dnlProvince.Text,
                        City           = dnlCity.Text,
                        CountyDistrict = dnlDistrict.Text
                    }
                };

                List <DeliveryOption> pickupOptions = provider.GetDeliveryOptions(DeliveryOptionType.PickupFromCourier,
                                                                                  shippingAddress);
                if (pickupOptions != null)
                {
                    divLocations.Visible = true;
                    if (
                        !string.IsNullOrEmpty(
                            HLConfigManager.Configurations.PickupOrDeliveryConfiguration.CourierInfoUrl))
                    {
                        hlCourierInfo.NavigateUrl =
                            HLConfigManager.Configurations.PickupOrDeliveryConfiguration.CourierInfoUrl;
                        divCourierInfo.Visible = true;
                    }
                    else
                    {
                        divCourierInfo.Visible = false;
                    }

                    dlPickupInfo.DataSource =
                        (
                            from o in pickupOptions
                            where o.State.Trim() == dnlProvince.Text.Trim() &&
                            o.Address.City == dnlCity.Text.Trim() &&
                            o.Address.CountyDistrict == dnlDistrict.Text.Trim()
                            select new
                    {
                        ID = o.Id,
                        IsPickup = true,
                        IsWaldos = false,
                        BranchName = o.Description,
                        o.FreightCode,
                        Warehouse = o.WarehouseCode,
                        o.Address,
                        o.Information
                    }
                        );
                    dlPickupInfo.DataBind();
                    List <Address_V01> lstaddress = new List <Address_V01>();
                    lstaddress = (from o in pickupOptions
                                  where o.State.Trim() == dnlProvince.Text.Trim() &&
                                  o.Address.City == dnlCity.Text.Trim() &&
                                  o.Address.CountyDistrict == dnlDistrict.Text.Trim()
                                  select o.Address).ToList();
                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.HasBaiduMap)
                    {
                        objHLGoogleMapper =
                            (HLGoogleMapper)LoadControl("../HLGoogleMapper.ascx");
                        PlaceHolder1.Controls.Add(objHLGoogleMapper);
                        if (lstaddress.Count > 0)
                        {
                            objHLGoogleMapper.DispalyAddressOnMap(lstaddress);
                        }
                        else
                        {
                            HideSelected();
                        }
                    }
                }
                if (pickupOptions.Count.Equals(0))
                {
                    HideSelected();
                }
                lblErrors.Text = string.Empty;
            }
        }