Пример #1
0
 //sets the visibility of 'Clear Cart' link.
 private void ShowClearCartLink()
 {
     if (ShoppingCart != null)
     {
         if (ShoppingCart.CartItems.Count.Equals(0) || ShoppingCart.CustomerOrderDetail != null)
         {
             ClearCart.Visible = false;
         }
         else
         {
             if (APFDueProvider.containsOnlyAPFSku(ShoppingCart.CartItems))
             {
                 ClearCart.Visible = APFDueProvider.CanRemoveAPF(DistributorID, Locale, null);
                 if (DistributorOrderingProfile != null && HLConfigManager.Configurations.DOConfiguration.IsChina)
                 {
                     if (!HLConfigManager.Configurations.APFConfiguration.AllowDSRemoveAPFWhenDue)
                     {
                         ClearCart.Visible = DistributorOrderingProfile.CNAPFStatus != 2;
                     }
                 }
             }
             else
             {
                 ClearCart.Visible = true;
             }
         }
     }
 }
        public override void SetShippingInfo(ServiceProvider.CatalogSvc.ShoppingCart_V01 cart)
        {
            var thisCart = cart as MyHLShoppingCart;

            if (thisCart != null)
            {
                if (thisCart.DeliveryInfo.Option == DeliveryOptionType.Shipping)
                {
                    if (!this.SetFreightCodesForIBPOrders(thisCart) &&
                        !APFDueProvider.containsOnlyAPFSku(thisCart.CartItems))
                    {
                        if (thisCart.Totals != null)
                        {
                            var state = (thisCart.DeliveryInfo.Address.Address.StateProvinceTerritory ?? string.Empty).Trim();
                            var city  = (thisCart.DeliveryInfo.Address.Address.City ?? string.Empty).Trim();
                            if ((thisCart.Totals as OrderTotals_V01).ItemsTotal < CartAmountCap)
                            {
                                //set cart warehouseid

                                if (IsMajorCity(state, city))
                                {
                                    thisCart.DeliveryInfo.FreightCode = "FSL";
                                }
                                else
                                {
                                    thisCart.DeliveryInfo.FreightCode = "IND";
                                }

                                ShoppingCartProvider.UpdateShoppingCart(thisCart);     // save to database
                            }
                            else
                            {
                                var provider     = new ShippingProvider_IN();
                                var shippingInfo =
                                    provider.GetShippingInfoFromID(
                                        thisCart.DistributorID,
                                        thisCart.Locale,
                                        thisCart.DeliveryInfo.Option,
                                        thisCart.DeliveryOptionID,
                                        thisCart.DeliveryInfo.Address.ID);
                                if (shippingInfo != null)
                                {
                                    if (IsMajorCity(state, city))
                                    {
                                        thisCart.DeliveryInfo.FreightCode = "FSL";
                                    }
                                    else
                                    {
                                        thisCart.DeliveryInfo.FreightCode = "IND";
                                    }
                                    thisCart.DeliveryInfo = shippingInfo; // will invoke save to database
                                }
                            }
                        }
                    }
                }
            }
        }
        private List <CardInfo> GetCardsList()
        {
            var        result = new List <CardInfo>();
            FileStream f      = null;

            try
            {
                string           orderType    = "RSO";
                MyHLShoppingCart shoppingCart = (Page as ProductsBase).ShoppingCart;

                if (_enableInstallments)
                {
                    if (shoppingCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.ETO)
                    {
                        orderType = "ETO";
                    }

                    if (APFDueProvider.containsOnlyAPFSku(shoppingCart.ShoppingCartItems))
                    {
                        orderType = "APF";
                    }

                    _installmentsConfiguration = InstallmentsProvider.GetInstallmentsConfiguration((Page as ProductsBase).CountryCode, DateTime.Today, orderType);

                    // Check the source for installments config
                    if (!_paymentsConfig.LocalInstallmentsSource)
                    {
                        _cards = _installmentsConfiguration.Cards;
                    }
                    else
                    {
                        var serial = new XmlSerializer(typeof(Cards));
                        //f = System.IO.File.OpenRead(Server.MapPath("~/Ordering/Controls/Payments/PaymentGateways/CardData_es-AR.xml"));
                        f      = File.OpenRead(Server.MapPath("~/App_Data/Configuration/CardData_es-AR.xml"));
                        _cards = serial.Deserialize(f) as Cards;
                    }
                }

                result = _cards != null ? _cards.Card : null;
            }
            catch (Exception ex)
            {
                //string errorMessage =
                //    "Cannot find Credit Card CardData_es-AR.xml. Cannot calculate fees for Payment Installments";
                LoggerHelper.Error(string.Format("\r\nException: {0}", ex.Message));
                //throw new ApplicationException(errorMessage, ex);
            }
            finally
            {
                if (null != f)
                {
                    f.Close();
                }
            }
            return(result);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (APFDueProvider.containsOnlyAPFSku(ProductsBase.ShoppingCart.CartItems) || ProductsBase.ShoppingCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.HSO)
            {
                this.Visible = false;
                return;
            }

            if (!IsPostBack)
            {
                DisplayTodaysMagazine(string.Empty);
            }
        }
 private bool CheckIfOnlyAPF()
 {
     if (APFDueProvider.containsOnlyAPFSku(ProductsBase.ShoppingCart.CartItems))
     {
         this.divTodaysMagazine.Visible = false;
         displayTodaysMagazine(false);
         return(true);
     }
     else
     {
         this.divTodaysMagazine.Visible = true;
         displayTodaysMagazine(true);
         return(false);
     }
 }
 public void ListnerMethod()
 {
     if (ShoppingCart.ShoppingCartItems != null & ShoppingCart.ShoppingCartItems.Count > 0)
     {
         this.OvalSaveCartButton.Visible = true;
         this.OvalSaveCartButton.Enabled =
             !(APFDueProvider.containsOnlyAPFSku(ShoppingCart.ShoppingCartItems) &&
               HLConfigManager.Configurations.APFConfiguration.StandaloneAPFOnlyAllowed);
         this.OvalSaveCartButton.Disabled = !this.OvalSaveCartButton.Enabled;
     }
     else
     {
         this.OvalSaveCartButton.Visible = false;
     }
     btnCancel.Visible = this.ShoppingCart.IsSavedCart;
 }
 public override bool ValidateShipping(MyHLShoppingCart shoppingCart)
 {
     if (shoppingCart != null)
     {
         if (shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping)
         {
             if (shoppingCart.DeliveryInfo != null &&
                 !string.IsNullOrEmpty(shoppingCart.DeliveryInfo.WarehouseCode) &&
                 !string.IsNullOrEmpty(shoppingCart.DeliveryInfo.FreightCode))
             {
                 return(true);
             }
         }
         else
         {
             if (!APFDueProvider.containsOnlyAPFSku(shoppingCart.CartItems))
             {
                 if (shoppingCart.DeliveryInfo != null &&
                     !string.IsNullOrEmpty(shoppingCart.DeliveryInfo.WarehouseCode) &&
                     !string.IsNullOrEmpty(shoppingCart.DeliveryInfo.FreightCode) &&
                     shoppingCart.DeliveryInfo.PickupDate != null &&
                     !string.IsNullOrEmpty(shoppingCart.DeliveryInfo.Address.Recipient))
                 {
                     return(true);
                 }
             }
             else
             {
                 if (shoppingCart.DeliveryInfo != null &&
                     !string.IsNullOrEmpty(shoppingCart.DeliveryInfo.WarehouseCode) &&
                     !string.IsNullOrEmpty(shoppingCart.DeliveryInfo.FreightCode))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Пример #8
0
        private ShoppingCartRuleResult CartItemBeingAddedRuleHandler(ShoppingCart_V01 cart,
                                                                     ShoppingCartRuleResult result,
                                                                     string level)
        {
            var distributorId      = cart.DistributorID;
            var isAPFDueandNotPaid = APFDueProvider.IsAPFDueAndNotPaid(distributorId, Locale);

            if (isAPFDueandNotPaid && HLConfigManager.Configurations.APFConfiguration.StandaloneAPFOnlyAllowed)
            {
                result.Result = RulesResult.Failure;
                result.AddMessage(
                    HttpContext.GetGlobalResourceObject(string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                                        "CompleteAPFPurchase") as string);
                var sku = APFDueProvider.GetAPFSku();
                SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.StandaloneAPFOnlyAllowed,
                                   "CompleteAPFPurchase");

                cart.RuleResults.Add(result);
                return(result);
            }
            else if (isAPFDueandNotPaid && HLConfigManager.Configurations.DOConfiguration.IsChina)
            {
                string cacheKey   = string.Empty;
                bool   reloadAPFs = (null != cart && null != cart.CartItems) && isAPFDueandNotPaid &&
                                    !APFDueProvider.IsAPFSkuPresent(cart.CartItems);

                DoApfDue(cart.DistributorID, cart, cacheKey, Locale, reloadAPFs, result, true);
            }

            if ((cart as MyHLShoppingCart).OrderCategory == OrderCategoryType.ETO) //No APFs allowed in ETO cart
            {
                result.Result = RulesResult.Success;
                return(result);
            }

            //cart.CurrentItems[0] contains the current item being added
            //because the provider only adds one at a time, we just need to return a single error, but aggregate to the cart errors for the UI
            if (APFDueProvider.IsAPFSku(cart.CurrentItems[0].SKU))
            {
                if (APFDueProvider.CanRemoveAPF(distributorId, Locale, level))
                {
                    if (APFDueProvider.IsAPFSku(cart.CurrentItems[0].SKU))
                    {
                        var originaItem =
                            (from c in cart.CartItems where c.SKU == cart.CurrentItems[0].SKU select c).ToList();
                        int previousQuantity = 0;
                        if (null != originaItem && originaItem.Count > 0)
                        {
                            previousQuantity = originaItem[0].Quantity;
                        }
                        if (APFDueProvider.IsAPFDueAndNotPaid(distributorId, Locale))
                        {
                            int requiredQuantity = APFDueProvider.APFQuantityDue(distributorId, Locale);
                            if (cart.CurrentItems[0].Quantity + previousQuantity <= requiredQuantity)
                            {
                                if (level == "SP")
                                {
                                    cart.CurrentItems[0].Quantity = requiredQuantity - previousQuantity;
                                    result.Result = RulesResult.Recalc;
                                    result.AddMessage(
                                        HttpContext.GetGlobalResourceObject(
                                            string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                            "RequiredAPFLeftInCart") as string);
                                    var sku = APFDueProvider.GetAPFSku();
                                    SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.CantDSRemoveAPF,
                                                       "RequiredAPFLeftInCart");
                                    cart.RuleResults.Add(result);
                                    cart.APFEdited = false;
                                    return(result);
                                }
                                else
                                {
                                    result.Result = RulesResult.Recalc;
                                    result.AddMessage(string.Empty);
                                    cart.RuleResults.Add(result);
                                    cart.APFEdited = true;
                                    return(result);
                                }
                            }
                            else if (cart.CurrentItems[0].Quantity + previousQuantity > requiredQuantity)
                            {
                                cart.CurrentItems[0].Quantity = requiredQuantity - previousQuantity;
                                result.Result = RulesResult.Recalc;
                                result.AddMessage(
                                    HttpContext.GetGlobalResourceObject(
                                        string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                        "RequiredAPFLeftInCart") as string);
                                var sku = APFDueProvider.GetAPFSku();
                                SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.CantDSRemoveAPF,
                                                   "RequiredAPFLeftInCart");
                                cart.RuleResults.Add(result);
                                cart.APFEdited = false;
                                return(result);
                            }
                        }
                        else
                        {
                            if (cart.CurrentItems[0].Quantity + previousQuantity > 1)
                            {
                                if (APFDueProvider.CanAddAPF(distributorId))
                                {
                                    result.Result = RulesResult.Failure;
                                    result.AddMessage(
                                        HttpContext.GetGlobalResourceObject(
                                            string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                            "CanOnlyPrepayOneAPF") as string);
                                    var sku = APFDueProvider.GetAPFSku();
                                    SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.CantDSRemoveAPF,
                                                       "CanOnlyPrepayOneAPF");
                                    cart.RuleResults.Add(result);
                                    cart.APFEdited = true;
                                    return(result);
                                }
                            }
                        }
                    }
                }

                if (!APFDueProvider.CanAddAPF(distributorId))
                {
                    result.Result = RulesResult.Failure;
                    result.AddMessage(
                        HttpContext.GetGlobalResourceObject(
                            string.Format("{0}_ErrorMessage", HLConfigManager.Platform), "CannotAddAPFSku") as string);
                    var sku = APFDueProvider.GetAPFSku();
                    SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.CannotAddAPFSku,
                                       "CannotAddAPFSku");

                    cart.RuleResults.Add(result);
                    return(result);
                }
                else
                {
                    string apfSku = APFDueProvider.GetAPFSku();
                    if (cart.CurrentItems[0].SKU == apfSku)
                    {
                        cart.APFEdited = true;
                    }
                    else
                    {
                        result.Result = RulesResult.Failure;
                        result.AddMessage(
                            HttpContext.GetGlobalResourceObject(
                                string.Format("{0}_ErrorMessage", HLConfigManager.Platform), "SkuNotValid") as string);
                        var sku = APFDueProvider.GetAPFSku();
                        SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.CannotAddAPFSku,
                                           "SkuNotValid");
                        cart.RuleResults.Add(result);
                        return(result);
                    }
                }
            }

            if (APFDueProvider.IsAPFSkuPresent(cart.CartItems))
            {
                var currentSession = SessionInfo.GetSessionInfo(cart.DistributorID, cart.Locale);
                if ((!APFDueProvider.CanEditAPFOrder(cart.DistributorID, Thread.CurrentThread.CurrentCulture.Name, level)) || (currentSession.IsAPFOrderFromPopUp))
                {
                    result.Result = RulesResult.Failure;
                    result.AddMessage(
                        HttpContext.GetGlobalResourceObject(
                            string.Format("{0}_ErrorMessage", HLConfigManager.Platform), "CompleteAPFPurchase") as
                        string);
                    var sku = APFDueProvider.GetAPFSku();
                    SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.StandaloneAPFOnlyAllowed,
                                       "CompleteAPFPurchase");
                    cart.RuleResults.Add(result);
                    return(result);
                }
                else
                {
                    if (APFDueProvider.containsOnlyAPFSku(cart.CartItems))
                    {
                        CatalogItem item = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country);
                        if (null != item)
                        {
                            if (!HLConfigManager.Configurations.APFConfiguration.AllowNonProductItemsWithStandaloneAPF)
                            {
                                if (item.ProductType != ProductType.Product)
                                {
                                    result.Result = RulesResult.Failure;
                                    result.AddMessage(
                                        HttpContext.GetGlobalResourceObject(
                                            string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                            "NoNonProductToStandaloneAPF") as string);

                                    var sku = APFDueProvider.GetAPFSku();
                                    SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.AllowNonProductItemsWithStandaloneAPF,
                                                       "NoNonProductToStandaloneAPF");

                                    cart.RuleResults.Add(result);
                                    return(result);
                                }
                            }
                            if (item.SKU == HLConfigManager.Configurations.DOConfiguration.TodayMagazineSku ||
                                item.SKU == HLConfigManager.Configurations.DOConfiguration.TodayMagazineSecondarySku)
                            {
                                result.Result = RulesResult.Failure;
                                result.AddMessage(
                                    HttpContext.GetGlobalResourceObject(
                                        string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                        "NoTodayMagazineWithStandalonAPF") as string);
                                var sku = APFDueProvider.GetAPFSku();
                                SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.StandaloneAPFOnlyAllowed,
                                                   "NoTodayMagazineWithStandalonAPF");

                                cart.RuleResults.Add(result);
                                return(result);
                            }

                            //To the standalone APF, DS trying to add product then change the Freight code & warehouse code.
                            else if (item.ProductType == ProductType.Product ||
                                     item.ProductType == ProductType.Literature ||
                                     item.ProductType == ProductType.PromoAccessory)
                            {
                                SetNonStandAloneAPFDeliveryOption(cart as MyHLShoppingCart);
                            }
                        }
                    }
                }
            }

            //Can add
            if (APFDueProvider.IsAPFSku(cart.CurrentItems[0].SKU))
            {
                if (cart.CurrentItems[0].Quantity < 0)
                {
                    var originaItem =
                        (from c in cart.CartItems where c.SKU == cart.CurrentItems[0].SKU select c).ToList();
                    int previousQuantity = originaItem[0].Quantity;
                    if (APFDueProvider.IsAPFDueAndNotPaid(distributorId, Locale))
                    {
                        int requiredQuantity = APFDueProvider.APFQuantityDue(distributorId, Locale);
                        if (level == "SP" || !HLConfigManager.Configurations.APFConfiguration.AllowDSRemoveAPFWhenDue)
                        {
                            if (cart.CurrentItems[0].Quantity + previousQuantity < requiredQuantity)
                            {
                                cart.CurrentItems[0].Quantity = (previousQuantity - requiredQuantity) * -1;
                                result.Result = RulesResult.Recalc;
                                result.AddMessage(
                                    HttpContext.GetGlobalResourceObject(
                                        string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                        "RequiredAPFLeftInCart") as string);
                                var sku = APFDueProvider.GetAPFSku();
                                SetApfRuleResponse(result, ApfAction.None, sku, "ApfRule", TypeOfApf.StandaloneAPFOnlyAllowed,
                                                   "RequiredAPFLeftInCart");

                                cart.RuleResults.Add(result);
                                cart.APFEdited = false;
                                return(result);
                            }
                        }
                    }
                }
            }

            return(result);
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (trYourLevel != null)
            {
                trYourLevel.Visible = false;                      // Hide row by default
            }
            if (ProductsBase.GlobalContext.CultureConfiguration.IsBifurcationEnabled && SessionInfo.DsType == ServiceProvider.DistributorSvc.Scheme.Member && SessionInfo.IsHAPMode == true)
            {
                ViewEntireCart.Visible = false;
            }
            else
            {
                ViewEntireCart.Visible = true;
            }
            ProductsBase.OrderMonth.RegisterOrderMonthControls(pnlOrderMonth, null, ProductsBase.IsEventTicketMode,
                                                               pnlOrderMonthLabel, SessionInfo.IsHAPMode);

            var PLControl = loadPurchasingLimitsControl(false);

            if (PLControl != null)
            {
                trPurchaseLimits.Visible = true;
                pnlPurchaseLimits.Controls.Add(PLControl);
            }

            ShowClearCartLink();

            if (ShoppingCart.OrderCategory == OrderCategoryType.HSO && SessionInfo.IsHAPMode &&
                HLConfigManager.Configurations.DOConfiguration.AllowHAP)
            {
                var hapControl = loadHAPControl(false);
                trHAPControl.Visible = true;
                pnlHAP.Visible       = true;
                pnlHAP.Controls.Add(hapControl);
                //TODO: add HAP control
            }


            if (!IsPostBack)
            {
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                loadCart();
            }
            else
            {
                bool isNotified;
                bool.TryParse(Session["displayNonResidentModal"] != null ? Session["displayNonResidentModal"].ToString() : "false", out isNotified);

                if (isNotified)
                {
                    Session["displayNonResidentModal"] = false;
                    Response.Redirect("~/Ordering/ShoppingCart.aspx");
                }
            }

            // Display the saved cart name and command
            if (HLConfigManager.Configurations.DOConfiguration.AllowSavedCarts &&
                ShoppingCart.OrderCategory == OrderCategoryType.RSO)
            {
                if (!(APFDueProvider.containsOnlyAPFSku(ShoppingCart.CartItems) && HLConfigManager.Configurations.APFConfiguration.StandaloneAPFOnlyAllowed))
                {
                    var savedCartCommand = LoadControl("~/Ordering/Controls/SaveCartCommand.ascx");
                    (savedCartCommand as SaveCartCommand).IsInMinicart = true;
                    plSavedCartCommand.Controls.Add(savedCartCommand);
                    if (ShoppingCart != null && ShoppingCart.IsSavedCart && !string.IsNullOrEmpty(ShoppingCart.CartName))
                    {
                        lblSavedCartName.Text  = ShoppingCart.CartName;
                        SavedCartTitle.Visible = true;
                    }
                    else
                    {
                        SavedCartTitle.Visible = false;
                    }
                }
            }

            if (HLConfigManager.Configurations.DOConfiguration.AllowHAP && SessionInfo.IsHAPMode && ShoppingCart.OrderCategory == OrderCategoryType.HSO)
            {
                trOrderMonth.Visible = trOrderMonthVP.Visible = false;
                if (ShoppingCart.DsType != null && ShoppingCart.DsType == ServiceProvider.DistributorSvc.Scheme.Member)
                {
                    trDiscountRate.Visible = false;
                    if (trYourLevel != null)
                    {
                        trYourLevel.Visible = true;
                    }
                    uxYourLevel.Text = GetGlobalResourceString(string.Format("DisplayLevel_{0}", ProductsBase.LevelSubType), defaultValue: string.Empty);
                }
            }

            if (HLConfigManager.Configurations.DOConfiguration.DisplayBifurcationKeys &&
                ShoppingCart.DsType != null && ShoppingCart.DsType == ServiceProvider.DistributorSvc.Scheme.Member)
            {
                TxtVolumePoint.Text = (string)GetLocalResourceObject("TxtVolumePointResource1MB.Text");
            }
        }
