protected override void handleDeliveryTypeChanged(DropDownList DeliveryType, DropDownList DropdownNickName)
        {
            CheckDSMailingAddress(false, null);
            DeliveryOptionType deliveryType = getDeliveryOptionTypeFromDropdown(DeliveryType);

            if (null != DropdownNickName)
            {
                DropdownNickName.Attributes.Remove("style");
            }
            ShoppingCart.DeliveryInfo = null;
            if (deliveryType == DeliveryOptionType.Shipping || deliveryType == DeliveryOptionType.ShipToCourier)
            {
                populateShipping();
                setAddressByNickName(ShoppingCart.DeliveryInfo == null
                                         ? null
                                         : (ShoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping
                                                ? ShoppingCart.DeliveryInfo.Address
                                                : null));
            }
            else if (deliveryType == DeliveryOptionType.PickupFromCourier)
            {
                populatePickupPreference();
                setAddressByNickName(ShoppingCart.DeliveryInfo == null
                                         ? null
                                         : (ShoppingCart.DeliveryInfo.Option == DeliveryOptionType.PickupFromCourier
                                                ? ShoppingCart.DeliveryInfo.Address
                                                : null));
            }
            else
            {
                if (CountryCode == "BR")
                {
                    var mailingAdd = new ShippingAddress_V01(1, DistributorProfileModelHelper.DistributorName(DistributorProfileModel),
                                                             ObjectMappingHelper.Instance.GetToShipping(DistributorOrderingProfileProvider.GetAddress(ServiceProvider.OrderSvc.AddressType.Mailing, DistributorID, CountryCode)),
                                                             string.Empty, string.Empty, false, string.Empty,
                                                             DateTime.Now);
                    if (CheckDSMailingAddress(true, mailingAdd))
                    {
                        populatePickup();
                        setAddressByNickName(ShoppingCart.DeliveryInfo == null
                                                 ? null
                                                 : (ShoppingCart.DeliveryInfo.Option == DeliveryOptionType.Pickup
                                                        ? ShoppingCart.DeliveryInfo.Address
                                                        : null));
                    }
                }
                else
                {
                    populatePickup();
                    setAddressByNickName(ShoppingCart.DeliveryInfo == null
                                             ? null
                                             : (ShoppingCart.DeliveryInfo.Option == DeliveryOptionType.Pickup
                                                    ? ShoppingCart.DeliveryInfo.Address
                                                    : null));
                }
            }
            showShiptoOrPickup(IsStatic);
        }
Example #2
0
        public override List <DeliveryOption> GetDeliveryOptions(DeliveryOptionType type, ShippingAddress_V01 address)
        {
            if (type == DeliveryOptionType.PickupFromCourier)
            {
                return(GetDeliveryPickupAlternativesFromCache(address));
            }

            return(base.GetDeliveryOptions(type, address));
        }
 protected override DeliveryOption getSelectedAddress(int id, DeliveryOptionType optionType,
                                                      DropDownList deliveryTypeDropdown)
 {
     if (optionType == DeliveryOptionType.ShipToCourier)
     {
         optionType = DeliveryOptionType.Shipping;
     }
     return(base.getSelectedAddress(id, optionType, deliveryTypeDropdown));
 }
        public override string FormatShippingAddress(ShippingAddress_V01 address,
                                                     DeliveryOptionType type,
                                                     string description,
                                                     bool includeName)
        {
            if (null == address || address.Address == null)
            {
                return(string.Empty);
            }
            string formattedAddress = string.Empty;

            if (type == DeliveryOptionType.Shipping)
            {
                formattedAddress = includeName
                                       ? string.Format("{0}<br>{1},{2}<br>{3}{4}, {5}<br>{6}",
                                                       address.Recipient ?? string.Empty,
                                                       address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                                       string.IsNullOrEmpty(address.Address.City)
                                                           ? string.Empty
                                                           : string.Format("{0}, ", address.Address.City),
                                                       address.Address.StateProvinceTerritory,
                                                       address.Address.PostalCode,
                                                       formatPhone(address.Phone))
                                       : string.Format("{0},{1}<br>{2}{3}, {4}<br>{5}",
                                                       address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                                       string.IsNullOrEmpty(address.Address.City)
                                                           ? string.Empty
                                                           : string.Format("{0}, ", address.Address.City),
                                                       address.Address.StateProvinceTerritory, address.Address.PostalCode,
                                                       formatPhone(address.Phone));
            }
            else if (type == DeliveryOptionType.PickupFromCourier)
            {
                formattedAddress = string.Format("{0}<br>{1},{2}<br>{3}, {4} {5}", description,
                                                 address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                                 address.Address.StateProvinceTerritory, address.Address.City,
                                                 address.Address.PostalCode);
            }
            else
            {
                formattedAddress = string.Format("{0}<br>{1},{2}<br>{3}{4}, {5}", description,
                                                 address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                                 string.IsNullOrEmpty(address.Address.City.Trim())
                                                     ? string.Empty
                                                     : string.Format("{0}, ", address.Address.City.Trim()),
                                                 address.Address.StateProvinceTerritory, address.Address.PostalCode);
            }
            if (formattedAddress.IndexOf(",,") > -1 || formattedAddress.IndexOf(", ,") > -1)
            {
                return(formattedAddress.Replace(",,,", ",").Replace(", , ,", ",").Replace(",,", ",").Replace(", ,", ","));
            }
            else
            {
                return(formattedAddress);
            }
        }
