private void RenderDeletePickupView()
        {
            lblHeader.Visible       = false;
            divAddPickUp.Visible    = false;
            divDeletePickUp.Visible = true;
            HideSelected();
            btnContinue.Text = GetLocalResourceObject("btnDeleteResource.Text") as string;

            var shipAddr = new ShippingAddress_V01();

            shipAddr.Address         = new Address_V01();
            shipAddr.Address.Country = CountryCode;

            var deliveryType = HLConfigManager.Configurations.PickupOrDeliveryConfiguration.AllowPickUpFromCourier
                                   ? DeliveryOptionType.PickupFromCourier
                                   : DeliveryOptionType.ShipToCourier;
            List <PickupLocationPreference_V01> pickUpLocationPreferences =
                ProductsBase.GetShippingProvider()
                .GetPickupLocationsPreferences(DistributorID, CountryCode, Locale, deliveryType);
            PickupLocationPreference_V01 selectedPickupPreference = pickUpLocationPreferences.Find
                                                                        (p => p.PickupLocationID == WorkedUponDeliveryOptionId);

            lblName.Text = PickupLocationDescription;
            lblDeleteIsPrimaryText.Text = selectedPickupPreference.IsPrimary
                                              ? GetLocalResourceObject("PrimaryYes.Text") as string
                                              : GetLocalResourceObject("PrimaryNo.Text") as string;
            lblDeleteNicknameText.Text = selectedPickupPreference.PickupLocationNickname;
            divLocation.Visible        = false;
            divPrimary.Visible         = false;
            btnContinue.Enabled        = true;
            if (pickUpLocationPreferences.Count == 1)
            {
                lblErrors.Text = GetLocalResourceObject("LastPickupAddress.Text") as string;
            }
        }
        public void OnPickupPreferenceDeleted(object sender, EventArgs e)
        {
            var args = e as DeliveryOptionEventArgs;

            if (args != null)
            {
                _pickupRrefList =
                    (Page as ProductsBase).GetShippingProvider()
                    .GetPickupLocationsPreferences((Page as ProductsBase).DistributorID,
                                                   (Page as ProductsBase).CountryCode);
                if (_pickupRrefList.Count > 0)
                {
                    PickupLocationPreference_V01 pref = _pickupRrefList.First();
                    updateShippingInfo(ProductsBase.ShippingAddresssID, pref.PickupLocationID,
                                       DeliveryOptionType.PickupFromCourier);
                }
                else
                {
                    ProductsBase.ClearCart();
                }
                populateDropdown();
            }
            //   ucShippingInfoControl.Hide();
            reload();
            if (_pickupRrefList.Count == 0)
            {
                setAddressByNickName(null);
                ProductsBase.ClearCart();
            }
        }
Пример #3
0
        private void RenderDeletePickupView()
        {
            lblHeader.Visible       = lblSubHeader.Visible = false;
            divAddPickUp.Visible    = false;
            divDeletePickUp.Visible = true;
            HideSelected();
            btnContinue.Text = GetLocalResourceObject("btnContinueDelete") as string;

            var shipAddr = new ShippingAddress_V01();

            shipAddr.Address         = new Address_V01();
            shipAddr.Address.Country = CountryCode;

            List <PickupLocationPreference_V01> pickUpLocationPreferences = (Page as ProductsBase).GetShippingProvider().GetPickupLocationsPreferences((Page as ProductsBase).DistributorID, CountryCode);
            PickupLocationPreference_V01        selectedPickupPreference  = pickUpLocationPreferences.Find(p => p.PickupLocationID == WorkedUponDeliveryOptionId);

            lblName.Text = PickupLocationDescription;

            lblDeleteIsPrimaryText.Text = selectedPickupPreference.IsPrimary
                                              ? GetLocalResourceObject("PrimaryYes.Text") as string
                                              : GetLocalResourceObject("PrimaryNo.Text") as string;
            lblDeleteNicknameText.Text = selectedPickupPreference.PickupLocationNickname;
            trStateRadio.Visible       = false;
            trLocation.Visible         = false;
            trPrimary.Visible          = false;

            btnContinue.Enabled = true;

            if (pickUpLocationPreferences.Count == 1)
            {
                lblErrors.Text = GetLocalResourceObject("LastPickupAddress.Text") as string;
            }
        }