Пример #10
0
        protected void checkoutClicked(object sender, EventArgs e)
        {
            if (!CheckDSCantBuyStatus())
            {
                return;
            }

            CheckHAPOptions();

            ProceedingToCheckoutFromMiniCart(this, null);

            if (_errors.Count > 0)
            {
                //this.noItemToPurchase.Visible = true;
                //this.noItemToPurchase.Text = _errors[0];
                (Page.Master as OrderingMaster).Status.AddMessage(
                    StatusMessageType.Error, _errors[0]);
                return;
            }
            if (!String.IsNullOrEmpty(HLConfigManager.Configurations.DOConfiguration.PurchasingLimitsControl))
            {
                //if (PurchasingLimitProvider.RequirePurchasingLimits(this.DistributorID, this.CountryCode))
                //{

                //Check Value Selected in Drop Down
                if (String.IsNullOrEmpty(ShoppingCart.SelectedDSSubType))
                {
                    //TODO- Replace with resource entry
                    noItemToPurchase.Visible = true;
                    noItemToPurchase.Text    = GetLocalResourceObject("OrderTypeNotSelected").ToString();
                    return;
                }
                //}
            }

            if (!CheckDRFraud())
            {
                return;
            }

            noItemToPurchase.Visible = false;
            errDRFraud.Visible       = false;
            //}
            //else
            //{
            //    this.noItemToPurchase.Visible = true;
            //}

            bool isNotified;

            bool.TryParse(Session["isNonResidentNotified"] != null ? Session["isNonResidentNotified"].ToString() : "false", out isNotified);

            if (HLConfigManager.Configurations.DOConfiguration.DisplayNonResidentsMessage && !isNotified)
            {
                var member = (MembershipUser <DistributorProfileModel>)System.Web.Security.Membership.GetUser();

                if (ShoppingCart.DeliveryInfo != null && ShoppingCart.DeliveryInfo.Option == ServiceProvider.ShippingSvc.DeliveryOptionType.Pickup &&
                    !SessionInfo.IsEventTicketMode && !APFDueProvider.IsAPFSkuPresent(ShoppingCart.CartItems) &&
                    member != null && member.Value != null && !member.Value.ProcessingCountryCode.Equals(CountryCode))
                {
                    Session["isNonResidentNotified"] = Session["displayNonResidentModal"] = true;
                    (this.Master as OrderingMaster).DisplayHtml("NonResidentsDisclaimer.html");
                    return;
                }
            }

            if (SessionInfo != null && !SessionInfo.IsFirstTimeSpainPopup && ShoppingCart != null && ShoppingCart.Locale == "es-ES" && !APFDueProvider.containsOnlyAPFSku(ShoppingCart.CartItems) &&
                ShoppingCart.CartItems != null && ShoppingCart.CartItems.Count > 0 && ShoppingCart.OrderCategory == OrderCategoryType.RSO &&
                !HLConfigManager.Configurations.APFConfiguration.StandaloneAPFOnlyAllowed && ShoppingCart.DeliveryInfo.Option == ServiceProvider.ShippingSvc.DeliveryOptionType.Pickup)
            {
                SpainPlasticBagAlert.Show();
            }
            else
            {
                Response.Redirect("~/Ordering/ShoppingCart.aspx");
            }
        }