Example #5
0
        public override string FormatShippingAddress(
            ShippingAddress_V01 address, DeliveryOptionType type, string description, bool includeName)
        {
            if (null == address || address.Address == null)
            {
                return(string.Empty);
            }
            string formattedAddress = string.Empty;

            if (type == DeliveryOptionType.Shipping)
            {
                formattedAddress = includeName
                                       ? string.Format(
                    "{0}<br>{1} {2}<br>{3},{4}, {5}<br>{6}{7}",
                    address.Recipient ?? string.Empty,
                    address.Address.Line1,
                    string.IsNullOrEmpty(address.Address.Line2)
                                               ? string.Empty
                                               : string.Format(",{0}", address.Address.Line2),
                    address.Address.CountyDistrict,
                    address.Address.City,
                    address.Address.StateProvinceTerritory,
                    string.IsNullOrEmpty(address.Address.PostalCode)
                                               ? string.Empty
                                               : string.Format("{0}<br>", address.Address.PostalCode),
                    this.formatPhone(address.Phone))
                                       : string.Format(
                    "{0}{1}<br>{2}, {3}, {4}<br>{5}{6}",
                    address.Address.Line1,
                    string.IsNullOrEmpty(address.Address.Line2)
                                               ? string.Empty
                                               : string.Format(",{0}", address.Address.Line2),
                    address.Address.CountyDistrict,
                    address.Address.City,
                    address.Address.StateProvinceTerritory,
                    string.IsNullOrEmpty(address.Address.PostalCode)
                                               ? string.Empty
                                               : string.Format("{0}<br>", address.Address.PostalCode),
                    this.formatPhone(address.Phone));
            }
            else
            {
                formattedAddress = string.Format(
                    "{0}<br>{1}{2}<br>{3},{4}<br>{5}",
                    description,
                    address.Address.Line1,
                    string.IsNullOrEmpty(address.Address.Line2)
                        ? string.Empty
                        : string.Format(",{0}", address.Address.Line2),
                    address.Address.City,
                    address.Address.StateProvinceTerritory,
                    address.Address.PostalCode);
            }
            return(formattedAddress);
        }
Example #6
0
        public override bool DisplayHoursOfOperation(DeliveryOptionType option)
        {
            switch (option)
            {
            case DeliveryOptionType.PickupFromCourier:
                return(true);

            default:
                return(base.DisplayHoursOfOperation(option));
            }
        }
Example #7
0
 public override List <DeliveryOption> GetDeliveryOptions(DeliveryOptionType type, ShippingAddress_V01 address)
 {
     if (type == DeliveryOptionType.PickupFromCourier)
     {
         return(GetDeliveryOptionsFromCache("SE", System.Threading.Thread.CurrentThread.CurrentCulture.Name, address));
     }
     else
     {
         return(base.GetDeliveryOptions(type, address));
     }
 }
 public override List <DeliveryOption> GetDeliveryOptions(DeliveryOptionType type, ShippingAddress_V01 address)
 {
     if (type == DeliveryOptionType.PickupFromCourier)
     {
         if (address != null && address.Address != null && !string.IsNullOrEmpty(address.Address.StateProvinceTerritory))
         {
             HttpRuntime.Cache.Remove(PUPCacheKey);
         }
         return(GetDeliveryOptionsFromCache(System.Threading.Thread.CurrentThread.CurrentCulture.Name, address));
     }
     return(base.GetDeliveryOptions(type, address));
 }
