/// <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(); } } }
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(); } }
protected void Page_Load(object sender, EventArgs e) { if (HLConfigManager.Configurations.DOConfiguration.IsChina && !SessionInfo.IsReplacedPcOrder) { var SurveyEligibility = Providers.China.OrderProvider.GetCustomerSurvey(DistributorID); if (SurveyEligibility != null) { if (Session["CustomerSurveyCancelled"] == null || !Convert.ToBoolean(Session["CustomerSurveyCancelled"])) { Response.Redirect("Survey.aspx?@ctrl=CustomerSurvey"); } } else if (SessionInfo.surveyDetails != null && ShoppingCart.CartItems.Any() && ShoppingCart.CartItems.Find( x => x.SKU == SessionInfo.surveyDetails.SurveySKU.Trim()) == null && !SessionInfo.surveyDetails.SurveyCompleted) { Providers.China.OrderProvider.AddFreeGift( SessionInfo.surveyDetails.SurveySKU.Trim(), SessionInfo.surveyDetails.SurveySKUQuantity, ProductInfoCatalog.AllSKUs, ShoppingCart.DeliveryInfo.WarehouseCode, ShoppingCart); } } (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageHeaderProducts").ToString()); if (ShoppingCart.OrderCategory == OrderCategoryType.ETO) { (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageHeaderEvents").ToString()); } if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutOptionsControl)) { var _checkoutOptionsControl = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutOptionsControl); _checkoutOptions = _checkoutOptionsControl as CheckOutOptions; _checkoutOptions.IsStatic = (Page as ProductsBase).CheckoutOptionsAreStatic; plCartOptions.Controls.Add(_checkoutOptions); } if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutTotalsMiniControl)) { var _checkoutTotalsMini = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutTotalsMiniControl); plCheckOutTotalsMini.Controls.Add(_checkoutTotalsMini); } if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.CheckOutHAPOptionsControl) && HLConfigManager.Configurations.DOConfiguration.AllowHAP && ShoppingCart.OrderCategory == OrderCategoryType.HSO) { var _checkoutHAPOptions = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.CheckOutHAPOptionsControl); plCheckOutHAPOptions.Controls.Add(_checkoutHAPOptions); if (ShoppingCart.DsType == null) { var DistributorType = DistributorOrderingProfileProvider.CheckDsLevelType(DistributorID, CountryCode); ShoppingCart.DsType = DistributorType; } } if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutOrderSummary)) { _checkoutOrderSummary = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutOrderSummary) as CheckoutOrderSummary; _checkoutOrderSummary.DisplayReadOnlyGrid = false; _checkoutOrderSummary.OmnitureState = "scView"; plCheckOutOrderDetails.Controls.Add(_checkoutOrderSummary); } if (!IsPostBack) { // display cart name if (HLConfigManager.Configurations.DOConfiguration.AllowSavedCarts) { if (ShoppingCart != null && ShoppingCart.IsSavedCart && !ShoppingCart.IsFromCopy && !string.IsNullOrEmpty(ShoppingCart.CartName)) { SavedCartTitle.Visible = true; lblSavedCartName.Text = string.Format(GetLocalResourceObject("lblSavedCartName").ToString(), ShoppingCart.CartName); } } if (ShoppingCart != null && ShoppingCart.CartItems != null && ShoppingCart.CartItems.Count > 0) { if (ShoppingCart.DeliveryInfo != null) { var skuList = new List <SKU_V01>(); skuList.AddRange(from s in ShoppingCart.CartItems from k in AllSKUS where s.SKU == s.SKU select k.Value); CatalogProvider.GetProductAvailability(skuList, Locale, DistributorID, ShoppingCart.DeliveryInfo.WarehouseCode); } findCrossSell(ShoppingCart.CartItems); if (ShoppingCart.CustomerOrderDetail != null) { divcustomerOrderStaticMessage.Visible = true; lblCustomerOrderStaticMessage.Text = GetLocalResourceObject("CustomerOrderStaticMessage").ToString(); } } else { NoCrossSellFound(this, null); } // Process copy invoice var invoiceId = Request.QueryString["invoiceId"]; if (!string.IsNullOrEmpty(invoiceId) || IsFromMemberInvoice()) { var isCopingFromInvoice = Session["IsCopingFromInvoice"] as string; if (!string.IsNullOrEmpty(isCopingFromInvoice) && isCopingFromInvoice.Equals("Y")) { // Save the active cart if needed if (ShoppingCart.CartItems.Count != 0 && !ShoppingCart.IsSavedCart) { txtSaveCartName.Text = SaveCartCommand.SuggestCartName(ShoppingCart.DeliveryInfo, string.Empty, DistributorID, Locale); mdlClearCart.Show(); } else { CopyInvoice(); } } } if (HLConfigManager.Configurations.DOConfiguration.IsChina) { HLRulesManager.Manager.ProcessCart(ShoppingCart, ShoppingCartRuleReason.CartItemsAdded); } var allowedCountries = HL.Common.Configuration.Settings.GetRequiredAppSetting("AllowAPFPopupForStandAloneContries", "CH"); if (Session["showedAPFPopup"] == null) { Session["showedAPFPopup"] = false; } 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(); } } } if (HLConfigManager.Configurations.DOConfiguration.IsChina && DistributorOrderingProfile.IsTermConditionAlert) { // TermConditionPopupExtender.Show(); } (Master as OrderingMaster).SetDivSpacerVisibility(false); (Master as OrderingMaster).SetHeaderRowVisibility(false); //(this.Master as OrderingMaster).SetRightPanelStyle("margin", "13px 8px"); if (HLConfigManager.Configurations.DOConfiguration.IsResponsive && (Master as OrderingMaster).IsMobile()) { (Master as OrderingMaster).divLeftVisibility = true; } else { (Master as OrderingMaster).divLeftVisibility = false; } (Master as OrderingMaster).gdoNavMidCSS("gdo-nav-mid col-xs-12 col-sm-9 gdo-nav-mid-sp"); var strScript1 = @"$(document).ready(function() { scrollTo(0, 0); });"; ScriptManager.RegisterStartupScript(this, GetType(), "ScriptPopup", strScript1, true); DisplayELearningMessage(); if (HLConfigManager.Configurations.DOConfiguration.AllowHAP && SessionInfo.IsHAPMode && !string.IsNullOrEmpty(ShoppingCart.HAPAction) && ShoppingCart.HAPAction == "UPDATE") { divHapEditMessage.Visible = true; } if (HLConfigManager.Configurations.DOConfiguration.CheckSKUExpirationDate) { ExpireDatePopUp1.ShowPopUp(); } }