Пример #11
0
        public bool PurchasingLimitsAreExceeded(string distributorId, MyHLShoppingCart cart)
        {
            bool exceeded = false;

            if (cart.OrderCategory == OrderCategoryType.HSO)
            {
                return(exceeded);
            }
            if (CanPurchase)
            {
                // PurchasingLimits_V01 limits = PurchasingLimitProvider.GetCurrentPurchasingLimits(distributorId);
                PurchasingLimits_V01 limits = GetPurchasingLimits(intOrderMonth(OrderMonth.GetCurrentOrderMonth()));
                if (limits == null || cart == null)
                {
                    return(exceeded);
                }

                if (null != cart.Totals && cart.OrderCategory == OrderCategoryType.ETO)
                {
                    return(exceeded);
                }

                if (null != limits && limits.LimitsRestrictionType == LimitsRestrictionType.PurchasingLimits && limits.PurchaseLimitType != PurchaseLimitType.None)
                {
                    switch (limits.PurchaseLimitType)
                    {
                    case PurchaseLimitType.Earnings:
                    {
                        exceeded = limits.NextMaxEarningsLimit > -1 && ((limits.RemainingEarnings - cart.ProductEarningsInCart) < 0);
                        break;
                    }

                    case PurchaseLimitType.Volume:
                    {
                        exceeded = limits.maxVolumeLimit > -1 && ((limits.RemainingVolume - cart.ProductVolumeInCart) < 0);
                        break;
                    }

                    case PurchaseLimitType.DiscountedRetail:
                    {
                        exceeded = limits.maxVolumeLimit > -1 && ((limits.RemainingVolume - cart.ProductDiscountedRetailInCart) < 0);
                        break;
                    }

                    case PurchaseLimitType.TotalPaid:
                    {
                        if (null != cart.Totals)
                        {
                            if (APFDueProvider.containsOnlyAPFSku(cart.ShoppingCartItems))
                            {
                                return(exceeded);
                            }

                            exceeded = limits.maxVolumeLimit > -1 && ((limits.RemainingVolume - (cart.Totals as OrderTotals_V01).AmountDue) < 0);
                        }
                        break;
                    }
                    }
                }
                if (null != limits && limits.LimitsRestrictionType != LimitsRestrictionType.PurchasingLimits)
                {
                    exceeded = ((limits.RemainingVolume - cart.VolumeInCart) < 0);
                    if (exceeded)
                    {
                        cart.RuleResults = new List <ShoppingCartRuleResult>();
                        ShoppingCartRuleResult Result = new ShoppingCartRuleResult();
                        Result.RuleName = "PurchaseRestriction Rules";
                        Result.Result   = RulesResult.Failure;
                        Result.AddMessage(string.Format(HttpContext.GetGlobalResourceObject(
                                                            string.Format("{0}_Rules", HLConfigManager.Platform),
                                                            "FOPVolumePointExceedsOnCheckout").ToString(), 1100, PurchaseRestrictionProvider.GetVolumeLimitsAfterFirstOrderFOP(_processingCountry), PurchaseRestrictionProvider.GetThresholdPeriod(_processingCountry), cart.VolumeInCart - limits.RemainingVolume));
                        cart.RuleResults.Add(Result);
                    }
                }
                else if (exceeded)
                {
                    cart.RuleResults = new List <ShoppingCartRuleResult>();
                    ShoppingCartRuleResult Result = new ShoppingCartRuleResult();
                    Result.RuleName = "PurchaseRestriction Rules";
                    Result.Result   = RulesResult.Failure;
                    Result.AddMessage(string.Format(HttpContext.GetGlobalResourceObject(
                                                        string.Format("{0}_Rules", HLConfigManager.Platform),
                                                        "RemainingVolumePointExceeds").ToString(), (cart.VolumeInCart - limits.RemainingVolume)));
                    cart.RuleResults.Add(Result);
                }
            }
            else  //member can't purchase
            {
                if ((cart.Totals as OrderTotals_V01).AmountDue > 0) //can't purchase and there are items in cart
                {
                    exceeded         = true;
                    cart.RuleResults = new List <ShoppingCartRuleResult>();
                    ShoppingCartRuleResult Result = new ShoppingCartRuleResult();
                    Result.RuleName = "PurchaseRestriction Rules";
                    Result.Result   = RulesResult.Failure;
                    Result.AddMessage(string.Format(HttpContext.GetGlobalResourceObject(
                                                        string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                                        "CantBuy").ToString(), 1100, cart.DistributorID));
                    cart.RuleResults.Add(Result);
                }
            }
            return(exceeded);
        }