Example #9
0
        public override string FormatShippingAddress(ShippingAddress_V01 address, DeliveryOptionType type,
                                                     string description, bool includeName)
        {
            if (null == address || address.Address == null)
            {
                return(string.Empty);
            }
            string formattedAddress = string.Empty;

            if (type == DeliveryOptionType.Shipping)
            {
                formattedAddress = includeName
                                       ? string.Format("{0}<br/>{1},{2}<br/>{3}<br/>{4}, {5}, {6}<br/>{7}",
                                                       address.Recipient ?? string.Empty,
                                                       address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                                       address.Address.Line3 ?? string.Empty,
                                                       address.Address.City, address.Address.StateProvinceTerritory,
                                                       address.Address.PostalCode,
                                                       formatPhone(address.Phone))
                                       : string.Format("{0},{1}<br/>{2}<br/>{3}, {4}, {5}<br/>{6}",
                                                       address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                                       address.Address.Line3 ?? string.Empty,
                                                       address.Address.City, address.Address.StateProvinceTerritory,
                                                       address.Address.PostalCode,
                                                       formatPhone(address.Phone));
            }
            else if (type == DeliveryOptionType.PickupFromCourier)
            {
                string message  = HttpContext.GetGlobalResourceObject("MYHL_Rules", "ViewMap").ToString();
                string gAddress = string.Format("{0}+{1}+{2}+{3}+{4}", address.Address.Line1.Replace(" ", "+"), address.Address.Line2.Replace(" ", "+"), address.Address.City.Replace(" ", "+"), address.Address.StateProvinceTerritory.Replace(" ", "+"), address.Address.PostalCode.Replace(" ", "+"));
                formattedAddress = string.Format("{0}<br/>{1}, {2}<br/>{3} {4}<br/>{5}",
                                                 address.Address.Line1,
                                                 address.Address.Line2 ?? string.Empty, address.Address.City,
                                                 address.Address.StateProvinceTerritory, address.Address.PostalCode,
                                                 PlatformResources.GetGlobalResourceString("GlobalResources", "CountryName"));
            }
            else
            {
                formattedAddress = string.Format("{0}<br>{1},{2}<br>{3}, {4}, {5}",
                                                 address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                                 address.Address.City, address.Address.StateProvinceTerritory, address.Address.CountyDistrict,
                                                 address.Address.PostalCode);
            }
            if (formattedAddress.IndexOf(",,") > -1 || formattedAddress.IndexOf(", ,") > -1)
            {
                return(formattedAddress.Replace(",,,", ",").Replace(", , ,", ",").Replace(",,", ",").Replace(", ,", ","));
            }
            else
            {
                return(formattedAddress);
            }
        }
        /// <summary>
        /// Format the address to display it in site.
        /// </summary>
        /// <param name="address">Address to format.</param>
        /// <param name="type">Delivery type.</param>
        /// <param name="description">Description.</param>
        /// <param name="includeName">Flag to include the name.</param>
        /// <returns></returns>
        public override string FormatShippingAddress(ShippingAddress_V01 address, DeliveryOptionType type, string description, bool includeName)
        {
            if (null == address || address.Address == null)
            {
                return(string.Empty);
            }
            string formattedAddress = string.Empty;

            if (type == DeliveryOptionType.Shipping)
            {
                formattedAddress = includeName
                                       ? string.Format(
                    "{0}<br>{1} {2}, {7}, {8}<br>{3}, {4}, {9}<br>{5}<br>{6}",
                    address.Recipient ?? string.Empty,
                    address.Address.Line1,
                    address.Address.Line2 ?? string.Empty,
                    address.Address.City,
                    address.Address.StateProvinceTerritory,
                    address.Address.PostalCode,
                    this.formatPhone(address.Phone),
                    address.Address.Line3 ?? string.Empty, address.Address.Line4 ?? string.Empty,
                    address.Address.CountyDistrict)
                                       : string.Format(
                    "{0}<br>{1} {2}, {7}, {8}<br>{3}, {4}<br>{5}<br>{6}",
                    address.Address.Line1,
                    address.Address.Line2 ?? string.Empty,
                    address.Address.City,
                    address.Address.StateProvinceTerritory,
                    address.Address.PostalCode,
                    this.formatPhone(address.Phone),
                    address.Address.Line3 ?? string.Empty, address.Address.Line4 ?? string.Empty,
                    address.Address.CountyDistrict);
            }
            else if (type == DeliveryOptionType.PickupFromCourier)
            {
                return(string.Format("{0}<br>{1},{2}<br>{3} {4}", description,
                                     address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                     address.Address.City, address.Address.PostalCode));
            }
            else
            {
                formattedAddress = string.Format(
                    "{0}<br/>{1} {2}<br/>{3} {4}<br/>{5}",
                    description,
                    address.Address.Line1,
                    address.Address.Line2 ?? string.Empty,
                    address.Address.PostalCode,
                    address.Address.City,
                    address.Address.StateProvinceTerritory);
            }
            return(formattedAddress);
        }
        public override string FormatShippingAddress(ShippingAddress_V01 address,
                                                     DeliveryOptionType type,
                                                     string description,
                                                     bool includeName)
        {
            var    lstStates = base.GetStatesForCountry("CA");
            String state     = address.Address.StateProvinceTerritory.ToLower();
            string stateName = string.Empty;

            //string stateName = lstStates.Find(c => c.Substring(0, 2).ToLower().Equals(state)).Substring(6);
            try
            {
                //stateName = (from s in lstStates where s.Contains(state) select s.Substring(6)).First();
                stateName = lstStates.FirstOrDefault(c => c.Substring(0, 2).ToLower().Contains(state));
                stateName = stateName != null?stateName.Substring(6) : string.Empty;
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.Message);
            }

            if (null == address || address.Address == null)
            {
                return(string.Empty);
            }

            if (type == DeliveryOptionType.Shipping)
            {
                return(includeName
                           ? string.Format("{0}<br>{1},{2}<br>{3}, {4} {5}<br>{6}", address.Recipient ?? string.Empty,
                                           address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                           address.Address.City, stateName, address.Address.PostalCode,
                                           formatPhone(address.Phone))
                           : string.Format("{0},{1}<br>{2}, {3} {4}<br>{5}",
                                           address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                           address.Address.City, stateName, address.Address.PostalCode,
                                           formatPhone(address.Phone)));
            }
            else if (type == DeliveryOptionType.PickupFromCourier)
            {
                string message  = HttpContext.GetGlobalResourceObject("MYHL_Rules", "ViewMap").ToString();
                string gAddress = string.Format("{0}+{1}+{2}+{3}", address.Address.Line1.Replace(" ", "+"), address.Address.City.Replace(" ", "+"), address.Address.StateProvinceTerritory.Replace(" ", "+"), address.Address.PostalCode.Replace(" ", "+"));
                return(string.Format("{0}<br/>{1}, {2} {3}<br/> <a href='http://maps.google.com/?q={4}' target='_blank'>{5}</a>",
                                     address.Address.Line1, address.Address.City,
                                     address.Address.StateProvinceTerritory,
                                     address.Address.PostalCode, gAddress, message));
            }

            return(string.Format("{0}<br>{1},{2}<br>{3}, {4} {5}", description,
                                 address.Address.Line1, address.Address.Line2 ?? string.Empty, address.Address.City,
                                 stateName, address.Address.PostalCode));
        }
