protected void btnAddToCart_Click(object sender, EventArgs e)
        {
            string SKU = rblFreeGiftlist.SelectedValue;

            ShoppingCart.AddItemsToCart(new List <ShoppingCartItem_V01>
            {
                new ShoppingCartItem_V01 {
                    SKU = SKU, Quantity = 1, IsPromo = true,
                }
            });
            ShoppingCartChanged(this, new ShoppingCartEventArgs(ShoppingCart));
            var currestsession = SessionInfo.GetSessionInfo(DistributorID, "zh-CN");

            if (currestsession != null && currestsession.ChinaPromoSKUQuantity > 0)
            {
                var myShoppingCart = (Page as ProductsBase).ShoppingCart;
                var promoInCart    =
                    myShoppingCart.CartItems.Select(c => c.SKU).Intersect(ChinaPromoSkus.Select(f => f.SKU));
                var count = (from skucount in myShoppingCart.CartItems
                             from cartitem in promoInCart
                             where cartitem.Trim().Equals(skucount.SKU.Trim())
                             select skucount.Quantity).Sum();
                if (promoInCart.Count() == currestsession.ChinaPromoSKUQuantity)
                {
                    btnAddToCart.Enabled = false;
                    divPromo.Visible     = false;
                }
                else
                {
                    btnAddToCart.Enabled = true;
                }
            }
        }
Example #2
0
 public override void GetDistributorShippingInfoForHMS(MyHLShoppingCart shoppingCart, MyHerbalife3.Ordering.ServiceProvider.OrderSvc.ShippingInfo_V01 address)
 {
     if (shoppingCart != null && shoppingCart.DeliveryInfo != null && shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Pickup)
     {
         ShippingInfo shippingInfo = base.GetShippingInfoFromID(shoppingCart.DistributorID, shoppingCart.Locale, shoppingCart.DeliveryInfo.Option, shoppingCart.DeliveryOptionID, shoppingCart.ShippingAddressID);
         SessionInfo  sessionInfo  = SessionInfo.GetSessionInfo(shoppingCart.DistributorID, shoppingCart.Locale);
         if (shippingInfo != null)
         {
             if (sessionInfo.IsEventTicketMode)
             {
                 shoppingCart.DeliveryInfo.FreightCode   = HLConfigManager.Configurations.CheckoutConfiguration.EventTicketFreightCode;
                 shoppingCart.DeliveryInfo.WarehouseCode = shippingInfo.WarehouseCode;
                 address.ShippingMethodID = HLConfigManager.Configurations.APFConfiguration.APFFreightCode;
                 address.WarehouseCode    = shippingInfo.WarehouseCode;
             }
             if (APFDueProvider.hasOnlyAPFSku(shoppingCart.CartItems, shoppingCart.Locale))
             {
                 shoppingCart.DeliveryInfo.FreightCode   = HLConfigManager.Configurations.CheckoutConfiguration.EventTicketFreightCode;
                 shoppingCart.DeliveryInfo.WarehouseCode = shippingInfo.WarehouseCode;
                 address.ShippingMethodID = HLConfigManager.Configurations.APFConfiguration.APFFreightCode;
                 address.WarehouseCode    = shippingInfo.WarehouseCode;
             }
         }
     }
 }
        private void CleanupCart(MyHLShoppingCart cart)
        {
            if (PurchasingLimitProvider.RequirePurchasingLimits(cart.DistributorID, cart.CountryCode))
            {
                PurchasingLimitProvider.ReconcileAfterPurchase(cart, cart.DistributorID, Country);
            }

            if (null != HttpContext.Current)
            {
                var currentSession = SessionInfo.GetSessionInfo(cart.DistributorID, Locale);
                if (currentSession != null)
                {
                    if (!String.IsNullOrEmpty(currentSession.OrderNumber))
                    {
                        currentSession.OrderNumber                      = String.Empty;
                        currentSession.OrderMonthShortString            = string.Empty;
                        currentSession.OrderMonthString                 = string.Empty;
                        currentSession.ShippingMethodNameMX             = String.Empty;
                        currentSession.ShippingMethodNameUSCA           = String.Empty;
                        currentSession.ShoppingCart.CustomerOrderDetail = null;
                        // currentSession.CustomerPaymentSettlementApproved = false; Commented out for merge. Need to investigate
                        currentSession.CustomerOrderNumber = String.Empty;
                        currentSession.CustomerAddressID   = 0;
                    }
                }
                //Clear the order month session...
                HttpContext.Current.Session["OrderMonthDataSessionKey"] = null;
                SessionInfo.SetSessionInfo(cart.DistributorID, Locale, currentSession);
            }

            ShoppingCartProvider.UpdateInventory(cart, Country, Locale, true);
        }
