Exemple #1
0
 private void LoadShipping()
 {
     ShippingRates.CountryId = PageData.ShippingContact.CountryId;
     ShippingRates.Zip       = PageData.ShippingContact.Zip;
     ShippingRates.City      = PageData.ShippingContact.City;
     ShippingRates.Region    = PageData.ShippingContact.RegionName;
     ShippingRates.SelectShippingOptionEx = PageData.ShippingOptionEx;
     ShippingRates.ShoppingCart           = ShoppingCartService.CurrentShoppingCart;
     ShippingRates.LoadMethods(PageData.SelectShippingButtonId);
     btnNextFromShipPay.Enabled &= ShippingRates.ShippingRates.Count > 0;
 }
        private void LoadShipping()
        {
            ShippingRates.CountryId   = PageData.ShippingContact.CountryId;
            ShippingRates.Zip         = PageData.ShippingContact.Zip;
            ShippingRates.City        = PageData.ShippingContact.City;
            ShippingRates.Region      = PageData.ShippingContact.RegionName;
            ShippingRates.Distance    = PageData.Distance;
            ShippingRates.PickpointId = PageData.SelectedShippingItem.Ext != null?PageData.SelectedShippingItem.Ext.PickpointId.TryParseInt() : 0;

            ShippingRates.SelectShippingOptionEx = PageData.SelectedShippingItem.Ext;
            ShippingRates.ShoppingCart           = ShoppingCartService.CurrentShoppingCart;

            ShippingRates.LoadMethods(PageData.SelectedShippingItem.Id);

            if (ShippingRates.SelectedItem != null)
            {
                PageData.SelectedShippingItem = ShippingRates.SelectedItem;
                PageData.Distance             = ShippingRates.Distance;
            }
            else
            {
                PageData.SelectedShippingItem = new ShippingItem();
                PageData.Distance             = 0;
            }

            DisplayBlock = ShippingMethodService.ShowAddressField(PageData.UserType, ShippingRates.SelectedItem)
                ? "block"
                : "none";
            BlockCustomField = ShippingMethodService.ShowCustomField(PageData.UserType, ShippingRates.SelectedItem)
                ? "block"
                : "none";

            liDelivery.Text = string.Format("{0}, {1}{2}",
                                            PageData.ShippingContact.Country,
                                            (PageData.ShippingContact.RegionName != "" && PageData.ShippingContact.RegionName != PageData.ShippingContact.City
                    ? PageData.ShippingContact.RegionName + ", "
                    : ""),
                                            PageData.ShippingContact.City);

            DeliveryJson = JsonConvert.SerializeObject(new
            {
                countryId = PageData.ShippingContact.CountryId,
                country   = PageData.ShippingContact.Country,
                region    = PageData.ShippingContact.RegionName,
                city      = PageData.ShippingContact.City
            });

            DisplayDelivery = PageData.UserType != EnUserType.RegisteredUser;
        }