Example #12
0
 protected DeliveryOption GetDeliveryOptionIDFromShippingAddress(int id, DeliveryOptionType optionType)
 {
     if (optionType == DeliveryOptionType.Shipping)
     {
         var addresses = _shippingAddresses.Where(s => s.Id == id);
         if (addresses.Count() == 0)
         {
             addresses = _shippingAddresses.Where(s => s.IsPrimary);
         }
         return(addresses.Count() == 0 ? null : addresses.First());
     }
     return(null);
 }
Example #13
0
 public override List <DeliveryOption> GetDeliveryOptions(DeliveryOptionType type, ShippingAddress_V01 address)
 {
     if (type == DeliveryOptionType.Pickup)
     {
         return(base.GetDeliveryOptions(type, address));
     }
     else if (type == DeliveryOptionType.PickupFromCourier)
     {
         return(GetDeliveryOptionsFromCache("RU", Thread.CurrentThread.CurrentCulture.Name, address, type));
     }
     else
     {
         return(GetDeliveryOptionsListForShipping("RU", "ru-RU", address));
     }
 }
        public override ShippingInfo GetShippingInfoFromID(string distributorID,
                                                           string locale,
                                                           DeliveryOptionType type,
                                                           int deliveryOptionID,
                                                           int shippingAddressID)
        {
            DeliveryOption deliveryOption = null;

            if (type == DeliveryOptionType.PickupFromCourier)
            {
                string countryCode = locale.Substring(3, 2);
                var    pickupLocationPreference = GetPickupLocationsPreferences(distributorID, countryCode, null);
                if (pickupLocationPreference != null && pickupLocationPreference.Count > 0)
                {
                    var vPickupLocation = pickupLocationPreference.Find(p => p.ID == deliveryOptionID);
                    if (vPickupLocation != null)
                    {
                        int PickupLocationID = vPickupLocation.PickupLocationID;
                        var doList           = GetDeliveryOptions(type,
                                                                  new ShippingAddress_V01
                        {
                            Address = new Address_V01 {
                                Country = "CL"
                            },
                            Alias = vPickupLocation.PickupLocationType
                        });

                        if (doList != null)
                        {
                            deliveryOption = doList.Find(d => d.Id == PickupLocationID);
                            if (deliveryOption != null)
                            {
                                //deliveryOption.Id = deliveryOption.ID = deliveryOptionID;
                                var shippingInfo = new ShippingInfo(deliveryOption);
                                shippingInfo.Id = deliveryOptionID;
                                return(shippingInfo);
                            }
                        }
                    }
                }
            }
            else
            {
                return(base.GetShippingInfoFromID(distributorID, locale, type, deliveryOptionID, shippingAddressID));
            }

            return(null);
        }
        protected override void setLinksVisiblity()
        {
            DeliveryOptionType deliveryType = getDeliveryOptionTypeFromDropdown(DeliveryType);

            if (deliveryType == DeliveryOptionType.Shipping || deliveryType == DeliveryOptionType.ShipToCourier ||
                deliveryType == DeliveryOptionType.PickupFromCourier)
            {
                divLinks.Visible = true;
                LinkEdit.Visible = deliveryType == DeliveryOptionType.Shipping ||
                                   deliveryType == DeliveryOptionType.ShipToCourier;
            }
            else
            {
                divLinks.Visible = false;
            }
        }
        public override ShippingInfo GetShippingInfoFromID(
            string distributorID, string locale, DeliveryOptionType type, int deliveryOptionID, int shippingAddressID)
        {
            DeliveryOption deliveryOptionForAddress = null;
            ShippingInfo   shippingInfo             = null;

            if (type == DeliveryOptionType.PickupFromCourier)
            {
                string countryCode = locale.Substring(3, 2);
                var    pickupLocationPreference =
                    this.GetPickupLocationsPreferences(distributorID, countryCode);
                if (pickupLocationPreference != null && pickupLocationPreference.Count > 0)
                {
                    var vPickupLocation = pickupLocationPreference.Find(p => p.ID == deliveryOptionID);
                    if (vPickupLocation != null)
                    {
                        var pickupLocationID = vPickupLocation.PickupLocationID;
                        var doList           = this.GetDeliveryOptions(type, null);
                        if (doList != null)
                        {
                            deliveryOptionForAddress = doList.Find(d => d.Id == pickupLocationID);
                            if (deliveryOptionForAddress != null)
                            {
                                deliveryOptionForAddress.Address.Line4 = deliveryOptionForAddress.Description;
                                //*******************TBD ************************************************************
                                //deliveryOptionForAddress.WarehouseCode = "";
                                //deliveryOptionForAddress.FreightCode = "";
                                //*******************TBD ************************************************************
                                shippingInfo = new ShippingInfo(deliveryOptionForAddress)
                                {
                                    Id = deliveryOptionID
                                };
                                return(shippingInfo);
                            }
                        }
                    }
                    return(shippingInfo);
                }
            }
            else
            {
                return(base.GetShippingInfoFromID(distributorID, locale, type, deliveryOptionID, shippingAddressID));
            }

            return(null);
        }
