Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OrderMonth.RegisterOrderMonthControls(pnlOrderMonth, lblOrderMonthChanged, ProductsBase.IsEventTicketMode,
                                                  pnlOrderMonthLabel);

            string levelDSType = (Page as ProductsBase).Level;

            if (levelDSType == "DS")
            {
                imgOrderMonth.Visible = true;
            }
            else
            {
                imgOrderMonth.Visible = false;
            }
            var control = loadPurchasingLimitsControl(false);

            if (control != null)
            {
                pnlPurchaseLimits.Visible = true;
                pnlPurchaseLimits.Controls.Add(control);
            }
            if (!IsPostBack)
            {
                if (null != ProductsBase.SessionInfo && ProductsBase.SessionInfo.IsEventTicketMode)
                {
                    divDiscountRate.Visible = false;
                }

                BindTotals();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Set the default month when dual.
        /// </summary>
        public static void SetDefaultMonth()
        {
            var orderMonth = new OrderMonth(StaticLocale.Substring(3));

            if (orderMonth.IsDualOrderMonth && HLConfigManager.Configurations.DOConfiguration.OrderMonthEnabled)
            {
                orderMonth.CurrentChosenOrderMonth =
                    OrderMonth.DualOrderMonthSelection.Previous;
            }
        }
        public static bool checkVolumeLimits(MyHLShoppingCart cart, ref decimal previousVolumePoints, ShoppingCartRuleResult Result, PurchasingLimits_V01 currentLimits, string Locale, string Country, ShoppingCartItem_V01 currentItem)
        {
            decimal DistributorRemainingVolumePoints = 0;
            decimal NewVolumePoints = 0;

            if (currentLimits.PurchaseLimitType == PurchaseLimitType.None || currentLimits.LimitsRestrictionType != LimitsRestrictionType.PurchasingLimits)
            {
                return(true);
            }
            if (null == currentLimits)
            {
                return(false);
            }

            DistributorRemainingVolumePoints = currentLimits.RemainingVolume;

            var current = CatalogProvider.GetCatalogItem(currentItem.SKU, Country);

            if (current != null)
            {
                NewVolumePoints = current.VolumePoints * currentItem.Quantity;
            }

            if (NewVolumePoints > 0)
            {
                if (currentLimits.maxVolumeLimit == -1)
                {
                    return(true);
                }
                decimal cartVolume = cart.VolumeInCart + previousVolumePoints;
                previousVolumePoints += NewVolumePoints;

                if (DistributorRemainingVolumePoints - (cartVolume + NewVolumePoints) < 0)
                {
                    Result.Result = RulesResult.Failure;
                    var orderMonth = new OrderMonth(Country);
                    var msg        = HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform) ?? string.Empty, "VolumePointExceedsOnOrderMonth") as string;
                    msg = string.Format(msg, orderMonth.CurrentOrderMonth.ToString("MM-yyyy"), DistributorRemainingVolumePoints);
                    Result.AddMessage(msg);
                    cart.RuleResults.Add(Result);
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
        protected string GetOrderMonthString()
        {
            SessionInfo currentSession = SessionInfo;
            var         orderMonth     = new OrderMonth(CountryCode);

            if (null != currentSession)
            {
                if (!string.IsNullOrEmpty(currentSession.OrderMonthString))
                {
                    return(currentSession.OrderMonthString);
                }
                else
                {
                    return(orderMonth.OrderMonthString);
                }
            }
            else
            {
                return(orderMonth.OrderMonthString);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var PLControl = loadPurchasingLimitsControl(false) as PurchasingLimits_IT;

            if (PLControl != null)
            {
                if (ShoppingCart.IsSavedCart || ShoppingCart.IsFromCopy)
                {
                    PLControl.HideEmptyListItem = false;
                }
                pnlPurchaseLimits.Controls.Add(PLControl);
            }
            _shoppingCart = (Page as ProductsBase).ShoppingCart;
            //purchasingLimits = HL.MyHerbalife.Providers.PurchasingLimitProvider.GetPurchasingLimits(DistributorID, user.Value.DSSubType);
            OrderMonth.RegisterOrderMonthControls(pnlOrderMonth, lblOrderMonthChanged, ProductsBase.IsEventTicketMode,
                                                  pnlOrderMonthLabel);
            BindTotals();
            if (_shoppingCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.ETO ||
                !HLConfigManager.Configurations.CheckoutConfiguration.HasEarnBase)
            {
                trEarnBase.Visible = false;
            }
            string levelDSType = (Page as ProductsBase).Level;

            if (levelDSType == "DS")
            {
                imgOrderMonth.Visible = true;
            }
            else
            {
                imgOrderMonth.Visible = false;
            }

            if (imgEarnBase != null)
            {
                imgEarnBase.Visible = CheckoutTotalsDetailed.ShowEarnBaseHelpInfo();
            }
        }
        private string BuildInfo(string transactionType)
        {
            decimal          taxBrazil = 0.90m;
            MyHLShoppingCart myCart;
            SessionInfo      sessionInfoMyCart = SessionInfo.GetSessionInfo(this._distributorId, this._locale);

            myCart = sessionInfoMyCart.ShoppingCart;
            if (myCart == null)
            {
                myCart = ShoppingCartProvider.GetShoppingCart(this._distributorId, this._locale);
            }
            string DistributorName = DistributorProfileModelHelper.DistributorName(DistributorProfileModel);

            InstallmentConfiguration _installmentsConfiguration;
            DateTime   currentDate;
            OrderMonth orderMonth = new OrderMonth(myCart.CountryCode);

            currentDate = orderMonth.CurrentOrderMonth;

            var orderType = "RSO";

            if (myCart.OrderCategory == OrderCategoryType.ETO)
            {
                orderType = "ETO";
            }
            else if (myCart.OrderCategory == OrderCategoryType.APF)
            {
                orderType = "APF";
            }
            _installmentsConfiguration = InstallmentsProvider.GetInstallmentsConfiguration(myCart.CountryCode, new DateTime(currentDate.Year, currentDate.Month, 1), orderType);

            if (_installmentsConfiguration == null)
            {
                DateTime today = DateTime.Today;
                currentDate = new DateTime(today.Year, today.Month, 1).AddMonths(1).AddDays(-1);
            }

            string paymentCode = _configHelper.GetConfigEntry("paymentCode");

            string data;

            data = "VENDAID=" + this.OrderNumber + "@";
            data = data + "VALOR=" + ((null != myCart.Totals ? _orderAmount : 0) + taxBrazil) + "@";
            data = data + "NOME=" + (null != DistributorName ? DistributorName : string.Empty) + "@";
            data = data + "CODPAGAMENTO=" + paymentCode + "@";
            data = data + "LOGRADOURO=" + (null != myCart.DeliveryInfo.Address.Address.Line1 ? myCart.DeliveryInfo.Address.Address.Line1 : string.Empty) + "@";
            data = data + "BAIRRO=" + (null != myCart.DeliveryInfo.Address.Address.Line2 ? myCart.DeliveryInfo.Address.Address.Line2 : string.Empty) + "@";
            data = data + "CIDADE=" + (null != myCart.DeliveryInfo.Address.Address.City ? myCart.DeliveryInfo.Address.Address.City : string.Empty) + "@";
            data = data + "ESTADO=" + (null != myCart.DeliveryInfo.Address.Address.StateProvinceTerritory ? myCart.DeliveryInfo.Address.Address.StateProvinceTerritory : string.Empty) + "@";
            data = data + "CEP=" + (null != myCart.DeliveryInfo.Address.Address.PostalCode ? myCart.DeliveryInfo.Address.Address.PostalCode : string.Empty) + "@";
            data = data + "INSTRUCOES=" + "Nao aceitar este boleto apos a data de vencimento # ** Tarifa Bancaria:R$ 0,90 # ** Valor da Nota Fiscal: " + _orderAmount + "@";
            data = data + "EXTRA=" + (null != myCart.DistributorID ? myCart.DistributorID : string.Empty) + "@";
            data = data + "PAIS=BRAZIL@";
            data = data + "NOSSONUMERO=" + (null != this.OrderNumber ? this.OrderNumber.Remove(0, 2) : string.Empty) + "@";
            data = data + "DATAVENCIMENTO=" + (_installmentsConfiguration == null ? currentDate.ToString("MM-dd-yyyy") : _installmentsConfiguration.TicketDueDate.ToString("yyyy-MM-dd")) + "@";
            data = data + "TRANSACTIONCURRENCY=BRL@";
            data = data + "TRANSACTIONCOUNTRY=BRA@";
            data = data + "TRANSACTIONTYPE=" + transactionType;

            return(data);
        }
        public ShoppingCartRuleResult checkVolumeLimits(MyHLShoppingCart cart, ShoppingCartRuleResult Result, string Locale, string Country)
        {
            decimal DistributorRemainingVolumePoints = 0;
            decimal NewVolumePoints = 0;

            IPurchasingLimitManagerFactory purchasingLimitManagerFactory = new PurchasingLimitManagerFactory();
            var purchasingLimitManager = purchasingLimitManagerFactory.GetPurchasingLimitManager(cart.DistributorID);

            var purchasingLimits =
                PurchasingLimitProvider.GetCurrentPurchasingLimits(cart.DistributorID);

            if (null == purchasingLimits)
            {
                LoggerHelper.Error(
                    string.Format("{0} PurchasingLimits could not be retrieved for distributor in checkVolumeLimits {1}", Locale,
                                  cart.DistributorID));
                Result.Result = RulesResult.Failure;
                return(Result);
            }

            purchasingLimitManager.SetPurchasingLimits(purchasingLimits);

            DistributorRemainingVolumePoints = purchasingLimits.RemainingVolume;

            var currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country);

            if (currentItem != null)
            {
                if (currentItem.ProductType == ServiceProvider.CatalogSvc.ProductType.EventTicket)
                {
                    PurchasingLimitProvider.GetPurchasingLimits(cart.DistributorID, "ETO");
                }
                else
                {
                    NewVolumePoints = currentItem.VolumePoints * cart.CurrentItems[0].Quantity;
                }
            }

            if (NewVolumePoints > 0)
            {
                if (purchasingLimits.maxVolumeLimit == -1)
                {
                    return(Result);
                }
                decimal cartVolume = cart.VolumeInCart;

                if (DistributorRemainingVolumePoints - (cartVolume + NewVolumePoints) < 0)
                {
                    Result.Result = RulesResult.Failure;
                    var orderMonth = new OrderMonth(Country);
                    var msg        = HttpContext.GetGlobalResourceObject(string.Format("{0}_Rules", HLConfigManager.Platform) ?? string.Empty, "VolumePointExceedsOnOrderMonth") as string;
                    msg = string.Format(msg, orderMonth.CurrentOrderMonth.ToString("MM-yyyy"), DistributorRemainingVolumePoints);
                    Result.AddMessage(msg);
                    var globalResourceObject =
                        HttpContext.GetGlobalResourceObject(
                            string.Format("{0}_Rules", HLConfigManager.Platform),
                            "DisgardCommonMessage");
                    if (globalResourceObject != null)
                    {
                        Result.AddMessage(globalResourceObject.ToString());
                    }
                    cart.RuleResults.Add(Result);
                }
            }
            return(Result);
        }
        protected virtual void BindTotals()
        {
            List <DistributorShoppingCartItem> lstShoppingCartItems =
                (Page as ProductsBase).ShoppingCart.ShoppingCartItems;

            try
            {
                if ((HLConfigManager.Configurations.DOConfiguration.CalculateWithoutItems &&
                     _shoppingCart.Totals != null &&
                     (_shoppingCart.Totals as OrderTotals_V01).AmountDue != decimal.Zero) || (lstShoppingCartItems.Count > 0 && ShoppingCart.Totals != null))
                {
                    OrderTotals_V01 totals = ShoppingCart.Totals as OrderTotals_V01;

                    lblDiscountRate.Text = _shoppingCart.Totals == null
                                               ? "0%"
                                               : ((_shoppingCart.Totals as OrderTotals_V01).DiscountPercentage).ToString() + "%";
                    _shoppingCart.EmailValues.DistributorSubTotal          = OrderProvider.GetDistributorSubTotal(_shoppingCart.Totals as OrderTotals_V01);
                    _shoppingCart.EmailValues.DistributorSubTotalFormatted = getAmountString(_shoppingCart.EmailValues.DistributorSubTotal);
                    lblDistributorSubtotal.Text = _shoppingCart.EmailValues.DistributorSubTotalFormatted;
                    lblEarnBase.Text            = getAmountString(GetTotalEarnBase(lstShoppingCartItems));
                    if (lblDiscountTotal != null)
                    {
                        lblDiscountTotal.Text =
                            getAmountString(CheckoutTotalsDetailed.GetDiscountTotal(lstShoppingCartItems));
                    }
                    if (IsChina && (DistributorOrderingProfile.IsPC || (ShoppingCart.OrderCategory == OrderCategoryType.ETO && SessionInfo != null && !SessionInfo.IsReplacedPcOrder)))
                    {
                        lblPCLearningPointAmount.Text = getAmountString(_shoppingCart.pcLearningPointOffSet);
                    }
                    // added for China DO
                    if (HLConfigManager.Configurations.CheckoutConfiguration.HasDiscountAmount)
                    {
                        OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                        if (totals_V02 != null)
                        {
                            HLRulesManager.Manager.PerformDiscountRules(_shoppingCart, null, Locale,
                                                                        ShoppingCartRuleReason.CartCalculated);
                            lblDiscountAmount.Text = getAmountString(totals_V02.DiscountAmount);
                            trDiscountRate.Visible = false;
                        }
                    }
                    if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU)
                    {
                        if (trDonationAmount != null)
                        {
                            trDonationAmount.Visible = true;
                            OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                            if (totals_V02 != null)
                            {
                                lblDonationAmount.Text = getAmountString(totals_V02.Donation);
                            }
                        }
                    }
                    if (ProductsBase.IsEventTicketMode)
                    {
                        var orderMonthShortString = string.Empty;
                        var ordermonth            = OrderMonth.DualOrderMonthForEventTicket(true, out orderMonthShortString); // dual ordermonth should be desable for ETO
                        lblOrderMonth.Text = string.IsNullOrWhiteSpace(ordermonth) ? GetOrderMonthString() : ordermonth;
                        var currentSession = SessionInfo;

                        if (null != currentSession && !string.IsNullOrWhiteSpace(orderMonthShortString))
                        {
                            currentSession.OrderMonthString      = ordermonth;
                            currentSession.OrderMonthShortString = orderMonthShortString;
                        }
                    }
                    else
                    {
                        lblOrderMonth.Text = GetOrderMonthString();
                    }

                    decimal currentMonthVolume = 0;
                    if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayFormatNeedsDecimal)
                    {
                        lblOrderMonthVolume.Text = decimal.TryParse(ProductsBase.CurrentMonthVolume, NumberStyles.Any, CultureInfo.InstalledUICulture, out currentMonthVolume)
                            ? ProductsBase.GetVolumePointsFormat(currentMonthVolume) :
                                                   (Page as ProductsBase).CurrentMonthVolume;
                    }
                    else
                    {
                        lblOrderMonthVolume.Text = (Page as ProductsBase).CurrentMonthVolume;
                    }

                    Charge_V01 otherCharges =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.OTHER); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.OTHER, (decimal)0.0);
                    Charge_V01 pHCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.PH); }) as Charge_V01 ??
                        new Charge_V01(ChargeTypes.PH, (decimal)0.0);
                    Charge_V01 freightCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.FREIGHT); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.FREIGHT, (decimal)0.0);
                    Charge_V01 localTaxCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOCALTAX); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.LOCALTAX, (decimal)0.0);
                    lblOtherCharges.Text = getAmountString(otherCharges.Amount);
                    lblLocalTax.Text     = getAmountString(localTaxCharge.Amount);
                    Charge_V01 logisticCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOGISTICS_CHARGE); })
                        as Charge_V01 ?? new Charge_V01(ChargeTypes.LOGISTICS_CHARGE, (decimal)0.0);
                    lblLogisticCharges.Text = getAmountString(logisticCharge.Amount);
                    lblPackageHandling.Text = getAmountString(pHCharge.Amount);
                    lblShippingCharges.Text = getAmountString(freightCharge.Amount);
                    lblRetailPrice.Text     = getAmountString(totals.ItemsTotal);
                    lblTaxVAT.Text          = getAmountString(totals.TaxAmount);
                    if (lblSubtotal != null)
                    {
                        lblSubtotal.Text = getAmountString(logisticCharge.Amount);
                    }
                    if (lblAdditionalDiscount != null)
                    {
                        lblAdditionalDiscount.Text = getAmountString(otherCharges.Amount);
                    }
                    lblVolumePoints.Text = ProductsBase.GetVolumePointsFormat(totals.VolumePoints);

                    //added for HR
                    if (HLConfigManager.Configurations.CheckoutConfiguration.MergePHAndShippingCharges)
                    {
                        decimal phShippingCharges = pHCharge.Amount + freightCharge.Amount;
                        lblPackageHandling.Text = getAmountString(phShippingCharges);
                    }

                    if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayWeight && !SessionInfo.IsEventTicketMode && lblWeight != null)
                    {
                        lblWeight.Text = ShoppingCartProvider.GetWeight(ShoppingCart);
                    }
                }
                else
                {
                    if (HLConfigManager.Configurations.DOConfiguration.DonationWithoutSKU)
                    {
                        if (trDonationAmount != null)
                        {
                            trDonationAmount.Visible = true;
                            OrderTotals_V02 totals_V02 = ShoppingCart.Totals as OrderTotals_V02;
                            if (totals_V02 != null)
                            {
                                lblDonationAmount.Text = getAmountString(totals_V02.Donation);
                            }
                        }
                    }

                    DisplayEmptyLabels();
                }
            }
            catch (Exception ex)
            {
                //Log Exception
                LoggerHelper.Error("Exception while displaying totals - " + ex);
                DisplayEmptyLabels();
            }
        }
 public int GetCurrentOrderMonth()
 {
     return(200000 + OrderMonth.GetCurrentOrderMonth());
 }