Пример #4
0
        public new void OnPickupPreferenceDeleted(object sender, EventArgs e)
        {
            var args = e as DeliveryOptionEventArgs;

            if (args != null)
            {
                _pickupRrefList =
                    (Page as ProductsBase).GetShippingProvider()
                    .GetPickupLocationsPreferences((Page as ProductsBase).DistributorID,
                                                   (Page as ProductsBase).CountryCode);
                if (_pickupRrefList.Count > 0)
                {
                    PickupLocationPreference_V01 pref = _pickupRrefList.First();
                    updateShippingInfo(ProductsBase.ShippingAddresssID, pref.PickupLocationID, DeliveryOptionType.Pickup);
                }
                populateDropdown();
            }

            populateDropdown();
            showHideAddressLink();
            setAddressByNickName(ShoppingCart.DeliveryInfo == null ? null : ShoppingCart.DeliveryInfo.Address);
            showShiptoOrPickup(IsStatic);

            if (_pickupRrefList.Count == 0)
            {
                setAddressByNickName(null);
            }
            ppShippingInfoControl.Update();
        }
        private void RenderDeletePickupView()
        {
            bool isXML = true;

            this.divAddPickUp.Visible    = false;
            this.divDeletePickUp.Visible = true;
            this.btnContinue.Text        = GetLocalResourceObject("btnContinueDelete") as string;

            ShippingAddress_V01 shipAddr = new ShippingAddress_V01();

            shipAddr.Address         = new Address_V01();
            shipAddr.Address.Country = CountryCode;

            var deliveryOptionList = (this.Page as ProductsBase).GetShippingProvider().
                                     GetDeliveryOptions(DeliveryOptionType.Pickup, shipAddr);

            DeliveryOption pickupDeliveryOption = deliveryOptionList.Find(p => p.Id == this.WorkedUponDeliveryOptionId);

            this.lblName.Text = pickupDeliveryOption.Description;

            string      controlPath = getDeleteAddressControlPath(ref isXML);
            AddressBase addressBase = new AddressControl();

            addressBase.XMLFile = controlPath;
            this.colDeletePickUp.Controls.Add((Control)addressBase);

            addressBase.DataContext = pickupDeliveryOption;

            var pickUpLocationPreferences = (this.Page as ProductsBase).GetShippingProvider().
                                            GetPickupLocationsPreferences(
                (this.Page as ProductsBase).DistributorID,
                CountryCode);
            PickupLocationPreference_V01 selectedPickupPreference = pickUpLocationPreferences.Find
                                                                        (p => p.PickupLocationID == this.WorkedUponDeliveryOptionId);

            if (selectedPickupPreference != null)
            {
                this.lblDeleteIsPrimaryText.Text = selectedPickupPreference.IsPrimary
                                                       ? GetLocalResourceObject("PrimaryYes.Text") as string
                                                       : GetLocalResourceObject("PrimaryNo.Text") as string;
                this.lblDeleteNicknameText.Text = selectedPickupPreference.PickupLocationNickname;

                if (selectedPickupPreference.IsPrimary) //Eval UC:3.5.3.7 (deleting primary)
                {
                    this.lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage",
                                                                                    "PrimaryPickupPreferenceDeleteNotAllowed");
                    this.btnContinue.Enabled = false;
                    return;
                }
                else //Eval UC:3.5.3.6 (deleting non-primary)
                {
                    this.btnContinue.Enabled = true;
                }
            }
        }
        private DeliveryOption getPrimaryPUFromCourierLocation()
        {
            try
            {
                pickupLocationPreferences =
                    (Page as ProductsBase).GetShippingProvider()
                    .GetPickupLocationsPreferences((Page as ProductsBase).DistributorID,
                                                   (Page as ProductsBase).CountryCode);
                if (pickupLocationPreferences == null)
                {
                    return(null);
                }

                primaryPickupLocationPreference = pickupLocationPreferences.Where(s => s.IsPrimary).First();
                if (null != primaryPickupLocationPreference)
                {
                    var shippingInfo =
                        ShippingProvider.GetShippingProvider(CountryCode)
                        .GetShippingInfoFromID(DistributorID, Locale,
                                               DeliveryOptionType.PickupFromCourier,
                                               primaryPickupLocationPreference.ID, 0);
                    if (null != shippingInfo)
                    {
                        var deliveryOption = new DeliveryOption(shippingInfo.WarehouseCode, shippingInfo.FreightCode,
                                                                DeliveryOptionType.Pickup);
                        if (shippingInfo.Address != null)
                        {
                            deliveryOption.Address = shippingInfo.Address.Address;
                        }

                        if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                        {
                            deliveryOption.Alias       = primaryPickupLocationPreference.PickupLocationNickname;
                            deliveryOption.Id          = primaryPickupLocationPreference.PickupLocationID;
                            deliveryOption.Description = shippingInfo.Name + " " + shippingInfo.Description;
                        }
                        else
                        {
                            deliveryOption.Alias       = shippingInfo.Name;
                            deliveryOption.Id          = primaryPickupLocationPreference.PickupLocationID;
                            deliveryOption.Description = shippingInfo.Description;
                        }
                        return(deliveryOption);
                    }
                }
            }
            catch (Exception)
            {
                return(null);
            }
            return(null);
        }