Example #4
0
        /// <summary>
        /// Gets the shipment information to import into HMS.
        /// </summary>
        /// <param name="shoppingCart">The shopping cart.</param>
        /// <param name="shippment">The order shipment.</param>
        /// <returns></returns>
        public override bool GetDistributorShippingInfoForHMS(MyHLShoppingCart shoppingCart, Shipment shippment)
        {
            var session = SessionInfo.GetSessionInfo(shoppingCart.DistributorID, shoppingCart.Locale);

            if (session.IsEventTicketMode)
            {
                return(true);
            }

            if (APFDueProvider.hasOnlyAPFSku(shoppingCart.CartItems, shoppingCart.Locale))
            {
                return(true);
            }

            if (shoppingCart.DeliveryInfo != null && shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping &&
                !shoppingCart.DeliveryInfo.FreightCode.Equals(HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultFreightCode))
            {
                shoppingCart.DeliveryInfo.FreightCode =
                    HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultFreightCode;
                shoppingCart.DeliveryInfo.WarehouseCode =
                    HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultWarehouse;
                shippment.ShippingMethodID = shoppingCart.DeliveryInfo.FreightCode;
                shippment.WarehouseCode    = shoppingCart.DeliveryInfo.WarehouseCode;
            }
            return(true);
        }
 /// <summary>
 /// called before pricing
 /// </summary>
 /// <param name="shoppingCart"></param>
 /// <param name="address"></param>
 public override void GetDistributorShippingInfoForHMS(MyHLShoppingCart shoppingCart, MyHerbalife3.Ordering.ServiceProvider.OrderSvc.ShippingInfo_V01 address)
 {
     if (shoppingCart != null && shoppingCart.DeliveryInfo != null)
     {
         string freightCodeInCart = shoppingCart.DeliveryInfo.FreightCode;
         var    session           = SessionInfo.GetSessionInfo(shoppingCart.DistributorID, shoppingCart.Locale);
         if (session.IsEventTicketMode || APFDueProvider.hasOnlyAPFSku(shoppingCart.CartItems, shoppingCart.Locale))
         {
             shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = "NOF";
         }
         else
         {
             if (shoppingCart.FreightCode == "NOF")
             {
                 shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping ? "UAF" : "PU";
             }
             if (shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping)
             {
                 shoppingCart.DeliveryInfo.WarehouseCode = HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultWarehouse;
             }
         }
         if (!freightCodeInCart.Equals(shoppingCart.FreightCode))
         {
             ShoppingCartProvider.UpdateShoppingCart(shoppingCart);
         }
     }
 }
