private void ReadFromData() { DistributorOrderingProfile distributorOrderingProfile = DistributorOrderingProfileProvider.GetProfile(DistributorID, CountryCode); _distributorId = DistributorID; _apfDueDate = distributorOrderingProfile.ApfDueDate; if (_testing) { APFDueProvider.UpdateAPFDuePaid(_distributorId, _apfDueDate); } _apfSku = APFDueProvider.GetAPFSku(); _cart = (Page as ProductsBase).ShoppingCart; _apfIsDue = APFDueProvider.IsAPFDueAndNotPaid(_distributorId, HLConfigManager.Configurations.Locale); _apfDueWithinOneYear = APFDueProvider.IsAPFDueWithinOneYear(_distributorId, CountryCode); _apfDueGreaterThanOneYear = APFDueProvider.IsAPFDueGreaterThanOneYear(_distributorId, CountryCode); if (_apfIsDue) { _apfsDue = APFDueProvider.APFQuantityDue(_distributorId, HLConfigManager.Configurations.Locale); } List <ShoppingCartItem_V01> item = (from c in _cart.CartItems where c.SKU == _apfSku select c).ToList(); _apfsInCart = 0; if (item.Count > 0) { _apfsInCart = item[0].Quantity; } }
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) { DistributorOrderingProfile dsProfile = DistributorOrderingProfileProvider.GetProfile(DistributorID, CountryCode); string DSType = dsProfile.OrderSubType; //lblProductType.Visible = false; if (!IsPostBack) { if (ShoppingCart.OrderCategory == OrderCategoryType.ETO) { trOrderType.Visible = false; trRemainingVal.Visible = false; ShoppingCart.SelectedDSSubType = "D2"; PurchasingLimitProvider.GetPurchasingLimits(DistributorID, "ETO"); return; } else { if (ShoppingCart.SelectedDSSubType == "ETO") { ShoppingCart.SelectedDSSubType = String.Empty; } } //lblPickupLocation.Visible = ddlPickup.Visible = false; bool noConsignmentOrdersAllowed = false; if (DSType.Equals("A") || DSType.Equals("B")) { if (APFDueProvider.IsAPFDueAndNotPaid(DistributorID, Locale)) { noConsignmentOrdersAllowed = true; } } //Begin HD Ticket 406707 if (ShoppingCart.OrderSubType == "A2" || ShoppingCart.OrderSubType == "B2") { bool isAPFDue = APFDueProvider.IsAPFDueAndNotPaid(DistributorID, Locale) || APFDueProvider.IsAPFDueWithinOneYear(DistributorID, CountryCode) || APFDueProvider.IsAPFDueGreaterThanOneYear(DistributorID, CountryCode); if (!isAPFDue) { //delete APF SKU from cart ShoppingCart.DeleteItemsFromCart(APFDueProvider.GetAPFSkuList()); } } //End HD Ticket 406707 if (noConsignmentOrdersAllowed) { lbltext.Text = GetLocalResourceObject("CannotPlaceConsignmentWhileAPFDue") as string; lbltext.Visible = true; } ddl_DSSubType.Enabled = false; //ddlDelivery.Enabled = false; trRemainingVal.Visible = false; switch (DSType) { case "A": ddl_DSSubType.Items.Clear(); if (!HideEmptyListItem) { ddl_DSSubType.Items.Add(string.Empty); } if (!noConsignmentOrdersAllowed) { ddl_DSSubType.Items.Add(new ListItem("Vendita a Cliente ", "A1")); //TODOD: Resx these } ddl_DSSubType.Items.Add(new ListItem("Uso Personale", "A2")); ddl_DSSubType.Enabled = true; if (!String.IsNullOrEmpty(ShoppingCart.SelectedDSSubType)) { ddl_DSSubType.ClearSelection(); ListItem item = ddl_DSSubType.Items.FindByValue(ShoppingCart.SelectedDSSubType); if (null != item) { item.Selected = true; lblOrderTypeVal.Text = item.Text; } //lblOrderTypeVal.Text = ddl_DSSubType.Items.FindByValue(ShoppingCart.SelectedDSSubType).Text; DisplayRemainingValues(ShoppingCart.SelectedDSSubType); } break; case "B": ddl_DSSubType.Items.Clear(); if (!HideEmptyListItem) { ddl_DSSubType.Items.Add(string.Empty); } if (!noConsignmentOrdersAllowed) { ddl_DSSubType.Items.Add(new ListItem("Vendita a Cliente", "B1")); DisplayRemainingValues(ShoppingCart.SelectedDSSubType); } ddl_DSSubType.Items.Add(new ListItem("Uso Personale", "B2")); ddl_DSSubType.Enabled = true; if (!String.IsNullOrEmpty(ShoppingCart.SelectedDSSubType)) { ddl_DSSubType.ClearSelection(); ListItem item = ddl_DSSubType.Items.FindByValue(ShoppingCart.SelectedDSSubType); if (null != item) { item.Selected = true; lblOrderTypeVal.Text = item.Text; } DisplayRemainingValues(ShoppingCart.SelectedDSSubType); trRemainingVal.Visible = true; } break; case "C": case "D": case "D2": case "E": if (DSType == "D") { DSType = "D2"; } lblOrderType.Visible = false; lblOrderTypeVal.Text = "Uso Personale"; ddl_DSSubType.Visible = false; ddl_DSSubType.Items.Clear(); ddl_DSSubType.Items.Add(new ListItem(DSType, DSType)); ddl_DSSubType.SelectedIndex = 0; //ddl_DSSubType.Enabled = false; //ddl_DSSubType.Items.Add(DSType); //ddlDelivery.Enabled = true; break; } if (ddl_DSSubType.SelectedItem != null) { ShoppingCart.SelectedDSSubType = ddl_DSSubType.SelectedItem.Value; } if (DisplayStatic) { if (DSType.Equals("A") || DSType.Equals("B")) { ddl_DSSubType.Visible = false; lblOrderTypeVal.Visible = true; } else if (DSType.Equals("D") || DSType.Equals("D2") || DSType.Equals("E")) { DisplayRemainingValues(DSType); } } else { if (DSType.Equals("A") || DSType.Equals("B")) { ddl_DSSubType.Visible = true; lblOrderTypeVal.Visible = false; } else if (DSType.Equals("D") || DSType.Equals("D2") || DSType.Equals("E")) { DisplayRemainingValues(DSType); } } if (this.FOPEnabled) { var limits = PurchasingLimitProvider.GetPurchasingLimits(DistributorID, DSType); if (limits != null && limits.LimitsRestrictionType == LimitsRestrictionType.FOP) { DisplayRemainingValues(DSType); } } } }
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(); } }