Пример #7
0
 public ShippingInfo(PickupLocationPreference_V01 pickupPref, DeliveryOption deliveryOption)
 {
     this.Id     = pickupPref.ID;
     Option      = DeliveryOptionType.Pickup;
     Description = deliveryOption.Name;
     Name        = pickupPref.PickupLocationNickname;
     if (deliveryOption.Address != null)
     {
         Address = CopyAddress(deliveryOption);
     }
     FreightCode          = deliveryOption.FreightCode;
     WarehouseCode        = deliveryOption.WarehouseCode;
     ShippingIntervalDays = deliveryOption.ShippingIntervalDays;
 }
Пример #8
0
            public static PickupViewModel ConvertDeliveryOptionToViewModel(PickupLocationPreference_V01 option, List <DeliveryOption> options)
            {
                //retrieving the delivery option to fill all the info for the saved options
                var original = options.Where(x => x.Id == option.PickupLocationID).FirstOrDefault();

                if (original != null)
                {
                    var puViewModel = ConvertDeliveryOptionToViewModel(original);
                    puViewModel.IsPrimary = option.IsPrimary;
                    puViewModel.Alias     = option.PickupLocationNickname;
                    puViewModel.IDSaved   = option.ID;
                    return(puViewModel);
                }
                //if the option does not exist return a blank object
                return(new PickupViewModel());
            }
        /// <summary>
        ///     get primary pickup location
        /// </summary>
        /// <returns></returns>
        private DeliveryOption getPrimaryPickupLocation()
        {
            try
            {
                pickupLocationPreferences =
                    (Page as ProductsBase).GetShippingProvider()
                    .GetPickupLocationsPreferences((Page as ProductsBase).DistributorID,
                                                   (Page as ProductsBase).CountryCode);
                if (pickupLocationPreferences == null)
                {
                    return(null);
                }

                primaryPickupLocationPreference = pickupLocationPreferences.Where(s => s.IsPrimary).First();
                if (null != primaryPickupLocationPreference)
                {
                    var shippingInfo =
                        ShippingProvider.GetShippingProvider(CountryCode)
                        .GetShippingInfoFromID(DistributorID, Locale, DeliveryOptionType.Pickup,
                                               primaryPickupLocationPreference.PickupLocationID, 0);
                    if (null != shippingInfo)
                    {
                        var deliveryOption = new DeliveryOption(shippingInfo.WarehouseCode, shippingInfo.FreightCode,
                                                                DeliveryOptionType.Pickup);
                        if (shippingInfo.Address != null)
                        {
                            deliveryOption.Address = shippingInfo.Address.Address;
                        }
                        deliveryOption.Alias       = shippingInfo.Name;
                        deliveryOption.Id          = primaryPickupLocationPreference.PickupLocationID;
                        deliveryOption.Description = shippingInfo.Description;
                        return(deliveryOption);
                        //pickupLocations.Add(deliveryOption);
                    }
                    //primaryPickupLocation = pickupLocations.Where(s => s.Id == primaryPickupLocationPreference.PickupLocationID).First();
                    //if (null != primaryPickupLocation)
                    //{
                    //    primaryPickupLocation.Alias = primaryPickupLocationPreference.PickupLocationNickname;
                    //}
                }
            }
            catch (Exception)
            {
                return(null);
            }
            return(null);
        }
        private void RenderDeletePickupView()
        {
            lblHeader.Visible               = false;
            divAddPickupLocation.Visible    = false;
            divDeletePickupLocation.Visible = true;

            List <PickupLocationPreference_V01> pickUpLocationPreferences =
                ProductsBase.GetShippingProvider().GetPickupLocationsPreferences(DistributorID, CountryCode, Locale, DeliveryOptionType.PickupFromCourier);

            PickupLocationPreference_V01 selectedPickupPreference = pickUpLocationPreferences.Find(p => p.PickupLocationID == WorkedUponDeliveryOptionId);

            //lblDeleteNicknameText.Text = selectedPickupPreference.PickupLocationNickname;

            if (pickUpLocationPreferences.Count == 1 && ShoppingCart.CartItems.Count > 0)
            {
                lblErrors.Text = GetLocalResourceObject("LastPickupAddress.Text") as string;
            }
        }
 protected new void DeleteClicked(object sender, EventArgs e)
 {
     if (DropdownNickName.SelectedItem != null)
     {
         DeliveryOption deliveryOption = getSelectedAddress(int.Parse(DropdownNickName.SelectedValue),
                                                            (DeliveryOptionType)
                                                            Enum.Parse(typeof(DeliveryOptionType),
                                                                       DeliveryType.SelectedValue));
         if (getDeliveryOptionTypeFromDropdown(DeliveryType) == DeliveryOptionType.Shipping)
         {
             if (deliveryOption != null)
             {
                 ucShippingInfoControl.ShowPopupForShipping(CommandType.Delete,
                                                            new ShippingAddressEventArgs(DistributorID,
                                                                                         deliveryOption, false,
                                                                                         ProductsBase
                                                                                         .DisableSaveAddressCheckbox));
             }
         }
         else
         {
             ShippingInfo shippingInfo = ShoppingCart.DeliveryInfo;
             if (shippingInfo != null)
             {
                 List <PickupLocationPreference_V01> pickupLocationPreferences =
                     (Page as ProductsBase).GetShippingProvider()
                     .GetPickupLocationsPreferences((Page as ProductsBase).DistributorID,
                                                    (Page as ProductsBase).CountryCode);
                 if (int.Parse(DropdownNickName.SelectedValue) != 0)
                 {
                     PickupLocationPreference_V01 pref =
                         pickupLocationPreferences.Find(p => p.ID == int.Parse(DropdownNickName.SelectedValue));
                     if (pref != null)
                     {
                         ucShippingInfoControl.ShowPopupForPickup(CommandType.Delete,
                                                                  new DeliveryOptionEventArgs(
                                                                      pref.PickupLocationID, shippingInfo.Name));
                     }
                 }
             }
         }
     }
 }