Example #17
0
        public override string FormatShippingAddress(ShippingAddress_V01 address, DeliveryOptionType type, string description, bool includeName)
        {
            if (null == address || address.Address == null)
            {
                return(string.Empty);
            }
            string formattedAddress = string.Empty;

            if (type == DeliveryOptionType.Shipping)
            {
                formattedAddress = includeName ? string.Format("{0}<br>{1},{2}<br>{3}, {4}, {5}<br>{6}", address.Recipient ?? string.Empty,
                                                               address.Address.Line1, address.Address.Line2 ?? string.Empty, address.Address.City, address.Address.StateProvinceTerritory,
                                                               address.Address.PostalCode,
                                                               formatPhone(address.Phone)) :
                                   string.Format("{0},{1}<br>{2}, {3}, {4}<br>{5}",
                                                 address.Address.Line1, address.Address.Line2 ?? string.Empty, address.Address.City, address.Address.StateProvinceTerritory, address.Address.PostalCode,
                                                 formatPhone(address.Phone));
            }
            else if (type == DeliveryOptionType.PickupFromCourier)
            {
                var deliveryoptions = GetDeliveryOptions(DeliveryOptionType.PickupFromCourier, address)
                                      .FirstOrDefault(x => x.Address.City == address.Address.City &&
                                                      x.Address.Line1 == address.Address.Line1 && x.Address.Line2 == address.Address.Line2 &&
                                                      x.Address.StateProvinceTerritory == address.Address.StateProvinceTerritory);

                formattedAddress = string.Format("{0}<br>{1} {2}<br>{3}, {4} {5} {6} {7}", address.Address.CountyDistrict,
                                                 address.Address.Line2, address.Address.Line1 ?? string.Empty,
                                                 deliveryoptions != null?deliveryoptions.Description:string.Empty,
                                                 address.Address.PostalCode,
                                                 address.Address.City, address.Address.StateProvinceTerritory, null != deliveryoptions?deliveryoptions.Information:string.Empty);
            }
            else
            {
                formattedAddress = string.Format("{0}<br>{1},{2}<br>{3}, {4}, {5}", description,
                                                 address.Address.Line1, address.Address.Line2 ?? string.Empty, address.Address.City, address.Address.StateProvinceTerritory, address.Address.PostalCode);
            }
            if (formattedAddress.IndexOf(",,") > -1 || formattedAddress.IndexOf(", ,") > -1)
            {
                return(formattedAddress.Replace(",,,", ",").Replace(", , ,", ",").Replace(",,", ",").Replace(", ,", ","));
            }
            else
            {
                return(formattedAddress);
            }
        }
