private void bindData()
        {
            string locale   = CultureInfo.CurrentCulture.Name;
            var    MyOrders = OrdersProvider.GetOrdersInProcessing(DistributorID, locale);

            OrdersGrid.DataSource = MyOrders;
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HLConfigManager.Configurations.DOConfiguration.IsResponsive && (Master as OrderingMaster).IsMobile())
            {
                //Response.Redirect("~/ordering/PriceList.aspx?ETO=False", false);
            }
            if (DisplayCCMessage && HLConfigManager.Configurations.DOConfiguration.AllowToDispalyCCMessage)
            {
                alertNoCC.Visible   = true;
                imgWarning.Visible  = true;
                imgWarning.ImageUrl = "~/Ordering/Images/Icons/smallWarningIcon.png";
                lblCraditcard.Attributes["class"] = "cc-label";
                lblCraditcard.Text = Convert.ToString(HttpContext.GetGlobalResourceObject(
                                                          string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                                          "DisplayCCMessage") ?? "You do not have a valid Credit Card on file.");
                lnkSavedCards.Text = Convert.ToString(HttpContext.GetGlobalResourceObject(
                                                          string.Format("{0}_ErrorMessage", HLConfigManager.Platform),
                                                          "DisplayCCLink") ?? " Click here to enter a new credit card or correct the existing ones");
            }
            if (!IsPostBack)
            {
                if (Session["showedAPFPopup"] == null)
                {
                    Session["showedAPFPopup"] = false;
                }
                if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                {
                    var orders = OrdersProvider.GetOrdersInProcessing(DistributorID, Locale);

                    if (orders != null && orders.Any())
                    {
                        var orderNumber = orders.FirstOrDefault().OrderId;
                        ViewState["pendingOrderNumber"] = orderNumber;
                        var isOrderSubmitted = CheckPendingOrderStatus("CN_99BillPaymentGateway", orderNumber);
                        ViewState["isOrderSubmitted"] = isOrderSubmitted;
                        if (isOrderSubmitted)
                        {
                            lblDupeOrderMessage.Text =
                                string.Format(GetLocalResourceObject("PendingOrderSubmittedResource").ToString(),
                                              orderNumber);
                        }
                        else
                        {
                            lblDupeOrderMessage.Text = GetLocalResourceObject("PendingOrderResource.Text") as string;
                        }
                        dupeOrderPopupExtender.Show();
                        divChinaPCMessageBox.Visible = SessionInfo.IsReplacedPcOrder;
                    }
                }

                if (Request.QueryString["SKU"] != null)
                {
                    if (Request.QueryString["CMP"] != null)
                    {
                        navigateToProductDetailPage(Request.QueryString["SKU"], Request.QueryString["CMP"]);
                    }
                    else
                    {
                        navigateToProductDetailPage(Request.QueryString["SKU"], null);
                    }
                }

                (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageResource1.Title") as string);

                // Make sure that a shopping cart exists.
                if (ShoppingCart == null)
                {
                    throw new ApplicationException("ShoppingCart is null. Shopping cart value is required.");
                }

                if (ShoppingCart != null && ShoppingCart.OrderCategory == OrderCategoryType.ETO)
                {
                    (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("EventTickets.Title") as string);
                    Page.Title = GetLocalResourceObject("EventTickets.Title") as string;
                }
                dataBind();
                //CatchRedirectedEvent();

                DisplayAPFMessage();
                SetNqsMessage();
                // TODO: Please remove this code
                // This is for HFF Modal control testing
                //if (HL.MyHerbalife.Providers.ConfigurationManagement.HLConfigManager.Configurations.DOConfiguration.AllowHFFModal && this.ShoppingCart.OrderCategory == OrderCategoryType.RSO)
                //{
                //    var _hFFModal = LoadControl("~/Ordering/Controls/HFFModal.ascx") as HFFModal;
                //    this.plHFFModal.Controls.Add(_hFFModal);
                //}
                if (SessionInfo != null && !SessionInfo.IsAPFOrderFromPopUp)
                {
                    SessionInfo.IsAPFOrderFromPopUp = false;
                }
                var allowedCountries = HL.Common.Configuration.Settings.GetRequiredAppSetting("AllowAPFPopupForStandAloneContries", "CH");
                if (!(bool)Session["showedAPFPopup"] && allowedCountries.Contains(Locale.Substring(3)) && (APFDueProvider.IsAPFDueWithinOneYear(DistributorID, Locale.Substring(3)) || APFDueProvider.IsAPFDueAndNotPaid(DistributorID, Locale)))
                {
                    APFDuermndrPopUp.ShowPopUp();
                }
                if (HLConfigManager.Configurations.AddressingConfiguration.HasAddressRestriction)
                {
                    List <DeliveryOption> shippingAddresses =
                        (Page as ProductsBase).GetShippingProvider()
                        .GetShippingAddresses((Page as ProductsBase).DistributorID,
                                              (Page as ProductsBase).Locale)
                        .Where(s => s.HasAddressRestriction == true)
                        .ToList();
                    if (shippingAddresses.Count == 0)
                    {
                        AddressResPopUP1.ShowAddressRestrictionPopUp();
                    }
                }
            }
            else
            {
                findAndSetFirstRootCategory(IsEventTicketMode);
            }
            if (null != ShoppingCart && null != ShoppingCart.DeliveryInfo)
            {
                hfWarehouseCode.Value = string.Format("Warehouse Code : {0}", ShoppingCart.DeliveryInfo.WarehouseCode);
            }
            DisplayELearningMessage();
            if (HLConfigManager.Configurations.DOConfiguration.CheckSKUExpirationDate)
            {
                ExpireDatePopUp1.ShowPopUp();
            }
        }