Ejemplo n.º 10
0
        /// <summary>
        ///     The IShoppingCart Rule Interface implementation
        /// </summary>
        /// <param name="cart">The current Shopping Cart</param>
        /// <param name="reason">The Rule invoke Reason</param>
        /// <param name="Result">The Rule Results collection</param>
        /// <returns>The cumulative rule results - including the results of this iteration</returns>
        protected override ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart,
                                                               ShoppingCartRuleReason reason,
                                                               ShoppingCartRuleResult Result)
        {
            if (reason == ShoppingCartRuleReason.CartItemsBeingAdded)
            {
                decimal DistributorRemainingVolumePoints = 0;
                decimal NewVolumePoints = 0;

                if (cart.CurrentItems == null || cart.CurrentItems.Count == 0)
                {
                    Result.Result = RulesResult.Failure;
                    return(Result);
                }

                var orderMonth = new OrderMonth(Country);

                PurchasingLimitManager(cart.DistributorID).SetPurchasingLimits(PurchasingLimitProvider.GetOrderMonth());

                var PurchasingLimits =
                    PurchasingLimitProvider.GetCurrentPurchasingLimits(cart.DistributorID);

                if (null == PurchasingLimits)
                {
                    LoggerHelper.Error(
                        string.Format("{0} PurchasingLimits could not be retrieved for distributor {1}", Locale,
                                      cart.DistributorID));
                    Result.Result = RulesResult.Failure;
                    return(Result);
                }

                DistributorRemainingVolumePoints = PurchasingLimits.RemainingVolume;
                var currentItem = CatalogProvider.GetCatalogItem(cart.CurrentItems[0].SKU, Country);
                if (currentItem != null)
                {
                    if (currentItem.ProductType == ServiceProvider.CatalogSvc.ProductType.EventTicket)
                    {
                        PurchasingLimitProvider.GetPurchasingLimits(cart.DistributorID, "ETO");
                    }
                    else
                    {
                        NewVolumePoints = currentItem.VolumePoints * cart.CurrentItems[0].Quantity;
                    }
                }

                // validate order threshold first
                if (PurchasingLimits.maxVolumeLimit == -1)
                {
                    return(Result);
                }

                if (PurchasingLimits.PurchaseLimitType == PurchaseLimitType.ProductCategory && currentItem.ProductType == ServiceProvider.CatalogSvc.ProductType.Product)
                {
                    Result.Result = RulesResult.Failure;
                    Result.AddMessage(
                        string.Format(
                            HttpContext.GetGlobalResourceObject(
                                string.Format("{0}_Rules", HLConfigManager.Platform),
                                "PurchaseLimitTypeProductCategory") as string ?? string.Empty,
                            cart.CurrentItems[0].SKU));
                    cart.RuleResults.Add(Result);
                    return(Result);
                }

                // validate against order threshold first
                decimal cartVolume = (cart as MyHLShoppingCart).VolumeInCart;
                if (PurchasingLimitProvider.IsOrderThresholdMaxVolume(PurchasingLimits) ||
                    PurchasingLimits.PurchaseLimitType != PurchaseLimitType.None)
                {
                    if (DistributorRemainingVolumePoints - (cartVolume + NewVolumePoints) < 0)
                    {
                        Result.Result = RulesResult.Failure;

                        string message = string.Empty;

                        if (cart.CartItems.Exists(item => item.SKU == cart.CurrentItems[0].SKU))
                        {
                            Result.Messages.Add(
                                string.Format(
                                    HttpContext.GetGlobalResourceObject(
                                        string.Format("{0}_Rules", HLConfigManager.Platform),
                                        "VolumePointExceedsThresholdByIncreasingQuantity") as string ?? string.Empty,
                                    cart.CurrentItems[0].SKU, cart.CurrentItems[0].Quantity));
                        }
                        else
                        {
                            Result.Messages.Add(
                                string.Format(
                                    HttpContext.GetGlobalResourceObject(
                                        string.Format("{0}_Rules", HLConfigManager.Platform),
                                        "VolumePointExceedsThreshold") as string ?? string.Empty, cart.CurrentItems[0].SKU));
                        }

                        if (Result.Messages.Any())
                        {
                            cart.RuleResults.Add(Result);
                        }
                        else
                        {
                            Result.Result = RulesResult.Success;
                        }

                        return(Result); // if fails, just return
                    }
                }

                if (PurchasingLimits.PurchaseLimitType == PurchaseLimitType.ProductCategory)
                {
                    if (DistributorRemainingVolumePoints -
                        ((cart as MyHLShoppingCart).VolumeInCart + NewVolumePoints) < 0)
                    {
                        Result.Result = RulesResult.Failure;
                        if (cart.CartItems.Exists(item => item.SKU == cart.CurrentItems[0].SKU))
                        {
                            Result.AddMessage(
                                string.Format(
                                    HttpContext.GetGlobalResourceObject(
                                        string.Format("{0}_Rules", HLConfigManager.Platform),
                                        "VolumePointExceedsThresholdByIncreasingQuantity") as string ?? string.Empty,
                                    cart.CurrentItems[0].SKU, cart.CurrentItems[0].Quantity));
                        }
                        else
                        {
                            Result.AddMessage(
                                string.Format(
                                    HttpContext.GetGlobalResourceObject(
                                        string.Format("{0}_Rules", HLConfigManager.Platform),
                                        "VolumePointExceedsThreshold") as string ?? string.Empty, cart.CurrentItems[0].SKU));
                        }
                    }
                }
                else
                {
                    Result.Result = RulesResult.Success;
                }
            }
            return(Result);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string Locale = CultureInfo.CurrentCulture.Name;

            _country = Locale.Substring(3, 2);

            MembershipUser <DistributorProfileModel> member = null;

            var    memberDefault = Membership.GetUser();
            string DistributorID = string.Empty;

            try
            {
                member        = (MembershipUser <DistributorProfileModel>)memberDefault;
                DistributorID = (member != null && member.Value != null) ? member.Value.Id : string.Empty;
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(string.Format("PaymentGatewayManager Null member cast failed : {0} ", ex.Message));
            }

            if (!string.IsNullOrEmpty(DistributorID))
            {
                _sessionInfo = SessionInfo.GetSessionInfo(DistributorID, Locale);
            }

            if (!IsPostBack)
            {
                ProductsBase.RemoveDupCheckCookie();
                (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageResource1.Title") as string);
                PaymentGatewayResponse gatewayResponse = null;
                try
                {
                    gatewayResponse = PaymentGatewayResponse.Create();
                    if (null != gatewayResponse)
                    {
                        LoggerHelper.Warn(string.Format("PaymentGatewayRequest Splunk Log : Request {0}", LogFormData(Request.Form)));
                    }
                }
                catch (Exception ex)
                {
                    LoggerHelper.Error(string.Format("PaymentGatewayManager failed to create a Response: {0}", ex.Message));
                }

                if (gatewayResponse == null)
                {
                    MyHLShoppingCart ShoppingCart = (null != this._sessionInfo && null != this._sessionInfo.ShoppingCart) ? this._sessionInfo.ShoppingCart : ShoppingCartProvider.GetShoppingCart(DistributorID, Locale);
                    if (ShoppingCart != null)
                    {
                        try
                        {
                            PaymentGatewayInvoker invoker = PaymentGatewayInvoker.Create(HLConfigManager.Configurations.PaymentsConfiguration.PaymentGatewayPaymentMethods, (ShoppingCart.Totals as OrderTotals_V01).AmountDue);
                            invoker.Submit();
                        }
                        catch (ThreadAbortException)
                        {
                            //this just seems to come along with the redirect request. We don't want this in the logs
                        }
                        catch (Exception ex)
                        {
                            PaymentGatewayInvoker.LogBlindError(string.Format("Error occurred Invoking Payment Gateway {0}. The error is: {1}", HLConfigManager.Configurations.PaymentsConfiguration.PaymentGatewayInvoker, ex.Message));
                            if (HLConfigManager.Configurations.DOConfiguration.IsChina && _sessionInfo.StandAloneDonationError == standAloneDonation)
                            {
                                _sessionInfo.StandAloneDonationError = standAloneDonationerror;
                                Response.Redirect("~/Ordering/Donation.aspx");
                            }
                            else
                            {
                                Response.Redirect("~/Ordering/Checkout.aspx");
                            }
                        }
                    }
                }
                else
                {
                    if (gatewayResponse is PGHPaymentGatewayResponse && _sessionInfo != null)
                    {
                        Session[PaymentGatewayResponse.PGH_FPX_PaymentStatus] =
                            ((PGHPaymentGatewayResponse)gatewayResponse).PhgPaymentStatus;
                    }

                    if (gatewayResponse.IsReturning)
                    {
                        bool pending   = gatewayResponse.IsPendingTransaction;
                        bool cancelled = gatewayResponse.IsCancelled;
                        PaymentGatewayRecordStatusType gatewayResponseStatus = gatewayResponse.Status;
                        if (gatewayResponse.IsApproved)
                        {
                            if (!gatewayResponse.CanSubmitIfApproved && _sessionInfo != null)
                            {
                                _sessionInfo.OrderStatus = SubmitOrderStatus.OrderSubmitted;
                                _sessionInfo.OrderNumber = gatewayResponse.OrderNumber;
                                if (_sessionInfo.ShoppingCart != null)
                                {
                                    ShoppingCartProvider.UpdateShoppingCart(_sessionInfo.ShoppingCart,
                                                                            string.Empty,
                                                                            gatewayResponse.OrderNumber, DateTime.Now);
                                }
                                return;
                            }
                        }

                        if (gatewayResponseStatus == PaymentGatewayRecordStatusType.OrderSubmitted && _sessionInfo != null)
                        {
                            _sessionInfo.OrderStatus = SubmitOrderStatus.OrderSubmitted;
                            _sessionInfo.OrderNumber = gatewayResponse.OrderNumber;
                            ShoppingCartProvider.UpdateShoppingCart(_sessionInfo.ShoppingCart,
                                                                    string.Empty,
                                                                    gatewayResponse.OrderNumber, DateTime.Now);
                            return;
                        }
                        else if (pending && _sessionInfo != null)
                        {
                            _sessionInfo.OrderStatus = SubmitOrderStatus.Unknown;
                            if (_sessionInfo.ShoppingCart != null)
                            {
                                _sessionInfo.ShoppingCart.CloseCart();
                            }
                            Response.Redirect("~/Ordering/Catalog.aspx?ETO=FALSE");
                            return;
                        }
                        else if (cancelled && _sessionInfo != null)
                        {
                            _sessionInfo.OrderStatus = SubmitOrderStatus.Unknown;
                            Response.Redirect("~/Ordering/Checkout.aspx");
                            return;
                        }
                        else if (gatewayResponse.IsApproved)
                        {
                            //Let it fall through the natural flow...
                        }
                        else if (gatewayResponseStatus == PaymentGatewayRecordStatusType.Declined)
                        {
                            Session[PaymentGatewayResponse.PaymentGateWateSessionKey] = gatewayResponse;
                            if (HLConfigManager.Configurations.DOConfiguration.IsChina && _sessionInfo.StandAloneDonationError == standAloneDonation)
                            {
                                _sessionInfo.StandAloneDonationError = standAloneDonationerror;
                                Response.Redirect("~/Ordering/Donation.aspx");
                            }
                            else
                            {
                                if (_sessionInfo != null)
                                {
                                    _sessionInfo.OrderStatus = SubmitOrderStatus.OrderSubmitFailed;
                                    _sessionInfo.OrderNumber = gatewayResponse.OrderNumber;
                                }
                                Response.Redirect("~/Ordering/Checkout.aspx");
                            }

                            return;
                        }
                        else
                        {
                            if (_sessionInfo != null)
                            {
                                _sessionInfo.OrderStatus = SubmitOrderStatus.OrderSubmitFailed;
                                return;
                            }
                        }
                    }

                    //For PGH-Submitted orders
                    if (gatewayResponse is PGHPaymentGatewayResponse)
                    {
                        if (gatewayResponse.Status == PaymentGatewayRecordStatusType.OrderSubmitted && _sessionInfo != null)
                        {
                            // Timer1.Enabled = false;
                            _sessionInfo.OrderStatus = SubmitOrderStatus.OrderSubmitted;
                            _sessionInfo.OrderNumber = gatewayResponse.OrderNumber;
                            return;
                        }
                    }

                    if (member == null || member.Value == null) //Being posted to by a gateway
                    {
                        offLinePost     = true;
                        Timer1.Enabled  = false;
                        _customResponse = gatewayResponse.SpecialResponse;
                        bool approved = gatewayResponse.IsApproved;
                        if (approved)
                        {
                            if (gatewayResponse.CanSubmitIfApproved)
                            {
                                SubmitOrder(gatewayResponse);
                            }

                            return;
                        }
                    }

                    string orderNumber = gatewayResponse.OrderNumber;
                    if (null != _sessionInfo)
                    {
                        if (_sessionInfo.OrderStatus == SubmitOrderStatus.OrderSubmitted && orderNumber != _sessionInfo.OrderNumber)
                        {
                            _sessionInfo.OrderStatus = SubmitOrderStatus.Unknown;
                        }
                        if (_sessionInfo.OrderStatus == SubmitOrderStatus.Unknown)
                        {
                            if (gatewayResponse.IsApproved && gatewayResponse.CanSubmitIfApproved)
                            {
                                _sessionInfo.OrderStatus = SubmitOrderStatus.OrderBeingSubmitted;
                                if (string.IsNullOrEmpty(_sessionInfo.OrderMonthShortString))
                                {
                                    var orderMonth = new OrderMonth(_country);
                                    //orderMonth.ResolveOrderMonth();
                                    _sessionInfo.OrderMonthShortString = orderMonth.OrderMonthShortString;
                                    _sessionInfo.OrderMonthString      = orderMonth.OrderMonthString;
                                }
                                if (null == _sessionInfo.ShoppingCart)
                                {
                                    _sessionInfo.ShoppingCart = ShoppingCartProvider.GetShoppingCart(DistributorID, Locale);
                                }

                                (new AsyncSubmitOrderProvider()).AsyncSubmitOrder(gatewayResponse, _country, _sessionInfo);
                            }
                            else
                            {
                                if (gatewayResponse.Status == PaymentGatewayRecordStatusType.ApprovalPending && HLConfigManager.Configurations.PaymentsConfiguration.CanSubmitPending)
                                {
                                    if (null != gatewayResponse as PGHPaymentGatewayResponse)
                                    {
                                        if ((gatewayResponse as PGHPaymentGatewayResponse).OrderStatus == HL.PGH.Api.OrderStatus.GatewayWillSubmit)
                                        {
                                            _sessionInfo.OrderStatus = SubmitOrderStatus.OrderSubmittedProcessing;
                                            Response.Redirect("~/Ordering/Confirm.aspx?OrderNumber=" + orderNumber);
                                            return;
                                        }
                                    }
                                    _sessionInfo.OrderStatus = SubmitOrderStatus.OrderBeingSubmitted;
                                    if (string.IsNullOrEmpty(_sessionInfo.OrderMonthShortString))
                                    {
                                        var orderMonth = new OrderMonth(_country);
                                        _sessionInfo.OrderMonthShortString = orderMonth.OrderMonthShortString;
                                        _sessionInfo.OrderMonthString      = orderMonth.OrderMonthString;
                                    }
                                    if (null == _sessionInfo.ShoppingCart)
                                    {
                                        _sessionInfo.ShoppingCart = ShoppingCartProvider.GetShoppingCart(DistributorID, Locale);
                                    }
                                    (new AsyncSubmitOrderProvider()).AsyncSubmitOrder(gatewayResponse, _country, _sessionInfo);
                                }
                                else
                                {
                                    Session[PaymentGatewayResponse.PaymentGateWateSessionKey] = gatewayResponse;
                                    if (HLConfigManager.Configurations.DOConfiguration.IsChina && _sessionInfo.StandAloneDonationError == standAloneDonation)
                                    {
                                        _sessionInfo.StandAloneDonationError = standAloneDonationerror;
                                        Response.Redirect("~/Ordering/Donation.aspx");
                                    }
                                    else
                                    {
                                        Response.Redirect("~/Ordering/Checkout.aspx");
                                    }
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        lbSubmitOrderStatus.Text = string.Format((string)GetLocalResourceObject("PaymentGatewayOrderSubmitFailed"), orderNumber);
                        if (gatewayResponse != null && !string.IsNullOrEmpty(orderNumber))
                        {
                            var status = OrderProvider.GetPaymentGatewayRecordStatus(orderNumber);
                            if (status == PaymentGatewayRecordStatusType.Approved || status == PaymentGatewayRecordStatusType.OrderSubmitted)
                            {
                                SettleCustomerOrderPayment(orderNumber);
                                Response.Redirect("~/Ordering/Confirm.aspx?OrderNumber=" + orderNumber);
                            }
                        }
                        lbSubmitOrderStatus.Style.Add(HtmlTextWriterStyle.Color, "Red");
                        Timer1.Enabled = false;
                    }
                }
            }
        }
Ejemplo n.º 12
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);
        }
        protected override void BindTotals()
        {
            var lstShoppingCartItems = (this.Page as ProductsBase).ShoppingCart.ShoppingCartItems;

            _shoppingCart = (this.Page as ProductsBase).ShoppingCart;
            try
            {
                if (lstShoppingCartItems.Count > 0 && _shoppingCart.Totals != null)
                {
                    OrderTotals_V01 totals = _shoppingCart.Totals as OrderTotals_V01;
                    lblDiscountRate.Text    = HLRulesManager.Manager.PerformDiscountRangeRules(_shoppingCart, Locale, ProductsBase.DistributorDiscount);
                    divDiscountRate.Visible = !string.IsNullOrEmpty(lblDiscountRate.Text);

                    if (ProductsBase.IsEventTicketMode)
                    {
                        var orderMonthShortString = string.Empty;
                        var ordermonth            = OrderMonth.DualOrderMonthForEventTicket(true, out orderMonthShortString); // dual ordermonth should be desable for ETO
                        lblOrderMonth.Text = string.IsNullOrWhiteSpace(ordermonth)?GetOrderMonthString():ordermonth;
                        var currentSession = SessionInfo;

                        if (null != currentSession && !string.IsNullOrWhiteSpace(orderMonthShortString))
                        {
                            currentSession.OrderMonthString      = ordermonth;
                            currentSession.OrderMonthShortString = orderMonthShortString;
                        }
                    }
                    else
                    {
                        lblOrderMonth.Text = GetOrderMonthString();
                    }
                    lblOrderMonthVolume.Text = (this.Page as ProductsBase).CurrentMonthVolume;
                    lblVolumePoints.Text     = totals.VolumePoints.ToString("N2");

                    Charge_V01 pHCharge = GetCharge(totals.ChargeList, ChargeTypes.PH);
                    lblPackageHandling.Text = getAmountString(pHCharge.Amount);
                    lblGrandTotal.Text      = getAmountString(totals.AmountDue);

                    // Brasil exclusive labels.
                    lblDiscountedProductRetail.Text    = getAmountString(totals.ProductRetailAmount);
                    lblDiscountedLiteratureRetail.Text = getAmountString(totals.LiteratureRetailAmount);
                    lblDiscountedPromoteRetail.Text    = getAmountString(totals.PromotionRetailAmount);

                    lblRetailPrice.Text = getAmountString(totals.ItemsTotal);

                    Charge_V01 freightCharge = GetCharge(totals.ChargeList, ChargeTypes.FREIGHT);
                    lblFreightCharges.Text = getAmountString(freightCharge.Amount);
                    lblICMS.Text           = getAmountString(totals.IcmsTax);
                    lblIPI.Text            = getAmountString(totals.IpiTax);
                    //lbSubtotal.Text = getAmountString(freightCharge.Amount + pHCharge.Amount+_shoppingCart.Totals.ProductRetailAmount + _shoppingCart.Totals.LiteratureRetailAmount + _shoppingCart.Totals.PromotionRetailAmount);
                }
                else
                {
                    DisplayEmptyLabels();
                }
            }
            catch (Exception ex)
            {
                //Log Exception
                LoggerHelper.Error("Exception while displaying totals - " + ex.ToString());
                DisplayEmptyLabels();
            }
        }
Ejemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string        cate     = "";
        List <string> lstMonth = new List <string>();

        for (int i = 5; i > -1; i--)
        {
            DateTime tmpDate = DateTime.Now.AddMonths(-i);
            cate += "'" + tmpDate.Month.ToString() + "/" + tmpDate.Year.ToString() + "',";
            lstMonth.Add(tmpDate.Month.ToString() + "/" + tmpDate.Year.ToString());
        }
        cate = cate.Substring(0, cate.Length - 1);
        OrderMonth objOrder = new OrderMonth();

        lstOrder = objOrder.Get();
        if (lstOrder == null)
        {
            return;
        }
        for (int i = 0; i < lstOrder.Count; i++)
        {
            if (!lstName.Contains(lstOrder[i].CompanyName))
            {
                lstName.Add(lstOrder[i].CompanyName);
            }
        }
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < lstName.Count; i++)
        {
            List <OrderMonth> lstTmp = new List <OrderMonth>();
            lstTmp = lstOrder.Where(o => o.CompanyName == lstName[i]).ToList();
            if (lstTmp != null)
            {
                sb.AppendLine("				{");
                sb.AppendLine("				name: '"+ lstName[i] + "',");
                sb.Append("				data: [");
                List <int> lstTemp = new List <int>()
                {
                    0, 0, 0, 0, 0, 0
                };
                for (int j = 0; j < lstTmp.Count; j++)
                {
                    int index = lstMonth.IndexOf(lstTmp[j].Month.ToString() + "/" + lstTmp[j].Year.ToString());
                    if (index > -1)
                    {
                        lstTemp[index] = lstTmp[j].TotalCnt;
                    }
                }
                sb.Append(string.Join(",", lstTemp));
                if (i == lstName.Count - 1)
                {
                    sb.AppendLine("]}");
                }
                else
                {
                    sb.AppendLine("]},");
                }
            }
        }
        string myScript = @"var cate = new Array(" + cate + @");
		Highcharts.chart('container', {
			chart: {
				type: 'column',
				width: 1100
			},
			title: {
				text: 'Biểu đồ vé các hãng hàng không theo tháng'
			},
			xAxis: {
				categories: cate
			},
			yAxis: {
				min:0,
				title: {
					text: 'Tổng số vé bán được'
				}
			},
			tooltip: {
				pointFormat: '<span style=""color:{series.color}"">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
				shared: true
			},
			plotOptions: {
				column: {
					stacking: 'percent'
				}
			},
			series: ["             + sb.ToString() + @"			]
		});"        ;

        Page.ClientScript.RegisterStartupScript(this.GetType(), "RegisterStartupScript", myScript, true);
        GrantChartPie(DateTime.Now.Year);
        GrantChartPie(DateTime.Now.AddYears(-1).Year);
    }
        //Name:GenerateXmlRequest
        //Description:Generate the xml file for the BankSlip Request
        //
        private string GenerateXmlRequest(string returnUrl, string key, string password)
        {
            InstallmentConfiguration _installmentsConfiguration;

            #region "create Skeleton"


            decimal taxBrazil = 0.90m;

            MyHLShoppingCart myCart;
            SessionInfo      sessionInfoMyCart = SessionInfo.GetSessionInfo(this._distributorId, this._locale);
            myCart = sessionInfoMyCart.ShoppingCart;
            if (myCart == null)
            {
                myCart = ShoppingCartProvider.GetShoppingCart(this._distributorId, this._locale);
            }

            // Create Skeleton
            XDocument    xmlToSend    = new XDocument();
            XDeclaration xDeclaration = new XDeclaration("1.0", "utf-8", "no");

            XNamespace aw  = "http://wwww.w3.org/2001/XMLSchema-instance";
            XNamespace aw1 = "http://wwww.w3.org/2001/XMLSchema";
            XNamespace xn  = "http://www2.superpag.com.br/Schemas";
            xmlToSend.Declaration = xDeclaration;

            XElement xmlRoot = new XElement(xn + "RequisicaoPagamento",
                                            new XAttribute(XNamespace.Xmlns + "xsi", aw),
                                            new XAttribute(XNamespace.Xmlns + "xsd", aw1));

            xmlToSend.Add(xmlRoot);

            XElement EstabelecimentoComercial_data = new XElement(xn + "EstabelecimentoComercial",
                                                                  new XAttribute("ChaveAutenticacao", key),
                                                                  new XAttribute("SenhaAutenticacao", password));



            XElement Pagamento_data = new XElement(xn + "OrdemPagamento",
                                                   new XAttribute("Codigo", this.OrderNumber));


            EstabelecimentoComercial_data.Add(Pagamento_data);
            xmlRoot.Add(EstabelecimentoComercial_data);

            XElement Consumidor = new XElement(xn + "Consumidor");
            Pagamento_data.Add(Consumidor);

            XElement DetalhesPessoaisDoConsumidor = new XElement(xn + "DetalhesPessoaisDoConsumidor");
            Consumidor.Add(DetalhesPessoaisDoConsumidor);

            string DistributorName = DistributorProfileModelHelper.DistributorName(DistributorProfileModel);
            DetalhesPessoaisDoConsumidor.Add(new XElement(xn + "PessoaFisica", new XAttribute("Nome", null != DistributorName ? DistributorName : string.Empty)));

            XElement Emails = new XElement(xn + "Emails");
            Consumidor.Add(Emails);

            Emails.Add(new XElement(xn + "Email", new XAttribute("Endereco", null != myCart.EmailAddress ? myCart.EmailAddress : string.Empty)));


            XElement Telefones = new XElement(xn + "Telefones");
            Consumidor.Add(Telefones);

            Telefones.Add(new XElement(xn + "Telefone", new XAttribute("Tipo", "1"),
                                       new XAttribute("CodigoPais", "55"),
                                       new XAttribute("DDD", null != myCart.DeliveryInfo.Address.AreaCode ? myCart.DeliveryInfo.Address.AreaCode : string.Empty),
                                       new XAttribute("Numero", null != myCart.DeliveryInfo.Address.Phone ? myCart.DeliveryInfo.Address.Phone : string.Empty)));

            XElement EnderecoCobranca = new XElement(xn + "EnderecoCobranca", "");
            Pagamento_data.Add(EnderecoCobranca);



            string address = string.Empty;
            if (myCart.DeliveryInfo.Address.Address.Line1 != null && myCart.DeliveryInfo.Address.Address.Line1.Length > 60)
            {
                address = myCart.DeliveryInfo.Address.Address.Line1.Substring(0, 60);
            }
            else
            {
                address = myCart.DeliveryInfo.Address.Address.Line1;
            }


            EnderecoCobranca.Add(new XElement(xn + "Endereco", new XAttribute("Logradouro", null != myCart.DeliveryInfo.Address.Address.Line1 ? address : string.Empty),
                                              new XAttribute("Numero", ""),
                                              new XAttribute("Cep", null != myCart.DeliveryInfo.Address.Address.PostalCode ? myCart.DeliveryInfo.Address.Address.PostalCode : string.Empty),
                                              new XAttribute("Complemento", ""),
                                              new XAttribute("Bairro", null != myCart.DeliveryInfo.Address.Address.Line2 ? myCart.DeliveryInfo.Address.Address.Line2 : string.Empty),
                                              new XAttribute("Cidade", null != myCart.DeliveryInfo.Address.Address.City ? myCart.DeliveryInfo.Address.Address.City : string.Empty),
                                              new XAttribute("UF", null != myCart.DeliveryInfo.Address.Address.StateProvinceTerritory ? myCart.DeliveryInfo.Address.Address.StateProvinceTerritory : string.Empty),
                                              new XAttribute("Pais", "BRAZIL")));


            XElement EnderecoEntrega = new XElement(xn + "EnderecoEntrega", "");
            Pagamento_data.Add(EnderecoEntrega);


            EnderecoEntrega.Add(new XElement(xn + "Endereco", new XAttribute("Logradouro", null != myCart.DeliveryInfo.Address.Address.Line1 ? address : string.Empty),
                                             new XAttribute("Numero", ""),
                                             new XAttribute("Cep", null != myCart.DeliveryInfo.Address.Address.PostalCode ? myCart.DeliveryInfo.Address.Address.PostalCode : string.Empty),
                                             new XAttribute("Complemento", ""),
                                             new XAttribute("Bairro", null != myCart.DeliveryInfo.Address.Address.Line2 ? myCart.DeliveryInfo.Address.Address.Line2 : string.Empty),
                                             new XAttribute("Cidade", null != myCart.DeliveryInfo.Address.Address.City ? myCart.DeliveryInfo.Address.Address.City : string.Empty),
                                             new XAttribute("UF", null != myCart.DeliveryInfo.Address.Address.StateProvinceTerritory ? myCart.DeliveryInfo.Address.Address.StateProvinceTerritory : string.Empty),
                                             new XAttribute("Pais", "BRAZIL")));

            #region Items

            XElement ItemsDaOrdem = new XElement(xn + "ItensDaOrdem");
            Pagamento_data.Add(ItemsDaOrdem);

            // Fill order items section


            foreach (var item in myCart.ShoppingCartItems)
            {
                ItemsDaOrdem.Add(new XElement(xn + "Item", new XAttribute("Codigo", item.ID),
                                              new XAttribute("Valor", Math.Round((item.DiscountPrice / item.Quantity), 2)),
                                              new XAttribute("Quantidade", item.Quantity),
                                              new XAttribute("Descricao", item.Description)));
            }
            OrderTotals_V01 totals = myCart.Totals as OrderTotals_V01;
            //ItemsDaOrdem.Add(new XElement(xn + "Item", new XAttribute("Codigo", "01"),
            //                                      new XAttribute("Valor", myCart.Totals.DiscountedItemsTotal),
            //                                      new XAttribute("Quantidade", 1),
            //                                      new XAttribute("Descricao", "Desconto")));

            ItemsDaOrdem.Add(new XElement(xn + "Item", new XAttribute("Codigo", "02"),
                                          new XAttribute("Valor", null != totals ? totals.TaxAmount : 0),
                                          new XAttribute("Quantidade", 1),
                                          new XAttribute("Descricao", "Impostos")));

            Charge_V01 pHCharge      = new Charge_V01();
            Charge_V01 freightCharge = new Charge_V01();
            if (null != totals && null != totals.ChargeList)
            {
                pHCharge      = GetCharge(totals.ChargeList, ChargeTypes.PH);
                freightCharge = GetCharge(totals.ChargeList, ChargeTypes.FREIGHT);
            }

            ItemsDaOrdem.Add(new XElement(xn + "Item", new XAttribute("Codigo", "03"),
                                          new XAttribute("Valor", (null != pHCharge ? pHCharge.Amount : 0) + (null != freightCharge ? freightCharge.Amount : 0)),
                                          new XAttribute("Quantidade", 1),
                                          new XAttribute("Descricao", "Manuseio")));

            ItemsDaOrdem.Add(new XElement(xn + "Item", new XAttribute("Codigo", "04"),
                                          new XAttribute("Valor", taxBrazil),
                                          new XAttribute("Quantidade", 1),
                                          new XAttribute("Descricao", "Tarifa Bancaria")));


            #endregion



            XElement Pagamento = new XElement(xn + "Pagamento", new XAttribute("ValorTotal", (null != myCart.Totals ? _orderAmount : 0) + taxBrazil),
                                              new XAttribute("Data", System.DateTime.Now.Date.ToString("yyyy-MM-dd")),
                                              new XAttribute("Batch", "False"),
                                              new XAttribute("Email", null != myCart.EmailAddress ? myCart.EmailAddress : string.Empty));
            Pagamento_data.Add(Pagamento);

            XElement DetalheDoMeioDePagamento = new XElement(xn + "DetalheDoMeioDePagamento", new XAttribute("MeioPagamento", "BLT"));
            Pagamento.Add(DetalheDoMeioDePagamento);

            DateTime   currentDate;
            OrderMonth orderMonth = new OrderMonth(myCart.CountryCode);
            currentDate = orderMonth.CurrentOrderMonth;

            var orderType = "RSO";
            if (myCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.ETO)
            {
                orderType = "ETO";
            }
            else if (myCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.APF)
            {
                orderType = "APF";
            }
            _installmentsConfiguration = InstallmentsProvider.GetInstallmentsConfiguration(myCart.CountryCode, new DateTime(currentDate.Year, currentDate.Month, 1), orderType);

            if (_installmentsConfiguration == null)
            {
                DateTime today = DateTime.Today;
                currentDate = new DateTime(today.Year, today.Month, 1).AddMonths(1).AddDays(-1);
            }


            DetalheDoMeioDePagamento.Add(new XElement(xn + "Boleto", new XAttribute("Banco", "237"),
                                                      new XAttribute("DataVencimento", (_installmentsConfiguration == null) ? currentDate.ToString("yyyy-MM-dd") : _installmentsConfiguration.TicketDueDate.ToString("yyyy-MM-dd")),
                                                      new XAttribute("NossoNumero", this.OrderNumber.Remove(0, 2)),
                                                      new XAttribute("Instrucoes",
                                                                     "Nao aceitar este boleto apos a data de vencimento # ** Tarifa Bancaria:R$ 0,90 # ** Valor da Nota Fiscal: " + _orderAmount + " ")));

            XElement Parcelamento = new XElement(xn + "Parcelamento");
            Pagamento.Add(Parcelamento);

            Parcelamento.Add(new XElement(xn + "Parcelas", new XAttribute("Quantidade", "1"),
                                          new XAttribute("Juros", "00.00"),
                                          new XAttribute("TipoJuros", "Aquirer"),
                                          new XAttribute("FormaParcelamento", "Integral")));

            XElement Setup = new XElement(xn + "Setup", "");
            Pagamento_data.Add(Setup);

            Setup.Add(new XElement(xn + "PostRetorno", new XAttribute("Url", (string.Format("{0}?Agency=BankSlip", returnUrl)))));

            String xmlReadyToSend;
            xmlReadyToSend = xmlToSend.Declaration.ToString() + xmlToSend.Root.ToString();
            return(xmlReadyToSend);

            #endregion
        }
        protected override void BindTotals()
        {
            decimal earnBase = 0.00M;
            List <DistributorShoppingCartItem> lstShoppingCartItems =
                (Page as ProductsBase).ShoppingCart.ShoppingCartItems;

            try
            {
                if (lstShoppingCartItems.Count > 0 && _shoppingCart.Totals != null)
                {
                    OrderTotals_V01 totals = _shoppingCart.Totals as OrderTotals_V01;
                    foreach (DistributorShoppingCartItem shoppingCartItem in lstShoppingCartItems)
                    {
                        earnBase += shoppingCartItem.EarnBase;
                    }

                    lblDiscountRate.Text = _shoppingCart.Totals == null
                                               ? "0%"
                                               : (totals.DiscountPercentage).ToString() + "%";
                    lblDistributorSubtotal.Text = getAmountString(totals.DiscountedItemsTotal);
                    lblEarnBase.Text            = getAmountString(GetTotalEarnBase(lstShoppingCartItems));
                    if (ProductsBase.IsEventTicketMode)
                    {
                        var orderMonthShortString = string.Empty;
                        var ordermonth            = OrderMonth.DualOrderMonthForEventTicket(true, out orderMonthShortString); // dual ordermonth should be desable for ETO
                        lblOrderMonth.Text = string.IsNullOrWhiteSpace(ordermonth) ? GetOrderMonthString() : ordermonth;
                        var currentSession = SessionInfo;

                        if (null != currentSession && !string.IsNullOrWhiteSpace(orderMonthShortString))
                        {
                            currentSession.OrderMonthString      = ordermonth;
                            currentSession.OrderMonthShortString = orderMonthShortString;
                        }
                    }
                    else
                    {
                        lblOrderMonth.Text = GetOrderMonthString();
                    }

                    decimal currentMonthVolume = 0;
                    if (decimal.TryParse((Page as ProductsBase).CurrentMonthVolume, out currentMonthVolume))
                    {
                        lblOrderMonthVolume.Text =
                            HLConfigManager.Configurations.CheckoutConfiguration.UseUSPricesFormat
                                ? currentMonthVolume.ToString("N", CultureInfo.GetCultureInfo("en-US"))
                                : currentMonthVolume.ToString("N2");
                    }
                    else
                    {
                        lblOrderMonthVolume.Text = (Page as ProductsBase).CurrentMonthVolume;
                    }

                    Charge_V01 otherCharges =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.OTHER); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.OTHER, (decimal)0.0);
                    Charge_V01 pHCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.PH); }) as Charge_V01 ??
                        new Charge_V01(ChargeTypes.PH, (decimal)0.0);
                    Charge_V01 freightCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.FREIGHT); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.FREIGHT, (decimal)0.0);
                    lblOtherCharges.Text = getAmountString(otherCharges.Amount);
                    Charge_V01 localTaxCharge = OrderProvider.GetLocalTax(_shoppingCart.Totals as OrderTotals_V01);
                    lblLocalTax.Text        = getAmountString(localTaxCharge.Amount);
                    lblPackageHandling.Text = getAmountString(pHCharge.Amount);
                    Charge_V01 logisticCharge =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.LOGISTICS_CHARGE); })
                        as Charge_V01 ?? new Charge_V01(ChargeTypes.LOGISTICS_CHARGE, (decimal)0.0);
                    lblLogisticCharges.Text = getAmountString(logisticCharge.Amount);
                    var amount = GetSubTotalValue(totals, CountryCode);
                    lblSubtotal.Text        = getAmountString(amount);
                    lblRetailPrice.Text     = getAmountString(totals.ItemsTotal);
                    lblShippingCharges.Text = getAmountString(freightCharge.Amount);
                    lblTaxVAT.Text          = getAmountString(OrderProvider.GetTaxAmount(_shoppingCart.Totals as OrderTotals_V01));

                    Charge_V01 taxedNet =
                        totals.ChargeList.Find(
                            delegate(Charge p) { return(((Charge_V01)p).ChargeType == ChargeTypes.TAXEDNET); }) as
                        Charge_V01 ?? new Charge_V01(ChargeTypes.TAXEDNET, (decimal)0.0);
                    lblTaxedNet.Text = getAmountString(taxedNet.Amount);


                    lblVolumePoints.Text = HLConfigManager.Configurations.CheckoutConfiguration.UseUSPricesFormat
                                               ? totals.VolumePoints.ToString("N",
                                                                              CultureInfo.GetCultureInfo(
                                                                                  "en-US"))
                                               : totals.VolumePoints.ToString("N2");

                    lblGrandTotal.Text = getAmountString(totals.AmountDue);
                }
                else
                {
                    DisplayEmptyLabels();
                }

                if (HLConfigManager.Configurations.CheckoutConfiguration.HasTotalTaxable)
                {
                    trTaxedNet.Visible = true;
                    trTax.Visible      = false;
                }

                if (_shoppingCart.Totals != null)
                {
                    OrderTotals_V01 totals = _shoppingCart.Totals as OrderTotals_V01;
                    if (HLConfigManager.Configurations.CheckoutConfiguration.HasTaxPercentage)
                    {
                        trTaxPercentage.Visible = true;
                        //lblPercentage.Text = HLConfigManager.Configurations.CheckoutConfiguration.TaxPercentage + "%";
                        lblPercentage.Text = _shoppingCart.Totals != null
                                                 ? getAmountString(OrderProvider.GetTaxAmount(_shoppingCart.Totals as OrderTotals_V01))
                                                 : string.Empty;
                    }

                    if (HLConfigManager.Configurations.CheckoutConfiguration.HasTotalDiscount)
                    {
                        trTotalDiscount.Visible = true;
                        lblTotalDiscount2.Text  = _shoppingCart.Totals != null
                                                     ? getAmountString(totals.TotalItemDiscount)
                                                     : string.Empty;
                    }
                    // hide this row if there is no local tax return
                    trLocalTax.Visible = OrderProvider.HasLocalTax(totals);
                }
            }
            catch (Exception ex)
            {
                //Log Exception
                LoggerHelper.Error("Exception while displaying totals - " + ex);
                DisplayEmptyLabels();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HLConfigManager.Configurations.DOConfiguration.IsChina && HLConfigManager.Configurations.PaymentsConfiguration.ShowBigGrandTotal)
            {
                lblGrandTotal.Attributes.Add("class", "Title");
                lblDisplayGrandTotal.Attributes.Add("class", "Title");
            }
            if (IsChina)
            {
                blErrors.Items.Clear();
            }

            MyHLShoppingCart shoppingCart = (Page as ProductsBase).ShoppingCart;

            OrderMonth.RegisterOrderMonthControls(pnlOrderMonth, lblOrderMonthChanged, ProductsBase.IsEventTicketMode,
                                                  pnlOrderMonthLabel);

            var control = loadPurchasingLimitsControl(false);

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

            if (HLConfigManager.Configurations.CheckoutConfiguration.YourPriceWithAllCharges)
            {
                shoppingCart.Calculate();
            }
            BindTotals();
            if (trYourLevel != null)
            {
                trYourLevel.Visible = false;                      // Hide row by default
            }
            if (shoppingCart.OrderCategory == OrderCategoryType.ETO ||
                !HLConfigManager.Configurations.CheckoutConfiguration.HasEarnBase)
            {
                if (shoppingCart.OrderCategory == OrderCategoryType.ETO ||
                    !HLConfigManager.Configurations.CheckoutConfiguration.HasSummaryEarnBase)
                {
                    trEarnBase.Visible = false;
                }
            }
            if (!HLConfigManager.Configurations.CheckoutConfiguration.HasSubTotal)
            {
                divDistributorSubtotal.Visible = false;
            }
            if (HLConfigManager.Configurations.CheckoutConfiguration.HidePHShippingForETO)
            {
                if (SessionInfo.IsEventTicketMode)
                {
                    trPackingHandling.Visible = false;
                    if (HLConfigManager.Configurations.CheckoutConfiguration.ShowDistributorSubTotalForETO)
                    {
                        divDistributorSubtotal.Visible = true;
                    }
                    else
                    {
                        divDistributorSubtotal.Visible = false;
                    }
                    if (HLConfigManager.Configurations.CheckoutConfiguration.ShowVolumePoinsForETO)
                    {
                        trVolumePoints.Visible = true;
                    }
                    else
                    {
                        trVolumePoints.Visible = false;
                    }
                }
            }
            if (!HLConfigManager.Configurations.CheckoutConfiguration.HasOrderMonthVolumePoints)
            {
                trOrderMonthVP.Visible = false;
            }
            string levelDSType = (Page as ProductsBase).Level;

            if (levelDSType == "DS")
            {
                imgOrderMonth.Visible = true;
            }
            else
            {
                imgOrderMonth.Visible = false;
            }

            if (imgEarnBase != null)
            {
                imgEarnBase.Visible = CheckoutTotalsDetailed.ShowEarnBaseHelpInfo();
            }

            if (HLConfigManager.Configurations.DOConfiguration.IsChina)
            {
                if (HLConfigManager.Configurations.CheckoutConfiguration.HasOtherCharges)
                {
                    trOtherCharges.Visible = true;
                }

                // Conditioning tax vat row visibility.
                if (trTaxVat != null)
                {
                    trTaxVat.Visible = HLConfigManager.Configurations.CheckoutConfiguration.HasTaxVat;
                }

                if (HLConfigManager.Configurations.CheckoutConfiguration.HasLocalTax)
                {
                    trLocalTax.Visible = true;
                }

                if (HLConfigManager.Configurations.CheckoutConfiguration.HideFreightCharges && ShoppingCart.DeliveryInfo.Option == DeliveryOptionType.Pickup)
                {
                    trShippingCharge.Visible = false;
                }

                if (HLConfigManager.Configurations.CheckoutConfiguration.HideShippingCharges)
                {
                    trShippingCharge.Visible = false;
                }

                if (!HLConfigManager.Configurations.CheckoutConfiguration.HasRetailPrice)
                {
                    if (trRetailPrice != null)
                    {
                        trRetailPrice.Visible = false;
                    }
                }
                else if (SessionInfo.IsEventTicketMode && trRetailPrice != null)
                {
                    trRetailPrice.Visible = HLConfigManager.Configurations.CheckoutConfiguration.HasRetailPriceForETO;
                }

                if (trPackingHandling != null)
                {
                    trPackingHandling.Visible = false;
                }

                if (HLConfigManager.Configurations.CheckoutConfiguration.HasLogisticCharges)
                {
                    if (trLogisticCharge != null)
                    {
                        trLogisticCharge.Visible = true;
                    }
                }

                if (ShoppingCart.DeliveryInfo != null)
                {
                    if (ShoppingCart.DeliveryInfo.Option == DeliveryOptionType.Pickup)
                    {
                        if (HLConfigManager.Configurations.CheckoutConfiguration.HasPickupCharge)
                        {
                            if (lblDisplayShippingCharges != null)
                            {
                                lblDisplayShippingCharges.Text = (string)GetLocalResourceObject("lblDisplayPickupCharges");
                            }
                        }
                        else
                        {
                            trShippingCharge.Visible = false;
                        }
                    }
                }

                if (DistributorOrderingProfile != null && DistributorOrderingProfile.IsPC)
                {
                    if ((ShoppingCart.PcLearningDeliveryoption == ServiceProvider.CatalogSvc.DeliveryOptionType.Unknown &&
                         shoppingCart.DeliveryOption == ServiceProvider.CatalogSvc.DeliveryOptionType.Shipping) || ShoppingCart.PcLearningDeliveryoption == ServiceProvider.CatalogSvc.DeliveryOptionType.Shipping)
                    {
                        trPCLearningPoint.Visible      = true;
                        trPCLearningPointLimit.Visible = true;
                        GetEligibleUsePoint();
                    }
                    else
                    {
                        trPCLearningPoint.Visible      = false;
                        trPCLearningPointLimit.Visible = false;
                    }
                }
                else if (ShoppingCart.OrderCategory == OrderCategoryType.ETO && SessionInfo != null && !SessionInfo.IsReplacedPcOrder)
                {
                    trPCLearningPoint.Visible      = true;
                    trPCLearningPointLimit.Visible = true;
                    GetEligibleUseETOPoints();
                }
                else
                {
                    trPCLearningPoint.Visible      = false;
                    trPCLearningPointLimit.Visible = false;
                }
            }
            else
            {
                if (trDiscountTotal != null)
                {
                    trDiscountTotal.Visible = HLConfigManager.Configurations.CheckoutConfiguration.ShowDisocuntTotal;
                }
            }

            if (DistributorOrderingProfile != null && DistributorOrderingProfile.IsPC)
            {
                trVolumePoints.Visible = false;
            }

            if (!HLConfigManager.Configurations.CheckoutConfiguration.HasRetailPrice)
            {
                if (trRetailPrice != null)
                {
                    trRetailPrice.Visible = false;
                }
            }
            else if (SessionInfo.IsEventTicketMode && trRetailPrice != null)
            {
                trRetailPrice.Visible = HLConfigManager.Configurations.CheckoutConfiguration.HasRetailPriceForETO;
            }

            if (HLConfigManager.Configurations.DOConfiguration.IsChina)
            {
                if (!HLConfigManager.Configurations.CheckoutConfiguration.HasRetailPrice)
                {
                    if (trRetailPrice != null)
                    {
                        trRetailPrice.Visible = false;
                    }
                }
                else if (SessionInfo.IsEventTicketMode && trRetailPrice != null)
                {
                    trRetailPrice.Visible = HLConfigManager.Configurations.CheckoutConfiguration.HasRetailPriceForETO;
                }
                trWeight.Visible = false;
            }
            else
            {
                trGrandTotal.Visible              = false;
                trPackingHandling.Visible         = false;
                lblDisplayPackageHandling.Visible = false;
                lblPackageHandling.Visible        = false;
                trOtherCharges.Visible            = false;
                trLogisticCharge.Visible          = false;
                trShippingCharge.Visible          = !string.IsNullOrEmpty(lblShippingCharges.Text) && HLConfigManager.Configurations.DOConfiguration.ShowFreightChrageonCOP1 &&
                                                    shoppingCart.DeliveryInfo != null && shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping;
                trTaxVat.Visible               = false;
                trLocalTax.Visible             = false;
                trPCLearningPoint.Visible      = false;
                trPCLearningPointLimit.Visible = false;
            }

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

            if (trWeight != null)
            {
                trWeight.Visible = HLConfigManager.Configurations.CheckoutConfiguration.DisplayWeight && !SessionInfo.IsEventTicketMode;
            }

            if (HLConfigManager.Configurations.DOConfiguration.DisplayBifurcationKeys &&
                ShoppingCart.DsType != null && ShoppingCart.DsType == ServiceProvider.DistributorSvc.Scheme.Member)
            {
                lblDisplayVolumePoints.Text = (string)GetLocalResourceObject("lblDisplayVolumePointsResource1MB.Text");
            }
        }