Пример #12
0
        protected override void LoadPickUpInstructions(bool IsStatic)
        {
            DeliveryOptionType selectedOption = ShoppingCart.DeliveryInfo != null
                                                    ? ShoppingCart.DeliveryInfo.Option
                                                    : getDeliveryOptionTypeFromDropdown(DeliveryType);

            if (selectedOption == DeliveryOptionType.Pickup || selectedOption == DeliveryOptionType.PickupFromCourier)
            {
                if (!HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveDate &&
                    !HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveName &&
                    !HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHavePhone &&
                    !HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveTime)
                {
                    DeliveryOptionsInstructionsView.Visible = false;
                    return;
                }

                TextShippingMethod.Text = (string)GetLocalResourceObject("PickUpBy");

                if (!IsStatic)
                {
                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveDate)
                    {
                        pickupdateTextBox.MinDate      = DateUtils.GetCurrentLocalTime(CountryCode);
                        pickupdateTextBox.MaxDate      = pickupdateTextBox.MinDate + new TimeSpan(14, 0, 0, 0);
                        pickupdateTextBox.SelectedDate = pickupdateTextBox.MinDate;
                        if (ShoppingCart.DeliveryInfo != null)
                        {
                            if (!String.IsNullOrEmpty(ShoppingCart.DeliveryInfo.Instruction))
                            {
                                DateTime dtShoppingCartDate;
                                bool     success = DateTime.TryParse(ShoppingCart.DeliveryInfo.Instruction,
                                                                     out dtShoppingCartDate);
                                if (success)
                                {
                                    pickupdateTextBox.SelectedDate = dtShoppingCartDate;
                                }
                            }
                        }
                    }
                    else
                    {
                        trEditableDatePicker.Visible = false;
                    }

                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveName)
                    {
                        txtPickupName.Attributes.Add("maxlength", "36");
                        if (ShoppingCart.DeliveryInfo != null)
                        {
                            if (!String.IsNullOrEmpty(ShoppingCart.DeliveryInfo.Address.Recipient))
                            {
                                txtPickupName.Text = ShoppingCart.DeliveryInfo.Address.Recipient;
                            }
                        }
                    }
                    else
                    {
                        trEditablePickupName.Visible = false;
                    }

                    // Pick up Phone
                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHavePhone)
                    {
                        if (!HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickUpPhoneHasPhoneMask)
                        {
                            txtPhoneNumber_MaskedEditExtender.Enabled = false;
                            txtPickupPhone.Attributes.Add("maxlength",
                                                          HLConfigManager.Configurations.PickupOrDeliveryConfiguration
                                                          .PickUpPhoneMaxLen.ToString());
                        }
                        else
                        {
                            txtPhoneNumber_MaskedEditExtender.Enabled = true;
                            txtPhoneNumber_MaskedEditExtender.Mask    =
                                HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickUpPhoneMask;
                        }
                        if (ShoppingCart.DeliveryInfo != null)
                        {
                            if (!String.IsNullOrEmpty(ShoppingCart.DeliveryInfo.Address.Phone))
                            {
                                txtPickupPhone.Text = ShoppingCart.DeliveryInfo.Address.Phone;
                            }
                        }
                    }
                    else
                    {
                        trEditablePickupPhone.Visible = false;
                    }

                    // Have Time Field
                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveTime)
                    {
                        if (ShoppingCart.DeliveryInfo != null)
                        {
                            PopulatePickUpInstructionsTimeDropDown();
                            if (!String.IsNullOrEmpty(ShoppingCart.DeliveryInfo.Instruction))
                            {
                                ListItem li = ddlPickupTime.Items.FindByText(ShoppingCart.DeliveryInfo.Instruction);
                                if (li != null)
                                {
                                    li.Selected = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        trEditablePickUpTimeDropDown.Visible = false;
                    }
                }
                else // if (!IsStatic)
                {
                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveDate)
                    {
                        if (!APFDueProvider.containsOnlyAPFSku(ShoppingCart.CartItems))
                        {
                            lbPickupdate.Text = ShoppingCart.DeliveryInfo != null
                                                    ? (ShoppingCart.DeliveryInfo.Instruction != null
                                                           ? DateTime.Parse(ShoppingCart.DeliveryInfo.Instruction)
                                                       .ToShortDateString()
                                                           : string.Empty)
                                                    : String.Empty;
                        }
                    }
                    else
                    {
                        trStaticDatePicker.Visible = false;
                    }

                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveName)
                    {
                        lbPickupname.Text = ShoppingCart.DeliveryInfo != null
                                                ? ShoppingCart.DeliveryInfo.Address.Recipient
                                                : String.Empty;
                    }
                    else
                    {
                        trStaticPickupName.Visible = false;
                    }

                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHavePhone)
                    {
                        lblPickUpPhone.Text = ShoppingCart.DeliveryInfo != null
                                                  ? ShoppingCart.DeliveryInfo.Address.Phone
                                                  : String.Empty;
                    }
                    else
                    {
                        trStaticPickupPhone.Visible = false;
                    }

                    if (HLConfigManager.Configurations.PickupOrDeliveryConfiguration.PickupInstructionsHaveTime)
                    {
                        if (!APFDueProvider.containsOnlyAPFSku(ShoppingCart.CartItems))
                        {
                            txtPickupTime.Text = ShoppingCart.DeliveryInfo != null
                                                     ? ShoppingCart.DeliveryInfo.Instruction
                                                     : String.Empty;
                        }
                    }
                    else
                    {
                        trStaticPickUpTimeDropDown.Visible = false;
                    }
                }
            }
        }