Example #18
0
        public override List <PickupLocationPreference_V01> GetPickupLocationsPreferences(
            string distributorId, string country, string locale, DeliveryOptionType deliveryType)
        {
            var pickupLocations = base.GetPickupLocationsPreferences(distributorId, country);
            List <PickupLocationPreference_V01> pickupLocationPreferencestoRemove = new List <PickupLocationPreference_V01>();

            // Verify the alias for the locations to generate a display name if needed
            // and check if the location exists
            foreach (var location in pickupLocations)
            {
                // Verify if the location exists
                var shippingInfo = this.GetShippingInfoFromID(distributorId, locale, deliveryType, location.ID, 0);
                if (shippingInfo == null)
                {
                    location.PickupLocationNickname = null;
                    pickupLocationPreferencestoRemove.Add(location);
                    continue;
                }

                if (string.IsNullOrEmpty(location.PickupLocationNickname))
                {
                    var address = new ShippingAddress_V02(
                        shippingInfo.Address.ID,
                        shippingInfo.Description,
                        string.Empty,
                        string.Empty,
                        string.Empty,
                        shippingInfo.Address.Address,
                        string.Empty,
                        string.Empty,
                        shippingInfo.Address.IsPrimary,
                        shippingInfo.Address.Alias,
                        DateTime.Now);
                    location.PickupLocationNickname = this.GetAddressDisplayName(address);
                }
            }
            if (pickupLocationPreferencestoRemove.Count > 0)
            {
                foreach (var item in pickupLocationPreferencestoRemove)
                {
                    DeletePickupLocationsPreferences(item.DistributorID, item.PickupLocationID, item.Country);
                }
            }
            return(pickupLocations.Where(l => !string.IsNullOrEmpty(l.PickupLocationNickname)).ToList());
        }
Example #19
0
        protected virtual void handleHerbalifePickupFreightCodeChanged(DropDownList deliveryType, DropDownList nickNameDropdown)
        {
            DeliveryOptionType deliveryOptionType = getDeliveryOptionTypeFromDropdown(deliveryType);
            ShippingInfo       shippingInfo = ShoppingCart.DeliveryInfo;
            int deliveryOptionId = 0, shippingAddressId = 0;

            if (shippingInfo != null)
            {
                if (!string.IsNullOrEmpty(nickNameDropdown.SelectedValue))
                {
                    shippingAddressId = deliveryOptionType == DeliveryOptionType.Shipping
                                        ? int.Parse(nickNameDropdown.SelectedValue)
                                        : shippingInfo.Address.ID;
                    deliveryOptionId = deliveryOptionType == DeliveryOptionType.Shipping
                                           ? shippingInfo.Id
                                           : int.Parse(nickNameDropdown.SelectedValue);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(nickNameDropdown.SelectedValue))
                {
                    shippingAddressId = deliveryOptionType == DeliveryOptionType.Shipping
                                        ? int.Parse(nickNameDropdown.SelectedValue)
                                        : 0;
                    deliveryOptionId = deliveryOptionType == DeliveryOptionType.Shipping
                                           ? 0
                                           : int.Parse(nickNameDropdown.SelectedValue);
                }
            }
            if (HLConfigManager.Configurations.CheckoutConfiguration.SavePickupPreferences)
            {
                if (deliveryOptionType == DeliveryOptionType.Pickup)
                {
                    var pref = _pickupRrefList.Find(f => f.ID == deliveryOptionId);
                    if (pref != null)
                    {
                        deliveryOptionId = pref.PickupLocationID;
                    }
                }
            }
            ShoppingCart.UpdateShippingInfo(shippingAddressId, deliveryOptionId, deliveryOptionType);

            shippingInfo = ShoppingCart.DeliveryInfo;
        }
Example #20
0
        protected new void AddClicked(object sender, EventArgs e)
        {
            DeliveryOptionType deliveryOption = getDeliveryOptionTypeFromDropdown(DeliveryType);
            var mpAddAddress = (ModalPopupExtender)ucShippingInfoControl.FindControl("popup_ShippingInfoControl");

            if (deliveryOption == DeliveryOptionType.Shipping || deliveryOption == DeliveryOptionType.Unknown)
            {
                ucShippingInfoControl.ShowPopupForShipping(CommandType.Add,
                                                           new ShippingAddressEventArgs(DistributorID, null, false,
                                                                                        ProductsBase
                                                                                        .DisableSaveAddressCheckbox));
            }
            else
            {
                ucShippingInfoControl.ShowPopupForPickup(CommandType.Add, null);
            }
            mpAddAddress.Show();
        }
Example #21
0
        protected override void updateShippingInfo(int shippingAddressId, int deliveryOptionId,
                                                   DeliveryOptionType option)
        {
            if (ShoppingCart != null)
            {
                if (option == DeliveryOptionType.Pickup)
                {
                    var pref = _pickupRrefList.Find(f => f.ID == deliveryOptionId);
                    if (pref != null)
                    {
                        deliveryOptionId = pref.PickupLocationID;
                    }
                }
                base.updateShippingInfo(shippingAddressId, deliveryOptionId, option);

                setInventoryView();
            }
        }
 public override List <DeliveryOption> GetDeliveryOptions(DeliveryOptionType type, ShippingAddress_V01 address)
 {
     if (type == DeliveryOptionType.PickupFromCourier)
     {
         if (address == null || address.Address == null || string.IsNullOrEmpty(address.Address.StateProvinceTerritory))
         {
             return(GetDeliveryOptionsFromCache("UA", "uk-UA", address, type));
         }
         else
         {
             return(GetDeliveryOptionsByStateFromCache("UA", "uk-UA", address, type));
         }
     }
     else
     {
         return(base.GetDeliveryOptions(type, address));
     }
 }