Example #6
0
        public static bool DisplayNonResidentMessage(string shoppingCartID)
        {
            bool isNotified;

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

            if (HLConfigManager.Configurations.DOConfiguration.DisplayNonResidentsMessage && !isNotified)
            {
                var member = (MembershipUser <DistributorProfileModel>)Membership.GetUser();
                if (member != null && member.Value != null && !member.Value.ProcessingCountryCode.Equals(StaticLocale.Substring(3)))
                {
                    var id = 0;
                    if (int.TryParse(shoppingCartID, out id))
                    {
                        var shoppingCart = ShoppingCartProvider.GetShoppingCart(StaticDistributorID, StaticLocale, id);
                        if (shoppingCart.DeliveryInfo != null && shoppingCart.DeliveryInfo.Option == ServiceProvider.ShippingSvc.DeliveryOptionType.Pickup &&
                            !SessionInfo.GetSessionInfo(StaticDistributorID, StaticLocale).IsEventTicketMode&& !APFDueProvider.IsAPFSkuPresent(shoppingCart.CartItems))
                        {
                            HttpContext.Current.Session["isNonResidentNotified"] = true;
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
        public override string[] GetFreightCodeAndWarehouse(ShippingAddress_V01 address)
        {
            var sessionInfo = SessionInfo.GetSessionInfo(string.Empty, string.Empty);

            if (sessionInfo.IsEventTicketMode)
            {
                return(new[]
                {
                    HLConfigManager.Configurations.CheckoutConfiguration.EventTicketFreightCode,
                    HLConfigManager.Configurations.CheckoutConfiguration.EventTicketWarehouseCode
                });
            }

            var freightCodeAndWarehouse = new[] { "EXX", "F2" }; //default to mainland france: 01000 - 96999

            if (null != address && null != address.Address)
            {
                int postCode = 0;
                if (Int32.TryParse(address.Address.PostalCode, out postCode))
                {
                    if (postCode >= 98800 & postCode <= 98899)
                    {
                        freightCodeAndWarehouse = new[] { "NCD", "F8" };
                    }
                }
            }

            return(freightCodeAndWarehouse);
        }
        private bool CanBuy_eLearningRule(MyHLShoppingCart hlCart)
        {
            bool   retVal       = true;
            var    session      = SessionInfo.GetSessionInfo(hlCart.DistributorID, hlCart.Locale);
            string trainingCode = HLConfigManager.Configurations.ShoppingCartConfiguration.TrainingCode;

            if (session.DsTrainings == null)
            {
                session.DsTrainings = DistributorOrderingProfileProvider.GetTrainingList(hlCart.DistributorID, hlCart.CountryCode);
            }

            if (session.DsTrainings != null && session.DsTrainings.Count > 0 && session.DsTrainings.Exists(t => t.TrainingCode == trainingCode && !t.TrainingFlag))
            {
                var     currentLimits       = PurchasingLimitProvider.GetCurrentPurchasingLimits(hlCart.DistributorID);
                decimal currentVolumePoints = hlCart.VolumeInCart;

                var currentItem = CatalogProvider.GetCatalogItem(hlCart.CurrentItems[0].SKU, Country);
                currentVolumePoints += currentItem.VolumePoints * hlCart.CurrentItems[0].Quantity;
                if (currentLimits.PurchaseLimitType == PurchaseLimitType.Volume)
                {
                    currentVolumePoints += (currentLimits.maxVolumeLimit - currentLimits.RemainingVolume);
                }

                if (currentVolumePoints > HLConfigManager.Configurations.ShoppingCartConfiguration.eLearningMaxPPV)
                {
                    retVal = false;
                }
            }


            return(retVal);
        }
 /// <summary>
 /// GetDistributorShippingInfoForHMS
 /// </summary>
 /// <param name="shoppingCart"></param>
 /// <param name="address"></param>
 public override void GetDistributorShippingInfoForHMS(MyHLShoppingCart shoppingCart, ShippingInfo_V01 address)
 {
     if (shoppingCart != null && shoppingCart.DeliveryInfo != null)
     {
         string freightCodeInCart = shoppingCart.DeliveryInfo.FreightCode;
         var    session           = SessionInfo.GetSessionInfo(shoppingCart.DistributorID, shoppingCart.Locale);
         if (session.IsEventTicketMode)
         {
             shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = HLConfigManager.Configurations.CheckoutConfiguration.EventTicketFreightCode;
         }
         else if (APFDueProvider.hasOnlyAPFSku(shoppingCart.CartItems, shoppingCart.Locale))
         {
             shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = HLConfigManager.Configurations.APFConfiguration.APFFreightCode;
         }
         else
         {
             string defaultFreight = HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultFreightCode;
             if (shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping)
             {
                 shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = defaultFreight;
             }
             else
             {
                 shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = "PU";
             }
         }
         if (!freightCodeInCart.Equals(shoppingCart.FreightCode))
         {
             ShoppingCartProvider.UpdateShoppingCart(shoppingCart);
         }
     }
 }
        protected void lnkCreateInvoiceClicked(object sender, EventArgs e)
        {
            var currentSession = SessionInfo.GetSessionInfo(DistributorID, Locale);
            var url            = string.Format("/Ordering/Invoice/CreateByOrderId/{0}", lblOrderNumber.Text);

            Response.Redirect(url);
        }
        private ShoppingCartRuleResult CartRetrievedRuleHandler(ShoppingCart_V01 cart,
                                                                ShoppingCartRuleResult result)
        {
            var sessioninfo = SessionInfo.GetSessionInfo(cart.DistributorID, cart.Locale);
            var distributorOrderingProfile = DistributorOrderingProfileProvider.GetProfile(cart.DistributorID, "CN");

            if (sessioninfo != null && distributorOrderingProfile != null)
            {
                if (sessioninfo.IsEventTicketMode)
                {
                    if (sessioninfo.IsReplacedPcOrder)
                    {
                        var shoppingCart = cart as MyHLShoppingCart;
                        var items        = new List <string>();
                        if (cart.CartItems != null)
                        {
                            items.AddRange(cart.CartItems.Select(item => item.SKU));
                        }
                        if (items.Any())
                        {
                            if (shoppingCart != null)
                            {
                                shoppingCart.DeleteItemsFromCart(items, true);
                            }
                        }
                    }
                }
            }
            return(result);
        }
        public override string[] GetFreightCodeAndWarehouse(ShippingAddress_V01 address)
        {
            var sessionInfo = SessionInfo.GetSessionInfo(string.Empty, string.Empty);

            if (sessionInfo.IsEventTicketMode)
            {
                return(new[]
                {
                    HLConfigManager.Configurations.CheckoutConfiguration.EventTicketFreightCode,
                    HLConfigManager.Configurations.CheckoutConfiguration.EventTicketWarehouseCode
                });
            }

            var freightCodeAndWarehouse = new[] { "HEO", "G7" };

            if (null != address && null != address.Address)
            {
                int postCode = 0;
                if (Int32.TryParse(address.Address.PostalCode.Replace(" ", string.Empty), out postCode))
                {
                    if ((postCode >= 10000 && postCode <= 19900) ||
                        (postCode >= 80000 && postCode <= 80999))
                    {
                        freightCodeAndWarehouse = new[] { "HEA", "G7" };
                    }
                }
            }
            return(freightCodeAndWarehouse);
        }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (currentSession == null)
     {
         currentSession = SessionInfo.GetSessionInfo(DistributorID, Locale);
     }
 }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (ForFControlValidation())
            {
                var sessionInfo = SessionInfo.GetSessionInfo(ShoppingCart.DistributorID, ShoppingCart.Locale);
                if (!string.IsNullOrEmpty(sessionInfo.BRPF))
                {
                    var digits = sessionInfo.BRPF.Split('-');
                    txtCPF.Text   = digits[0];
                    txtVCode.Text = digits[1];
                }

                divCPF.Visible       = true;
                divCPFStatic.Visible = false;
            }
            else
            {
                pnlCPF.Visible = false;
            }

            if (string.IsNullOrEmpty(ShoppingCart.TaxPersonalId))
            {
                // Getting the CPF from the distributor properties
                ShoppingCart.TaxPersonalId = DistributorOrderingProfileProvider.GetTaxIdentificationId(ShoppingCart.DistributorID, "BRPF");
            }
        }
        /// <summary>
        /// Gets the shipment information to import into HMS.
        /// </summary>
        /// <param name="shoppingCart">The shopping cart.</param>
        /// <param name="shippment">The order shipment.</param>
        /// <returns></returns>
        public override bool GetDistributorShippingInfoForHMS(MyHLShoppingCart shoppingCart, MyHerbalife3.Ordering.ServiceProvider.SubmitOrderBTSvc.Shipment shippment)
        {
            if (shoppingCart != null && shoppingCart.DeliveryInfo != null)
            {
                string freightCodeInCart = shoppingCart.DeliveryInfo.FreightCode;
                var    session           = SessionInfo.GetSessionInfo(shoppingCart.DistributorID, shoppingCart.Locale);
                if (session.IsEventTicketMode || APFDueProvider.hasOnlyAPFSku(shoppingCart.CartItems, shoppingCart.Locale))
                {
                    return(true);
                }

                if (shoppingCart.FreightCode == "NOF")
                {
                    shippment.ShippingMethodID = shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping ? "UAF" : "PU";
                }
                if (shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping)
                {
                    shoppingCart.DeliveryInfo.WarehouseCode = HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultWarehouse;
                }
                if (!freightCodeInCart.Equals(shoppingCart.FreightCode))
                {
                    shoppingCart.Calculate();
                    ShoppingCartProvider.UpdateShoppingCart(shoppingCart);
                }
            }
            return(true);
        }
 /// <summary>
 /// Gets the shipment information to import into HMS.
 /// </summary>
 /// <param name="shoppingCart">The shopping cart.</param>
 /// <param name="shippment">The order shipment.</param>
 /// <returns></returns>
 public override bool GetDistributorShippingInfoForHMS(MyHLShoppingCart shoppingCart, Shipment shippment)
 {
     if (shoppingCart != null && shoppingCart.DeliveryInfo != null)
     {
         string freightCodeInCart = shoppingCart.DeliveryInfo.FreightCode;
         var    session           = SessionInfo.GetSessionInfo(shoppingCart.DistributorID, shoppingCart.Locale);
         if (session.IsEventTicketMode)
         {
             shippment.ShippingMethodID = shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = HLConfigManager.Configurations.CheckoutConfiguration.EventTicketFreightCode;
         }
         else if (APFDueProvider.hasOnlyAPFSku(shoppingCart.CartItems, shoppingCart.Locale))
         {
             shippment.ShippingMethodID = shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = HLConfigManager.Configurations.APFConfiguration.APFFreightCode;
         }
         else
         {
             string defaultFreight = HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultFreightCode;
             shippment.WarehouseCode = shoppingCart.DeliveryInfo.WarehouseCode = HLConfigManager.Configurations.ShoppingCartConfiguration.DefaultWarehouse;
             if (shoppingCart.DeliveryInfo.Option == DeliveryOptionType.Shipping)
             {
                 shippment.ShippingMethodID = shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = defaultFreight;
             }
             else
             {
                 shippment.ShippingMethodID = shoppingCart.FreightCode = shoppingCart.DeliveryInfo.FreightCode = "PU";
             }
         }
         if (!freightCodeInCart.Equals(shoppingCart.FreightCode))
         {
             shoppingCart.Calculate();
             ShoppingCartProvider.UpdateShoppingCart(shoppingCart);
         }
     }
     return(true);
 }
        protected void OnNo(object sender, EventArgs e)
        {
            popup_MessageBox.Hide();
            var member             = (MembershipUser <DistributorProfileModel>)Membership.GetUser();
            var currentSessionInfo = SessionInfo.GetSessionInfo(member.Value.Id, CultureInfo.CurrentCulture.Name);

            currentSessionInfo.TrainingBreached = false;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string locale        = HLConfigManager.Configurations.Locale;
            var    member        = (MembershipUser <DistributorProfileModel>)Membership.GetUser();
            var    user          = member.Value;
            string distributorId = (null != user) ? user.Id : string.Empty;

            if (!string.IsNullOrEmpty(distributorId))
            {
                CurrentSession = SessionInfo.GetSessionInfo(distributorId, locale);
                if (CurrentSession == null)
                {
                    LoggerHelper.Error(string.Format("PaymentGatewayInvoker - ThreeDAuthenticate, Session is null. Distributor Id : {0} ",
                                                     distributorId));
                    return;
                }
            }

            Response.Clear();

            var termUrlPrefix = Settings.GetRequiredAppSetting("RootURLPerfix", "https://");
            var termUrl       = string.Format("{0}{1}", termUrlPrefix, Request.Url.DnsSafeHost + "/Ordering/Checkout.aspx");
            var paReq         = CurrentSession.ThreeDSecuredCardInfo.PaReq;
            var md            = "Herbalife3DSecuredCreditCardAuthentication";

            var sb = new StringBuilder();

            sb.Append("<html>");
            sb.AppendFormat(@"<body onload='document.forms[""form3D""].submit()'>");
            sb.AppendFormat("<form id='form3D' name='form3D' action='{0}' method='post'>", CurrentSession.ThreeDSecuredCardInfo.AcsUrl);

            if (CurrentSession.ThreeDSecuredCardInfo.CountryCode == "TR")
            {
                sb.AppendFormat("<input type='hidden' name='mid' value='{0}'>", CurrentSession.ThreeDSecuredCardInfo.MerchantId);
                sb.AppendFormat("<input type='hidden' name='posnetID' value='{0}'>", CurrentSession.ThreeDSecuredCardInfo.AccountId);
                sb.AppendFormat("<input type='hidden' name='posnetData' value='{0}'>", CurrentSession.ThreeDSecuredCardInfo.PaReq);
                sb.AppendFormat("<input type='hidden' name='posnetData2' value='{0}'>", CurrentSession.ThreeDSecuredCardInfo.CommerceIndicator);
                sb.AppendFormat("<input type='hidden' name='digest' value='{0}'>", CurrentSession.ThreeDSecuredCardInfo.RequestToken);
                sb.AppendFormat("<input type='hidden' name='vftCode' value='{0}'>", string.Empty);
                sb.AppendFormat("<input type='hidden' name='merchantReturnURL' value='{0}'>", termUrl);
                sb.AppendFormat("<input type='hidden' name='lang' value='{0}'>", "tr");
                sb.AppendFormat("<input type='hidden' name='url' value='{0}'>", string.Empty);
                sb.AppendFormat("<input type='hidden' name='openANewWindow' value='{0}'>", "0");
            }
            else
            {
                sb.AppendFormat("<input type='hidden' name='PaReq' value='{0}'>", paReq);
                sb.AppendFormat("<input type='hidden' name='TermUrl' value='{0}'>", termUrl);
                sb.AppendFormat("<input type='hidden' name='MD' value='{0}'>", md);
            }

            sb.Append("</form>");
            sb.Append("</body>");
            sb.Append("</html>");

            Response.Write(sb.ToString());
            Response.End();
        }
        private bool isEventTicket(string distributorID, string locale)
        {
            var sessionInfo = SessionInfo.GetSessionInfo(distributorID, locale);

            if (null != sessionInfo)
            {
                return(sessionInfo.IsEventTicketMode);
            }
            return(false);
        }
Example #20
0
        public override void SetPurchaseRestriction(List <TaxIdentification> tins, int orderMonth, string distributorId, IPurchaseRestrictionManager manager)
        {
            //check if is a elearning and set the new limits for the second order
            base.SetPurchaseRestriction(tins, orderMonth, distributorId, manager);
            var currentLimits = GetLimits(LimitsRestrictionType.PurchasingLimits, orderMonth, manager);

            if (HLConfigManager.Configurations.ShoppingCartConfiguration.CheckELearning)
            {
                PurchaseLimitType limitType = PurchaseLimitType.Volume;
                currentLimits.PurchaseLimitType = limitType;
                var session = SessionInfo.GetSessionInfo(distributorId, Locale);
                if (PurchaseRestrictionProvider.RequireTraining(distributorId, this.Locale, this.Country))
                {
                    if (currentLimits.RemainingVolume != currentLimits.maxVolumeLimit && !session.LimitsHasModified)
                    {
                        var used     = (currentLimits.maxVolumeLimit - currentLimits.RemainingVolume);
                        var shouldbe = 1100 - used;
                        currentLimits.PurchaseLimitType = limitType;
                        if (currentLimits.RemainingVolume != shouldbe && shouldbe > 0 && !session.LimitsHasModified)
                        {
                            currentLimits.RemainingVolume = HLConfigManager.Configurations.ShoppingCartConfiguration.eLearningMaxPPV - (currentLimits.maxVolumeLimit - currentLimits.RemainingVolume);
                            session.LimitsHasModified     = true;
                        }
                    }
                    //check for the members without limits and create
                    else if (currentLimits.RemainingVolume == -1 && currentLimits.maxVolumeLimit == -1 && !session.LimitsHasModified)
                    {
                        var currentLoggedInCounrtyCode      = Locale.Substring(3);
                        DistributorLoader distributorLoader = new DistributorLoader();
                        var distributorProfile = distributorLoader.Load(distributorId, currentLoggedInCounrtyCode);

                        var remainingVolume = HLConfigManager.Configurations.ShoppingCartConfiguration.eLearningMaxPPV - distributorProfile.PersonallyPurchasedVolume;
                        //PurchasingLimits_V01 newLimits = new PurchasingLimits_V01();
                        currentLimits.Month                 = currentLimits.Month;
                        currentLimits.LastRead              = DateTime.UtcNow;
                        currentLimits.RemainingVolume       = distributorProfile.PersonallyPurchasedVolume != 0 ? remainingVolume : 0;
                        currentLimits.LimitsRestrictionType = LimitsRestrictionType.PurchasingLimits;
                        currentLimits.PurchaseLimitType     = limitType;
                        currentLimits.LastRead              = DateTime.UtcNow;
                        currentLimits.maxVolumeLimit        = HLConfigManager.Configurations.ShoppingCartConfiguration.eLearningMaxPPV;
                        session.LimitsHasModified           = true;
                    }
                }
            }
            else
            {
                base.SetPurchaseRestriction(tins, orderMonth, distributorId, manager);
            }

            if (currentLimits == null)
            {
                return;
            }
            SetLimits(orderMonth, manager, currentLimits);
        }
        private void checkLimits(MyHLShoppingCart hlCart)
        {
            var currentLimits = PurchasingLimitProvider.GetCurrentPurchasingLimits(hlCart.DistributorID);

            var    session      = SessionInfo.GetSessionInfo(hlCart.DistributorID, hlCart.Locale);
            string trainingCode = HLConfigManager.Configurations.ShoppingCartConfiguration.TrainingCode;

            if (session.DsTrainings == null || session.DsTrainings.Count == 0)
            {
                session.DsTrainings = DistributorOrderingProfileProvider.GetTrainingList(hlCart.DistributorID, hlCart.CountryCode);
            }
            if (session.DsTrainings != null && session.DsTrainings.Count > 0 &&
                session.DsTrainings.Exists(t => t.TrainingCode == trainingCode && !t.TrainingFlag))
            {
                //if is true the member place an order without taking the training and the limits shoud be applicable for only 1100
                if (currentLimits.RemainingVolume != currentLimits.maxVolumeLimit && !session.LimitsHasModified)
                {
                    var used     = (currentLimits.maxVolumeLimit - currentLimits.RemainingVolume);
                    var shouldbe = 1100 - used;
                    PurchaseLimitType limitType = PurchaseLimitType.Volume;
                    currentLimits.PurchaseLimitType = limitType;
                    if (currentLimits.RemainingVolume != shouldbe && shouldbe > 0 && !session.LimitsHasModified)
                    {
                        currentLimits.RemainingVolume = HLConfigManager.Configurations.ShoppingCartConfiguration.eLearningMaxPPV - (currentLimits.maxVolumeLimit - currentLimits.RemainingVolume);
                        session.LimitsHasModified     = true;
                    }
                    string country = DistributorProfileModel.ProcessingCountryCode;
                    PurchasingLimitProvider.savePurchasingLimitsToCache(ConvertCurrentLimitsToSave(currentLimits), hlCart.DistributorID);
                    PurchasingLimitProvider.SavePurchaseLimitsToStore(country, hlCart.DistributorID);
                }
                //check for the members without limits and create
                else if (currentLimits.RemainingVolume == -1 && currentLimits.maxVolumeLimit == -1 && !session.LimitsHasModified)
                {
                    var currentLoggedInCounrtyCode      = Locale.Substring(3);
                    DistributorLoader distributorLoader = new DistributorLoader();
                    var distributorProfile = distributorLoader.Load(hlCart.DistributorID, currentLoggedInCounrtyCode);

                    var remainingVolume         = HLConfigManager.Configurations.ShoppingCartConfiguration.eLearningMaxPPV - distributorProfile.PersonallyPurchasedVolume;
                    PurchaseLimitType limitType = PurchaseLimitType.Volume;
                    //PurchasingLimits_V01 newLimits = new PurchasingLimits_V01();
                    currentLimits.Month                 = currentLimits.Month;
                    currentLimits.LastRead              = DateTime.UtcNow;
                    currentLimits.RemainingVolume       = distributorProfile.PersonallyPurchasedVolume != 0 ? remainingVolume : 0;
                    currentLimits.LimitsRestrictionType = LimitsRestrictionType.PurchasingLimits;
                    currentLimits.PurchaseLimitType     = limitType;
                    currentLimits.LastRead              = DateTime.UtcNow;
                    currentLimits.maxVolumeLimit        = HLConfigManager.Configurations.ShoppingCartConfiguration.eLearningMaxPPV;
                    session.LimitsHasModified           = true;
                    string country = DistributorProfileModel.ProcessingCountryCode;
                    PurchasingLimitProvider.savePurchasingLimitsToCache(ConvertCurrentLimitsToSave(currentLimits), hlCart.DistributorID);
                    PurchasingLimitProvider.SavePurchaseLimitsToStore(country, hlCart.DistributorID);
                }
            }
        }
        protected override void fillPaymentInfo()
        {
            base.fillPaymentInfo();

            if ((this.Page as ProductsBase) != null &&
                ((ProductsBase)this.Page).CountryCode == "MY" &&
                CurrentPaymentInfo is CreditPayment_V01 &&
                ((CreditPayment_V01)CurrentPaymentInfo).AuthorizationMethod == AuthorizationMethodType.PaymentGateway)
            {
                pnlFPXData.Visible = true;
                var           sessionData       = SessionInfo.GetSessionInfo(((ProductsBase)this.Page).DistributorID, ((ProductsBase)this.Page).Locale);
                List <string> paymentGatewayLog = OrderProvider.GetPaymentGatewayLog(sessionData.OrderNumber, PaymentGatewayLogEntryType.Response);
                if (null != paymentGatewayLog)
                {
                    string theOne = paymentGatewayLog.Find(i => i.Contains("QueryString: Agency:=FpxPaymentGateway"));
                    if (!string.IsNullOrEmpty(theOne))
                    {
                        var dataLog = paymentGatewayLog.LastOrDefault();
                        if (null != dataLog)
                        {
                            NameValueCollection response = GetRequestVariables(theOne);
                            var dictionary = response.AllKeys.ToDictionary(k => k, k => response[k]);
                            lblMerchantName.Text       = FormatTextData(dictionary, "", HLConfigManager.Configurations.PaymentsConfiguration.FPXMerchantName);
                            lblFPXTransactionId.Text   = FormatTextData(dictionary, "fpx_fpxTxnId:");
                            lblProductDescription.Text = FormatTextData(dictionary, "fpx_sellerOrderNo:", "Herbalife order - ");
                            var dateTimeFormat = HLConfigManager.Configurations.DOConfiguration.DateTimeFormat;
                            lblDateAndTime.Text         = FormatTextData(dictionary, "fpx_fpxTxnTime:", "", dateTimeFormat);
                            lblBuyerBank.Text           = FormatTextData(dictionary, "fpx_buyerBankBranch:");
                            lblBankReferenceNumber.Text = FormatTextData(dictionary, "fpx_debitAuthNo:");
                            string pghPaymentStatus = String.Empty;
                            if (Session[PaymentGatewayResponse.PGH_FPX_PaymentStatus] != null)
                            {
                                pghPaymentStatus = (string)Session[PaymentGatewayResponse.PGH_FPX_PaymentStatus];
                                if (!string.IsNullOrEmpty(pghPaymentStatus))
                                {
                                    lblTransactionStatus.Text = FormatTextData(dictionary, "", pghPaymentStatus);
                                }
                            }
                            if (pghPaymentStatus == "Declined")
                            {
                                lblProductDescription.Visible     = false;
                                lblProductDescriptionText.Visible = false;
                                lblReference.Visible     = false;
                                lblReferenceText.Visible = false;
                            }
                        }
                    }
                }
            }
            else
            {
                pnlFPXData.Visible = false;
            }
        }
        protected void CreateHapOrder_Click(object sender, EventArgs e)
        {
            if (ShoppingCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.HSO)
            {
                ShoppingCart.CloseCart(true);
            }
            var sessionInfo = SessionInfo.GetSessionInfo(this.DistributorID, this.Locale);

            sessionInfo.CreateHapOrder = true;
            // Systems launches HAP order items price list page
            Response.Redirect("~/Ordering/PriceList.aspx?HAP=True");
        }
Example #24
0
        public void PerformTaxationRules(Order_V01 order, string locale)
        {
            try
            {
                Message message = new Message();
                message.MessageType  = "OrderType";
                message.MessageValue = "RSO";

                Message messageBoleta = new Message();
                messageBoleta.MessageType  = "TypePerceptions";
                messageBoleta.MessageValue = "Boleta";

                if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.EventTicketOrderType))
                {
                    var sessionInfo = SessionInfo.GetSessionInfo(order.DistributorID, locale);
                    if (null != sessionInfo)
                    {
                        message.MessageValue = sessionInfo.IsEventTicketMode ? "ETO" : "RSO";
                    }
                    if ("RSO" == message.MessageValue)
                    {
                        List <TaxIdentification> tins = DistributorOrderingProfileProvider.GetTinList(order.DistributorID, true);
                        TaxIdentification        tid  = null;
                        var isPeid = (tid = tins.Find(t => t.IDType.Key == "PEID")) != null;
                        var isPetx = (tid = tins.Find(t => t.IDType.Key == "PETX")) != null;
                        if ((isPEDs && isPetx && isPeid) || (isPEDs && isPetx))
                        {
                            messageBoleta.MessageValue = "Factura";
                        }
                    }
                }

                if (order.Messages == null)
                {
                    order.Messages = new MessageCollection();
                }
                order.Messages.Add(message);
                bool enable = Settings.GetRequiredAppSetting <bool>("PEperceptionsEnable", true);
                if (enable)
                {
                    order.Messages.Add(messageBoleta);
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(
                    string.Format("PE Taxation Rules failed for Distributor {0}. Exception details \r\n{1}",
                                  order.DistributorID, ex.Message));
            }
        }
        public override void Submit()
        {
            string redirectUrl = _config.PaymentGatewayUrl;
            string mode        = _configHelper.GetConfigEntry("paymentGatewayMode") == "0" ? "Y" : "N"; // Y means test, N means live
            int    price       = Convert.ToInt32(_orderAmount * 100);
            string merchantId  = _configHelper.GetConfigEntry("merchantAccount");
            string language    = _config.PaymentGatewayStyle;         // "PL";
            string ip          = _config.PaymentGatewayApplicationId; // "63.192.82.30";

            MyHLShoppingCart myCart;
            SessionInfo      sessionInfoMyCart = SessionInfo.GetSessionInfo(this._distributorId, this._locale);

            myCart = sessionInfoMyCart.ShoppingCart
                     ?? ShoppingCartProvider.GetShoppingCart(this._distributorId, this._locale);
            var    address = myCart.DeliveryInfo.Address.Address;
            string email   = (null != myCart && !string.IsNullOrEmpty(myCart.EmailAddress)) ? myCart.EmailAddress.ToString() : string.Empty;

            HttpContext.Current.Response.Clear();
            StringBuilder sb = new StringBuilder();

            sb.Append("<html>");
            sb.AppendFormat(@"<body onload='document.forms[""form""].submit()'>");
            sb.AppendFormat("<form name='form' action='{0}' method='post'>", redirectUrl);
            sb.AppendFormat("<input type='hidden' name='pos_id' value='{0}'>", merchantId);
            sb.AppendFormat("<input type='hidden' name='order_id' value='{0}'>", this.OrderNumber);
            sb.AppendFormat("<input type='hidden' name='amount' value='{0}'>", price);
            sb.AppendFormat("<input type='hidden' name='test' value='{0}'>", mode);
            sb.AppendFormat("<input type='hidden' name='language' value='{0}'>", language);
            sb.AppendFormat("<input type='hidden' name='client_ip' value='{0}'>", ip);
            sb.AppendFormat("<input type='hidden' name='street' value='{0}'>", address.Line1);
            sb.AppendFormat("<input type='hidden' name='street_n1' value='{0}'>", address.Line2 ?? string.Empty);
            sb.AppendFormat("<input type='hidden' name='street_n2' value='{0}'>", address.Line3 ?? string.Empty);
            sb.AppendFormat("<input type='hidden' name='phone' value='{0}'>", "");
            sb.AppendFormat("<input type='hidden' name='city' value='{0}'>", address.City);
            sb.AppendFormat("<input type='hidden' name='postcode' value='{0}'>", address.PostalCode);
            sb.AppendFormat("<input type='hidden' name='country' value='{0}'>", address.Country);
            sb.AppendFormat("<input type='hidden' name='email' value='{0}'>", email);
            // sb.AppendFormat("<input type='submit' value='Pay'>");
            sb.Append("</form>");
            sb.Append("</body>");
            sb.Append("</html>");

            string response = sb.ToString();

            PaymentGatewayInvoker.LogMessage(PaymentGatewayLogEntryType.Request, this.OrderNumber, this._distributorId, this._gatewayName, PaymentGatewayRecordStatusType.Unknown, response);

            HttpContext.Current.Response.Write(response);
            HttpContext.Current.Response.End();
        }
Example #26
0
        private decimal getAmountDue()
        {
            MyHLShoppingCart myCart;
            SessionInfo      sessionInfoMyCart = SessionInfo.GetSessionInfo(this._distributorId, this._locale);

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

            OrderTotals_V01 totals = myCart.Totals as OrderTotals_V01;

            return(OrderProvider.GetConvertedAmount(totals.AmountDue, this._country));
        }
        public void PrintWebControl()
        {
            var ispc = Request.QueryString["IsPC"];
            var stringWrite = new StringWriter();
            var htmlWrite = new HtmlTextWriter(stringWrite);

            var pg = new Page();
            pg.EnableEventValidation = false;
            var frm = new HtmlForm();
            pg.Controls.Add(frm);
            frm.Attributes.Add("runat", "server");

            var currentProduct = Session["CurrentProduct"] as ProductInfo_V02;
            if (currentProduct != null)
            {
                var member = (MembershipUser<DistributorProfileModel>)Membership.GetUser();
                var user = member.Value;
                string locale = CultureInfo.CurrentCulture.Name;
                SessionInfo sessionInfo = SessionInfo.GetSessionInfo(user.Id, locale);


                MyHLShoppingCart shoppingCart = ShoppingCartProvider.GetShoppingCart(user.Id, locale);
                ProductInfoCatalog_V01 ProductInfoCatalog = CatalogProvider.GetProductInfoCatalog(locale, 
                                                                                                  shoppingCart
                                                                                                      .DeliveryInfo !=
                                                                                                  null
                                                                                                      ? shoppingCart
                                                                                                            .DeliveryInfo
                                                                                                            .WarehouseCode
                                                                                                      : HLConfigManager
                                                                                                            .Configurations
                                                                                                            .ShoppingCartConfiguration
                                                                                                            .DefaultWarehouse);

                var ucPrintThisPage =
                    LoadControl("~/Ordering/Controls/PrintThisPageContent.ascx") as PrintThisPageContent;
                ucPrintThisPage.BindProduct(currentProduct, sessionInfo.ShowAllInventory, ProductInfoCatalog.AllSKUs,ispc);
                frm.Controls.Add(ucPrintThisPage);
            }

            pg.DesignerInitialize();
            pg.RenderControl(htmlWrite);

            ClientScript.RegisterStartupScript(GetType(), "PrintThisProduct", stringWrite.ToString());
            ClientScript.RegisterStartupScript(GetType(), "PrintPage", "<script>window.print();</script>");
            ClientScript.RegisterStartupScript(GetType(), "CloseWindow",
                                               "<script>setTimeout('window.close()', 2000);</script>");
        }
        protected override void GetOrderNumber()
        {
            var currentSession = SessionInfo.GetSessionInfo(HttpContext.Current.User.Identity.Name, _locale);

            if (currentSession != null && !string.IsNullOrEmpty(currentSession.OrderNumber))
            {
                _orderNumber = currentSession.OrderNumber;

                string orderData = _context.Session[PaymentGateWayOrder] as string;
                _context.Session.Remove(PaymentGateWayOrder);
            }
            else
            {
                base.GetOrderNumber();
            }
        }
        public static bool RequireTraining(string distributorID, string locale, string countryCode)
        {
            var    session      = SessionInfo.GetSessionInfo(distributorID, locale);
            string trainingCode = HLConfigManager.Configurations.ShoppingCartConfiguration.TrainingCode;

            if (session.DsTrainings == null)
            {
                session.DsTrainings = DistributorOrderingProfileProvider.GetTrainingList(distributorID, countryCode);
            }

            if (session.DsTrainings != null && session.DsTrainings.Count > 0 && session.DsTrainings.Exists(t => t.TrainingCode == trainingCode && !t.TrainingFlag))
            {
                return(true);
            }
            return(false);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string         key      = PaymentsConfiguration.GetCurrentPaymentSessionKey(this.Locale, this.DistributorID);
            List <Payment> payments = SessionInfo.GetSessionInfo(this.DistributorID, this.Locale).Payments;

            if (null == payments)
            {
                payments = Session[key] as List <Payment>;
            }
            if (null != payments && payments.Count > 0)
            {
                dlPaymentInfo.DataSource = payments;
                dlPaymentInfo.DataBind();
                CurrentPaymentInfo = payments;
            }
            SessionInfo.GetSessionInfo(this.DistributorID, this.Locale).Payments = null;
        }