Esempio n. 3
0
        /// <summary>
        ///     Page load method.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">EventArgs arguments.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StaticCopyOrderIndex     = 0;
                StaticCopyOrderMaxLength = 8;

                (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageResource1.Title") as string);
                pMessaging.InnerText = GetLocalResourceObject("SaveCartMessaging") as string;
                if (ShoppingCart.CartItems.Count != 0)
                {
                    txtSaveCartName.Text = SaveCartCommand.SuggestCartName(ShoppingCart.DeliveryInfo, string.Empty,
                                                                           DistributorID, Locale);
                }

                // Avoiding a jquery error.
                CartsGrid.CreateTableView();

                // Loading sort dropdown options
                ddlOrderBy.Items.Add(new RadComboBoxItem(GetLocalResourceString("SortExp_ca"), "ca"));
                ddlOrderBy.Items.Add(new RadComboBoxItem(GetLocalResourceString("SortExp_cz"), "cz"));
                ddlOrderBy.Items.Add(new RadComboBoxItem(GetLocalResourceString("SortExp_sa"), "sa"));
                ddlOrderBy.Items.Add(new RadComboBoxItem(GetLocalResourceString("SortExp_sz"), "sz"));
                ddlOrderBy.Items.Add(new RadComboBoxItem(GetLocalResourceString("SortExp_da"), "da"));
                ddlOrderBy.Items.Add(new RadComboBoxItem(GetLocalResourceString("SortExp_dz"), "dz"));

                // Refresh order shipping addresses
                var provider = new ShippingProviderBase();
                provider.ReloadOrderShippingAddressFromService(StaticDistributorID, StaticLocale);

                // Loading recent orders and saved carts.
                ShoppingCartProvider.ResetInternetShoppingCartsCache(StaticDistributorID, StaticLocale);
                ShoppingCartProvider.GetInternetShoppingCarts(StaticDistributorID, StaticLocale, StaticCopyOrderIndex,
                                                              StaticCopyOrderMaxLength, false);
                ShoppingCartProvider.GetCarts(StaticDistributorID, StaticLocale, true, false);

                // Hidding grid until loads.
                CartsGrid.Style.Add(HtmlTextWriterStyle.Display, "none");

                // Initial sort selected value.
                ddlOrderBy.SelectedValue = "da";

                if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                {
                    var orders = OrdersProvider.GetOrdersInProcessing(DistributorID, Locale);
                    if (orders != null && orders.Any())
                    {
                        var orderNumber = orders.FirstOrDefault().OrderId;
                        ViewState["pendingOrderNumber"] = orderNumber;
                        var isOrderSubmitted = CheckPendingOrderStatus("CN_99BillPaymentGateway", orderNumber);
                        ViewState["isOrderSubmitted"] = isOrderSubmitted;
                        if (isOrderSubmitted)
                        {
                            lblDupeOrderMessage.Text =
                                string.Format(GetLocalResourceObject("PendingOrderSubmittedResource").ToString(),
                                              orderNumber);
                        }
                        else
                        {
                            lblDupeOrderMessage.Text = GetLocalResourceObject("PendingOrderResource.Text") as string;
                        }
                        dupeOrderPopupExtender.Show();
                    }
                    divChinaPCMessageBox.Visible = SessionInfo.IsReplacedPcOrder;
                    var OrderTotals = ShoppingCart != null ? ShoppingCart.Totals != null ? ShoppingCart.Totals as OrderTotals_V02 : null : null;
                    if (HLConfigManager.Configurations.DOConfiguration.IsChina && OrderTotals != null && (OrderTotals.AmountDue - OrderTotals.Donation == 0))
                    {
                        ShoppingCart.DeliveryInfo = null;
                    }
                }

                if (HLConfigManager.Configurations.DOConfiguration.DisplayNonResidentsMessage)
                {
                    contentReader.ContentPath = @"NonResidentsDisclaimer.html";
                    contentReader.LoadContent();
                }
            }

            CartsGrid.MasterTableView.PagerStyle.PagerTextFormat = GetLocalResourceObject("PagerTextFormat") as string;
            if (ShoppingCart.CartItems.Count == 0 || ShoppingCart.IsSavedCart)
            {
                mdlClearCart.TargetControlID = "FakeTarget";
                NewOrder.Click += OnNewOrder;
            }

            IsShoppingCartNotEmpty = !mdlClearCart.TargetControlID.Equals("FakeTarget");

            (Master as OrderingMaster).gdoNavMidCSS("gdo-nav-mid col-sm-7 gdo-nav-mid-sc");
            if (HLConfigManager.Configurations.AddressingConfiguration.HasAddressRestriction)
            {
                List <DeliveryOption> shippingAddresses =
                    (Page as ProductsBase).GetShippingProvider()
                    .GetShippingAddresses((Page as ProductsBase).DistributorID,
                                          (Page as ProductsBase).Locale)
                    .Where(s => s.HasAddressRestriction == true)
                    .ToList();
                if (shippingAddresses.Count == 0)
                {
                    AddressResPopUP1.ShowAddressRestrictionPopUp();
                }
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EnableViewState = true;
            if (HLConfigManager.Configurations.DOConfiguration.IsChina)
            {
                txtSearchTerm.CssClass = "productInput gdo-order-sku-input";
                txtSearchTerm.Width    = Unit.Percentage(98);
            }
            if (!IsPostBack)
            {
                if (AllSKUS.Any())
                {
                    if (IsChina)
                    {
                        Products = AllSKUS.Where(sku => sku.Value.ProductAvailability == ProductAvailabilityType.Available && sku.Value.IsDisplayable && sku.Value.IsPurchasable)
                                   .Select(
                            sku =>
                        {
                            var str = string.Concat(sku.Key, " ",
                                                    sku.Value.Product != null ? sku.Value.Product.Overview != null ? Regex.Replace(sku.Value.Product.Overview, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.DisplayName != null ? Regex.Replace(sku.Value.Product.DisplayName, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.Usage != null ? Regex.Replace(sku.Value.Product.Usage, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.SpecialNotes != null ? Regex.Replace(sku.Value.Product.SpecialNotes, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.FastFacts != null ? Regex.Replace(sku.Value.Product.FastFacts, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.Benefits != null ? Regex.Replace(sku.Value.Product.Benefits, "<.*?>", String.Empty) + " " : string.Empty : string.Empty);
                            return(str);
                        }
                            );

                        ProductsClone = AllSKUS.Where(sku => sku.Value.ProductAvailability == ProductAvailabilityType.Available && sku.Value.IsDisplayable && sku.Value.IsPurchasable)
                                        .Select(
                            sku =>
                        {
                            var str = string.Concat(sku.Key, " ",
                                                    sku.Value.Product != null ? sku.Value.Product.Overview != null ? sku.Value.Product.Overview + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.DisplayName != null ? sku.Value.Product.DisplayName + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.Usage != null ? sku.Value.Product.Usage + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.SpecialNotes != null ? sku.Value.Product.SpecialNotes + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.FastFacts != null ? sku.Value.Product.FastFacts + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.Benefits != null ? sku.Value.Product.Benefits + " " : string.Empty : string.Empty);
                            return(str);
                        }
                            );
                    }
                    else
                    {
                        Products = AllSKUS.Where(sku => sku.Value.ProductAvailability == ProductAvailabilityType.Available)
                                   .Select(
                            sku =>
                        {
                            var str = string.Concat(sku.Key, " ",
                                                    sku.Value.Product != null ? sku.Value.Product.Overview != null ? Regex.Replace(sku.Value.Product.Overview, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.DisplayName != null ? Regex.Replace(sku.Value.Product.DisplayName, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.Usage != null ? Regex.Replace(sku.Value.Product.Usage, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.SpecialNotes != null ? Regex.Replace(sku.Value.Product.SpecialNotes, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.FastFacts != null ? Regex.Replace(sku.Value.Product.FastFacts, "<.*?>", String.Empty) + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.Benefits != null ? Regex.Replace(sku.Value.Product.Benefits, "<.*?>", String.Empty) + " " : string.Empty : string.Empty);
                            return(str);
                        }
                            );

                        ProductsClone = AllSKUS.Where(sku => sku.Value.ProductAvailability == ProductAvailabilityType.Available)
                                        .Select(
                            sku =>
                        {
                            var str = string.Concat(sku.Key, " ",
                                                    sku.Value.Product != null ? sku.Value.Product.Overview != null ? sku.Value.Product.Overview + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.DisplayName != null ? sku.Value.Product.DisplayName + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.Usage != null ? sku.Value.Product.Usage + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.SpecialNotes != null ? sku.Value.Product.SpecialNotes + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.FastFacts != null ? sku.Value.Product.FastFacts + " " : string.Empty : string.Empty,
                                                    sku.Value.Product != null ? sku.Value.Product.Benefits != null ? sku.Value.Product.Benefits + " " : string.Empty : string.Empty);
                            return(str);
                        }
                            );
                    }
                }
                (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageResource1.Title") as string);

                if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                {
                    var orders = OrdersProvider.GetOrdersInProcessing(DistributorID, Locale);
                    if (orders != null && orders.Any())
                    {
                        var orderNumber = orders.FirstOrDefault().OrderId;
                        ViewState["pendingOrderNumber"] = orderNumber;
                        var isOrderSubmitted = CheckPendingOrderStatus("CN_99BillPaymentGateway", orderNumber);
                        ViewState["isOrderSubmitted"] = isOrderSubmitted;
                        if (isOrderSubmitted)
                        {
                            lblDupeOrderMessage.Text =
                                string.Format(GetLocalResourceObject("PendingOrderSubmittedResource").ToString(),
                                              orderNumber);
                        }
                        else
                        {
                            lblDupeOrderMessage.Text = GetLocalResourceObject("PendingOrderResource.Text") as string;
                        }
                        dupeOrderPopupExtender.Show();
                    }
                    divChinaPCMessageBox.Visible = SessionInfo.IsReplacedPcOrder;
                    var OrderTotals = ShoppingCart != null ? ShoppingCart.Totals != null ? ShoppingCart.Totals as OrderTotals_V02 : null : null;
                    if (HLConfigManager.Configurations.DOConfiguration.IsChina && OrderTotals != null && (OrderTotals.AmountDue - OrderTotals.Donation == 0))
                    {
                        ShoppingCart.DeliveryInfo = null;
                    }
                }
            }

            mpProductDetail = (ModalPopupExtender)ucProductDetail.FindControl("ppProductDetail");
        }