Example #23
0
        protected override void showShiptoOrPickup(bool isStatic)
        {
            DeliveryOptionType selectedOption = getDeliveryOptionTypeFromDropdown(DeliveryType);

            if (IsStatic)
            {
                if (ShoppingCart != null)
                {
                    if (ShoppingCart.DeliveryInfo != null)
                    {
                        selectedOption = ShoppingCart.DeliveryInfo.Option;
                    }
                }
            }

            if (selectedOption == DeliveryOptionType.Shipping || selectedOption == DeliveryOptionType.ShipToCourier)
            {
                lbShiptoOrPickup.Text             = (string)GetLocalResourceObject("ShipTo");
                NickNameReadonly.Text             = (string)GetLocalResourceObject("NickName");
                divDeliveryMethodShipping.Visible = true;
                divDeliveryMethodPickup.Visible   = false;
                LoadShippingInstructions(IsStatic);
            }
            else
            {
                if (CheckNoDeliveryType(DeliveryType))
                {
                    lbShiptoOrPickup.Text             = (string)GetLocalResourceObject("ShipTo");
                    NickNameReadonly.Text             = (string)GetLocalResourceObject("NickName");
                    divDeliveryMethodShipping.Visible = true;
                    divDeliveryMethodPickup.Visible   = false;
                    LoadShippingInstructions(IsStatic);
                }
                else
                {
                    lbShiptoOrPickup.Text             = (string)GetLocalResourceObject("PickUpFrom");
                    NickNameReadonly.Text             = (string)GetLocalResourceObject("Location");
                    divDeliveryMethodShipping.Visible = false;
                    divDeliveryMethodPickup.Visible   = true;
                    LoadPickUpInstructions(IsStatic);
                }
            }
        }
Example #24
0
        public override List <DeliveryOption> GetDeliveryOptions(DeliveryOptionType type, ShippingAddress_V01 address)
        {
            if (type == DeliveryOptionType.PickupFromCourier)
            {
                if (address != null && address.Address != null && !string.IsNullOrEmpty(address.Address.StateProvinceTerritory))
                {
                    HttpRuntime.Cache.Remove(CacheKey);
                }
                return(GetDeliveryOptionsFromCache(System.Threading.Thread.CurrentThread.CurrentCulture.Name, address));
            }

            var lstDeliveryOptions = base.GetDeliveryOptions(type, address);

            if (lstDeliveryOptions != null)
            {
                lstDeliveryOptions = (from l in lstDeliveryOptions orderby l.Description select l).ToList();
            }
            return(lstDeliveryOptions);
        }
        private void createAddressControl(DeliveryOptionType type)
        {
            UserControlBase userControlBase = null;

            if (type == DeliveryOptionType.Shipping)
            {
                userControlBase = LoadControl(ShippingControl) as UserControlBase;
            }
            else
            {
                userControlBase = LoadControl(PickupControl) as UserControlBase;
            }
            if (userControlBase != null)
            {
                removeAddressControl();
                userControlBase.PopupExtender = popup_ShippingInfoControl;
                PanelShipping.Controls.Add(userControlBase);
            }
        }
Example #26
0
        public override string FormatShippingAddress(ShippingAddress_V01 address,
                                                     DeliveryOptionType type,
                                                     string description,
                                                     bool includeName)
        {
            if (null == address || null == address.Address)
            {
                return(string.Empty);
            }

            return(includeName
                       ? string.Format("{0}<br>{1},{2}<br>{3},{4}", address.Recipient ?? string.Empty,
                                       address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                       address.Address.City, address.Address.PostalCode)
                       : string.Format("{0},{1}<br>{2},{3}",
                                       address.Address.Line1, address.Address.Line2 ?? string.Empty,
                                       address.Address.City,
                                       address.Address.PostalCode));
        }
        public override string FormatShippingAddress(ShippingAddress_V01 address, DeliveryOptionType type,
                                                     string description, bool includeName)
        {
            if (type == DeliveryOptionType.Shipping)
            {
                if (address == null || address.Address == null)
                {
                    return(string.Empty);
                }

                string formattedAddress = includeName ? string.Format("{0}<br/>{1} {2} {3}<br/>{4}, {5}<br/>{6} {7}<br/>{8}", address.Recipient ?? string.Empty,
                                                                      address.Address.Line1, address.Address.Line3 ?? string.Empty, address.Address.Line4, address.Address.CountyDistrict, address.Address.Line2,
                                                                      address.Address.City, address.Address.PostalCode, formatPhone(address.Phone))
                    : string.Format("{0} {1} {2}<br/>{3}, {4}<br/>{5} {6}<br/>{7}",
                                    address.Address.Line1, address.Address.Line3 ?? string.Empty, address.Address.Line4, address.Address.CountyDistrict, address.Address.Line2,
                                    address.Address.City, address.Address.PostalCode, formatPhone(address.Phone));

                do
                {
                    formattedAddress = formattedAddress.Replace("  ", " ");
                } while (formattedAddress.IndexOf("  ") > -1);
                do
                {
                    formattedAddress = formattedAddress.Replace(", <br/>", "<br/>");
                } while (formattedAddress.IndexOf(", <br/>") > -1);
                do
                {
                    formattedAddress = formattedAddress.Replace("<br/><br/>", "<br/>");
                } while (formattedAddress.IndexOf("<br/><br/>") > -1);
                return(formattedAddress);
            }
            else if (type == DeliveryOptionType.Pickup)
            {
                string formattedAddress = string.Format("{0}<br/>{1} {2},<br/>{3} {4}", description,
                                                        address.Address.PostalCode, address.Address.City,
                                                        address.Address.Line1, address.Address.Line2 ?? string.Empty);
                return(formattedAddress);
            }
            else
            {
                return(base.FormatShippingAddress(address, type, description, includeName));
            }
        }
