Exemple #1
0
        private void DisplayRemaining(string orderSubType)
        {
            //string DSType = ProductsBase.LevelSubType;
            ShoppingCart.EmailValues.RemainingVolume = string.Empty;
            //ShoppingCart.SelectedDSSubType = orderSubType;

            PurchasingLimits_V01 limits = PurchasingLimitProvider.GetPurchasingLimits(DistributorID, orderSubType);
            decimal cartVolume          = 0M;

            if (null != limits)
            {
                if (FOPEnabled)
                {
                    if (limits.PurchaseLimitType == PurchaseLimitType.TotalPaid)
                    {
                        cartVolume = TotalsExcludeAPF(ShoppingCart, this.CountryCode);
                        lblRemainingValDisplay.Text = GetLocalResourceObject("RemainingAmount").ToString();
                    }
                    else
                    {
                        cartVolume = (limits.LimitsRestrictionType == LimitsRestrictionType.PurchasingLimits) ? ShoppingCart.ProductPromoVolumeInCart : ShoppingCart.VolumeInCart;
                    }
                }
                else
                {
                    var purchasingLimitManager = PurchasingLimitManager(this.DistributorID);
                    cartVolume = (purchasingLimitManager.PurchasingLimitsRestriction == PurchasingLimitRestrictionType.MarketingPlan) ? ShoppingCart.VolumeInCart : ShoppingCart.ProductVolumeInCart;
                }
                decimal remaining = (limits.RemainingVolume - cartVolume);

                if (remaining < 0)
                {
                    remaining = 0;
                }

                if (limits.PurchaseLimitType == PurchaseLimitType.Volume)
                {
                    lblRemainingVal.Text = ProductsBase.GetVolumePointsFormat(remaining);
                }
                //else
                //{
                //    lblRemainingVal.Text = ProductsBase.getAmountString(remaining);
                //}
            }

            if (PurchasingLimitProvider.DisplayLimits(DistributorID, CountryCode))
            {
                if (HasMemberVPLimitations())
                {
                    trRemainingVal.Visible = null != limits ? true : false;
                    //trRemainingVal.Visible = null != limits &&
                    //                         (limits.PurchaseLimitType == PurchaseLimitType.Earnings ||
                    //                          limits.PurchaseLimitType == PurchaseLimitType.Volume ||
                    //                          limits.PurchaseLimitType == PurchaseLimitType.TotalPaid);
                    PurchaseLimitType limitType = PurchaseLimitType.Volume;
                    limits.PurchaseLimitType = limitType;
                }
                else
                {
                    if (limits.LimitsRestrictionType == LimitsRestrictionType.FOP)
                    {
                        trRemainingVal.Visible = null != limits ? true : false; //Show remaining VP when FOP regardless of Limitations
                    }
                    else
                    {
                        trRemainingVal.Visible = false;
                    }
                }
            }
            else
            {
                trRemainingVal.Visible = false;
            }

            if (trRemainingVal.Visible)
            {
                ShoppingCart.EmailValues.RemainingVolume = lblRemainingVal.Text;
            }
        }
Exemple #2
0
        private void DisplayRemaining()
        {
            string DSType = ProductsBase.LevelSubType;

            ShoppingCart.EmailValues.RemainingVolume = string.Empty;

            PurchasingLimits_V01 limits = PurchasingLimitProvider.GetPurchasingLimits(DistributorID, DSType);

            ShoppingCart.SelectedDSSubType = !countries.Trim().Contains(Locale.Substring(3)) ? DSType : "";
            //var purchasingLimitManager = PurchasingLimitManager(this.DistributorID);
            //decimal cartVolume = (purchasingLimitManager.PurchasingLimitsRestriction == PurchasingLimitRestrictionType.MarketingPlan) ? ShoppingCart.VolumeInCart : ShoppingCart.ProductVolumeInCart;
            decimal cartVolume = 0M;

            if (null != limits)
            {
                if (FOPEnabled)
                {
                    if (limits.PurchaseLimitType == PurchaseLimitType.TotalPaid)
                    {
                        cartVolume = TotalsExcludeAPF(ShoppingCart, this.CountryCode);
                        lblRemainingValDisplay.Text = GetLocalResourceObject("RemainingAmount").ToString();
                    }
                    else
                    {
                        cartVolume = (limits.LimitsRestrictionType == LimitsRestrictionType.PurchasingLimits) ? ShoppingCart.ProductPromoVolumeInCart : ShoppingCart.VolumeInCart;
                    }
                }
                else
                {
                    var purchasingLimitManager = PurchasingLimitManager(this.DistributorID);
                    cartVolume = (purchasingLimitManager.PurchasingLimitsRestriction == PurchasingLimitRestrictionType.MarketingPlan) ? ShoppingCart.VolumeInCart : ShoppingCart.ProductVolumeInCart;
                }
                decimal remaining = (limits.RemainingVolume - cartVolume);

                if (remaining < 0)
                {
                    remaining = 0;
                }

                if (limits.PurchaseLimitType == PurchaseLimitType.Volume)
                {
                    lblRemainingVal.Text = ProductsBase.GetVolumePointsFormat(remaining);
                }
                else
                {
                    lblRemainingVal.Text = ProductsBase.getAmountString(remaining);
                }
            }

            if (PurchasingLimitProvider.DisplayLimits(DistributorID, CountryCode))
            {
                trRemainingVal.Visible = null != limits &&
                                         (limits.PurchaseLimitType == PurchaseLimitType.Earnings ||
                                          limits.PurchaseLimitType == PurchaseLimitType.Volume ||
                                          limits.PurchaseLimitType == PurchaseLimitType.TotalPaid);
            }
            else
            {
                trRemainingVal.Visible = false;
            }

            if (trRemainingVal.Visible)
            {
                ShoppingCart.EmailValues.RemainingVolume = lblRemainingVal.Text;
            }
        }