Example #28
0
        public void OnShippingInfoNotFilled(object sender, EventArgs e)
        {
            if (ProductsBase.NeedEnterAddress())
            {
                AddAddressClicked(lnAddAddress, e);
            }
            else
            {
                DeliveryOptionType currentOption = getDeliveryOptionTypeFromDropdown(DeliveryType);
                string             message       = PlatformResources.GetGlobalResourceString("ErrorMessage",
                                                                                             "ShippingNickNameNotPopulated");
                if (currentOption == DeliveryOptionType.Pickup)
                {
                    message = PlatformResources.GetGlobalResourceString("ErrorMessage", "PickUpNickNameNotPopulated");
                }

                (ProductsBase.Master as OrderingMaster).Status.AddMessage(message);
            }
        }
        protected override void handleNicknameChanged(DropDownList deliveryType, DropDownList nickNameDropdown,
                                                      HtmlGenericControl pAddress)
        {
            DeliveryOptionType deliveryOptionType = getDeliveryOptionTypeFromDropdown(deliveryType);
            ShippingInfo       shippingInfo = ShoppingCart.DeliveryInfo;
            int deliveryOptionId = 0, shippingAddressId = 0;

            if (shippingInfo != null)
            {
                shippingAddressId = deliveryOptionType == DeliveryOptionType.Shipping ||
                                    deliveryOptionType == DeliveryOptionType.ShipToCourier
                                        ? int.Parse(nickNameDropdown.SelectedValue)
                                        : shippingInfo.Address.ID;
                deliveryOptionId = deliveryOptionType == DeliveryOptionType.Shipping ||
                                   deliveryOptionType == DeliveryOptionType.ShipToCourier
                                       ? shippingInfo.Id
                                       : int.Parse(nickNameDropdown.SelectedValue);
            }
            else
            {
                shippingAddressId = deliveryOptionType == DeliveryOptionType.Shipping ||
                                    deliveryOptionType == DeliveryOptionType.ShipToCourier
                                        ? int.Parse(nickNameDropdown.SelectedValue)
                                        : 0;
                deliveryOptionId = deliveryOptionType == DeliveryOptionType.Shipping ||
                                   deliveryOptionType == DeliveryOptionType.ShipToCourier
                                       ? 0
                                       : int.Parse(nickNameDropdown.SelectedValue);
            }
            updateShippingInfo(shippingAddressId,
                               deliveryOptionId,
                               deliveryOptionType);
            shippingInfo = ShoppingCart.DeliveryInfo;
            if (shippingInfo != null)
            {
                setAddressByNickName(shippingInfo.Address == null ? null : ShoppingCart.DeliveryInfo.Address, pAddress,
                                     deliveryType);
            }
            else
            {
                setAddressByNickName(null, pAddress, deliveryType);
            }
        }
Example #30
0
        protected override void showShiptoOrPickup(bool IsStatic)
        {
            DeliveryOptionType selectedOption = getDeliveryOptionTypeFromDropdown(DeliveryType);

            if (IsStatic)
            {
                selectedOption = ShoppingCart.DeliveryInfo != null ? ShoppingCart.DeliveryInfo.Option : selectedOption;
            }

            if (selectedOption == DeliveryOptionType.Shipping)
            {
                lbShiptoOrPickupReadonly.Text = lbShiptoOrPickup.Text = (string)GetLocalResourceObject("ShipTo");
                NickName.Text = NickName.Text = (string)GetLocalResourceObject("NickName");
            }
            else
            {
                lbShiptoOrPickupReadonly.Text = lbShiptoOrPickup.Text = (string)GetLocalResourceObject("PickUpForm");
                NickName.Text = NickName.Text = (string)GetLocalResourceObject("Location");
            }
        }