protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } if (!ThisCustomer.IsRegistered) { dtlPolls.Visible = false; } lblPoll.Text = AppLogic.GetString("polls.aspx.2", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); InitializeDataSource(); }
protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } SectionTitle = AppLogic.GetString("searchadv.aspx.1", SkinID, ThisCustomer.LocaleSetting); String st = CommonLogic.QueryStringCanBeDangerousContent("SearchTerm").Trim(); if (st.Length != 0) { DB.ExecuteSQL("insert into SearchLog(SearchTerm,CustomerID,LocaleSetting) values(" + DB.SQuote(CommonLogic.Ellipses(st, 97, true)) + "," + ThisCustomer.CustomerID.ToString() + "," + DB.SQuote(ThisCustomer.LocaleSetting) + ")"); } Package1.SetContext = this; }
protected override void OnInit(EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } // this may be overwridden by the XmlPackage below! SectionTitle = AppLogic.GetString("search.aspx.1", SkinID, ThisCustomer.LocaleSetting); string searchTermFromQueryString = CommonLogic.QueryStringCanBeDangerousContent("SearchTerm"); if (!CommonLogic.IsStringNullOrEmpty(searchTermFromQueryString) && AppLogic.AppConfigUSInt("MinSearchStringLength") <= searchTermFromQueryString.Length) { ctrlPageSearch.SearchText = searchTermFromQueryString; RunSearch(searchTermFromQueryString); } base.OnInit(e); }
protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } // this may be overwridden by the XmlPackage below! SectionTitle = AppLogic.GetString("requestcatalog.aspx.1", SkinID, ThisCustomer.LocaleSetting); reqFName.ErrorMessage = AppLogic.GetString("requestcatalog.aspx.9", SkinID, ThisCustomer.LocaleSetting); reqLName.ErrorMessage = AppLogic.GetString("requestcatalog.aspx.11", SkinID, ThisCustomer.LocaleSetting); reqAddr1.ErrorMessage = AppLogic.GetString("requestcatalog.aspx.14", SkinID, ThisCustomer.LocaleSetting); reqCity.ErrorMessage = AppLogic.GetString("requestcatalog.aspx.18", SkinID, ThisCustomer.LocaleSetting); reqZip.ErrorMessage = AppLogic.GetString("requestcatalog.aspx.22", SkinID, ThisCustomer.LocaleSetting); if (!IsPostBack) { InitializePageContent(); } }
protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } ProductID = CommonLogic.QueryStringUSInt("ProductID"); CategoryID = CommonLogic.QueryStringUSInt("CategoryID"); SectionID = CommonLogic.QueryStringUSInt("SectionID"); ManufacturerID = CommonLogic.QueryStringUSInt("ManufacturerID"); DistributorID = CommonLogic.QueryStringUSInt("DistributorID"); GenreID = CommonLogic.QueryStringUSInt("GenreID"); VectorID = CommonLogic.QueryStringUSInt("VectorID"); if (ProductID == 0) { if (IsAddToCartPostBack) { int PackID = 0; int packProductID = 0; int packVariantID = 0; int packQuantity = 0; int packProductTypeID = 0; bool FromCart = false; int packCartRecID = 0; String ChosenColor = String.Empty; String ChosenColorSKUModifier = String.Empty; String ChosenSize = String.Empty; String ChosenSizeSKUModifier = String.Empty; String color = string.Empty; String size = string.Empty; String TextOption = CommonLogic.FormCanBeDangerousContent("TextOption"); for (int i = 0; i <= HttpContext.Current.Request.Form.Count - 1; i++) { if (HttpContext.Current.Request.Form.Keys[i].StartsWith("ProductID", StringComparison.InvariantCultureIgnoreCase)) { packProductID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent("__EVENTARGUMENT").Split('_')[1]); } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("VariantID", StringComparison.InvariantCultureIgnoreCase)) { packVariantID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent("__EVENTARGUMENT").Split('_')[2]); } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("PackID", StringComparison.InvariantCultureIgnoreCase)) { PackID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i])); if (CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).Contains(",") && PackID == 0) { PackID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).Split(',')[0]); } } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Quantity", StringComparison.InvariantCultureIgnoreCase) && !HttpContext.Current.Request.Form.Keys[i].StartsWith("Quantity_vldt", StringComparison.InvariantCultureIgnoreCase)) { if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID) { packQuantity = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i])); } } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("CartRecID", StringComparison.InvariantCultureIgnoreCase)) { packCartRecID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i])); } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Color", StringComparison.InvariantCultureIgnoreCase)) { if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID) { color = CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).ToString(); } } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("Size", StringComparison.InvariantCultureIgnoreCase)) { if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID) { size = CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i]).ToString(); } } if (HttpContext.Current.Request.Form.Keys[i].StartsWith("ProductTypeID", StringComparison.InvariantCultureIgnoreCase)) { if (Localization.ParseUSInt(HttpContext.Current.Request.Form.Keys[i].Split('_')[2]) == packVariantID) { packProductTypeID = Localization.ParseUSInt(CommonLogic.FormCanBeDangerousContent(HttpContext.Current.Request.Form.Keys[i])); } } } ThisCustomer.RequireCustomerRecord(); if (packQuantity == 0) { packQuantity = 1; } FromCart = (packCartRecID > 0); if (color.Length != 0) { String[] ColorSel = color.Split(','); try { ChosenColor = ColorSel[0]; } catch { } try { ChosenColorSKUModifier = ColorSel[1]; } catch { } } if (ChosenColor.Length != 0) { ThisCustomer.ThisCustomerSession["ChosenColor"] = ChosenColor; } if (size.Length != 0) { String[] SizeSel = size.Split(','); try { ChosenSize = SizeSel[0]; } catch { } try { ChosenSizeSKUModifier = SizeSel[1]; } catch { } } if (ChosenSize.Length != 0) { ThisCustomer.ThisCustomerSession["ChosenSize"] = ChosenSize; } if (packQuantity > 0) { // add to custom cart: if (FromCart) { CustomCart.AddItem(PackID, packProductID, packVariantID, packQuantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier, packCartRecID, ThisCustomer, CartTypeEnum.ShoppingCart); } else { CustomCart cart = new CustomCart(ThisCustomer, PackID, 1, CartTypeEnum.ShoppingCart); cart.AddItem(packProductID, packVariantID, packQuantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier); } } if (CommonLogic.QueryStringCanBeDangerousContent("UpdateCartPack") == "") { String url = "pb.aspx?type=" + packProductTypeID.ToString() + "&PackID=" + PackID.ToString() + "&ProductID=" + packProductID.ToString() + "&cartrecid=" + packCartRecID; Response.Redirect(url + CommonLogic.IIF(FromCart, "?cartrecid=" + packCartRecID.ToString(), "")); Response.Redirect(url); } else { Response.Redirect(ResolveClientUrl("~/shoppingcart.aspx")); } } } String ActualSEName = string.Empty; using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn())) { dbconn.Open(); using (IDataReader rs = DB.GetRS(string.Format("select * from Product a with (NOLOCK) inner join (select a.ProductID, b.StoreID from Product a with (nolock) left join ProductStore b " + "with (NOLOCK) on a.ProductID = b.ProductID) b on a.ProductID = b.ProductID where Deleted=0 and a.ProductID={0} and ({1}=0 or StoreID={2})", + ProductID, CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowProductFiltering") == true, 1, 0), AppLogic.StoreID()), dbconn)) { if (!rs.Read()) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } else { bool a = DB.RSFieldBool(rs, "Published"); if (!a) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } } String SENameINURL = CommonLogic.QueryStringCanBeDangerousContent("SEName"); ActualSEName = SE.MungeName(DB.RSField(rs, "SEName")); if (ActualSEName != SENameINURL) { String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); string QStr = "?"; bool first = true; for (int i = 0; i < Request.QueryString.Count; i++) { string key = Request.QueryString.GetKey(i); if ((key.Equals("productid", StringComparison.InvariantCultureIgnoreCase)) == false && (key.Equals("sename", StringComparison.InvariantCultureIgnoreCase)) == false) { if (!first) { QStr += "&"; } QStr += key + "=" + Request.QueryString[i]; first = false; } } if (QStr.Length > 1) { NewURL += QStr; } HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } #region Vortx Mobile Xml Package Modification m_XmlPackage = Vortx.MobileFramework.MobileXmlPackageController.XmlPackageHook(DB.RSField(rs, "XmlPackage").ToLowerInvariant(), ThisCustomer); #endregion IsAKit = DB.RSFieldBool(rs, "IsAKit"); IsAPack = DB.RSFieldBool(rs, "IsAPack"); if (m_XmlPackage.Length == 0) { if (IsAKit) { m_XmlPackage = AppLogic.ro_DefaultProductKitXmlPackage; // provide a default } else if (IsAPack) { m_XmlPackage = AppLogic.ro_DefaultProductPackXmlPackage; // provide a default } else { m_XmlPackage = AppLogic.ro_DefaultProductXmlPackage; // provide a default } } RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); CategoryHelper = AppLogic.LookupHelper("Category", 0); SectionHelper = AppLogic.LookupHelper("Section", 0); ManufacturerHelper = AppLogic.LookupHelper("Manufacturer", 0); DistributorHelper = AppLogic.LookupHelper("Distributor", 0); GenreHelper = AppLogic.LookupHelper("Genre", 0); VectorHelper = AppLogic.LookupHelper("Vector", 0); String SEName = String.Empty; if (DB.RSFieldByLocale(rs, "SETitle", ThisCustomer.LocaleSetting).Length == 0) { SETitle = Security.HtmlEncode(AppLogic.AppConfig("StoreName") + " - " + ProductName); } else { SETitle = DB.RSFieldByLocale(rs, "SETitle", ThisCustomer.LocaleSetting); } if (DB.RSFieldByLocale(rs, "SEDescription", ThisCustomer.LocaleSetting).Length == 0) { SEDescription = Security.HtmlEncode(ProductName); } else { SEDescription = DB.RSFieldByLocale(rs, "SEDescription", ThisCustomer.LocaleSetting); } if (DB.RSFieldByLocale(rs, "SEKeywords", ThisCustomer.LocaleSetting).Length == 0) { SEKeywords = Security.HtmlEncode(ProductName); } else { SEKeywords = DB.RSFieldByLocale(rs, "SEKeywords", ThisCustomer.LocaleSetting); } SENoScript = DB.RSFieldByLocale(rs, "SENoScript", ThisCustomer.LocaleSetting); } } //Log all views of unknown and registered customer if (!AppLogic.ProductIsMLExpress() && (AppLogic.AppConfigBool("DynamicRelatedProducts.Enabled") || AppLogic.AppConfigBool("RecentlyViewedProducts.Enabled"))) { ThisCustomer.LogProductView(ProductID); } if (IsAKit && !Vortx.MobileFramework.MobileHelper.isMobile()) { Server.Transfer(ResolveClientUrl("~/kitproduct.aspx"), true); return; } else if (IsAKit && Vortx.MobileFramework.MobileHelper.isMobile()) { Server.Transfer(ResolveClientUrl("~/mobilekitproduct.aspx"), true); return; } CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); SectionName = SectionHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); ManufacturerName = ManufacturerHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); DistributorName = DistributorHelper.GetEntityName(DistributorID, ThisCustomer.LocaleSetting); GenreName = GenreHelper.GetEntityName(GenreID, ThisCustomer.LocaleSetting); VectorName = VectorHelper.GetEntityName(VectorID, ThisCustomer.LocaleSetting); String SourceEntityInstanceName = String.Empty; if (ManufacturerID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = ManufacturerID.ToString(); Profile.LastViewedEntityInstanceName = ManufacturerName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (DistributorID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_DistributorEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = DistributorID.ToString(); Profile.LastViewedEntityInstanceName = DistributorName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (GenreID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_GenreEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = GenreID.ToString(); Profile.LastViewedEntityInstanceName = GenreName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (VectorID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_VectorEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = VectorID.ToString(); Profile.LastViewedEntityInstanceName = VectorName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (CategoryID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = CategoryID.ToString(); Profile.LastViewedEntityInstanceName = CategoryName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (SectionID != 0) { Profile.LastViewedEntityName = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = SectionID.ToString(); Profile.LastViewedEntityInstanceName = SectionName; String NewURL = AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeProductLink(ProductID, ActualSEName); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } SourceEntity = Profile.LastViewedEntityName; SourceEntityInstanceName = Profile.LastViewedEntityInstanceName; SourceEntityID = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.LastViewedEntityInstanceID), Profile.LastViewedEntityInstanceID, "0")); // validate that source entity id is actually valid for this product: if (SourceEntityID != 0) { String sqlx = string.Format("select count(*) as N from productentity a with (nolock) inner join (select distinct a.entityid, a.EntityType from productentity a with (nolock) left join EntityStore b with (nolock) " + "on a.EntityID = b.EntityID where ({0} = 0 or StoreID = {1})) b on a.EntityID = b.EntityID and a.EntityType=b.EntityType where ProductID = {2} and a.EntityID = {3} and a.EntityType = {4}" , CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowEntityFiltering") == true, 1, 0), AppLogic.StoreID(), ProductID, SourceEntityID, DB.SQuote(SourceEntity)); if (DB.GetSqlN(sqlx) == 0) { SourceEntityID = 0; } } // we had no entity context coming in, try to find a category context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName); if (SourceEntityID > 0) { CategoryID = SourceEntityID; CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = CategoryID.ToString(); Profile.LastViewedEntityInstanceName = CategoryName; SourceEntity = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; SourceEntityInstanceName = CategoryName; } } // we had no entity context coming in, try to find a section context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName); if (SourceEntityID > 0) { SectionID = SourceEntityID; SectionName = CategoryHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = SectionID.ToString(); Profile.LastViewedEntityInstanceName = SectionName; SourceEntity = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; SourceEntityInstanceName = SectionName; } } // we had no entity context coming in, try to find a Manufacturer context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName); if (SourceEntityID > 0) { ManufacturerID = SourceEntityID; ManufacturerName = CategoryHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = ManufacturerID.ToString(); Profile.LastViewedEntityInstanceName = ManufacturerName; SourceEntity = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; SourceEntityInstanceName = ManufacturerName; } } // build up breadcrumb if we need: SectionTitle = Breadcrumb.GetProductBreadcrumb(ProductID, ProductName, SourceEntity, SourceEntityID, ThisCustomer); //Reset LastViewedEntityInstanceID to zero if no entities are mapped to the product so the left nav will render properly. if (SourceEntityID <= 0) { HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityInstanceID", "0"); } if (RequiresReg && !ThisCustomer.IsRegistered) { m_PageOutput += "<br/><br/><br/><br/><b>" + AppLogic.GetString("showproduct.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><br/><br/><br/><a href=\"signin.aspx?returnurl=" + CommonLogic.GetThisPageName(false) + "?ProductID=" + ProductID.ToString() + CommonLogic.IIF(CommonLogic.ServerVariables("QUERY_STRING").Trim().Length > 0, "&" + Security.HtmlEncode(Security.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))), String.Empty) + "\">" + AppLogic.GetString("showproduct.aspx.2", SkinID, ThisCustomer.LocaleSetting) + "</a> " + AppLogic.GetString("showproduct.aspx.3", SkinID, ThisCustomer.LocaleSetting); } else { AppLogic.eventHandler("ViewProductPage").CallEvent("&ViewProductPage=true"); // check if the postback was caused by an addtocart button if (this.IsPostBack && this.IsAddToCartPostBack) { HandleAddToCart(); return; } DB.ExecuteSQL("update product set Looks=Looks+1 where ProductID=" + ProductID.ToString()); m_PageOutput = "<!-- XmlPackage: " + m_XmlPackage + " -->\n"; if (m_XmlPackage.Length == 0) { m_PageOutput += "<p><b><font color=red>XmlPackage format was chosen, but no XmlPackage was specified!</font></b></p>"; } else { using (XmlPackage2 p = new XmlPackage2(m_XmlPackage, ThisCustomer, SkinID, "", "EntityName=" + SourceEntity + "&EntityID=" + SourceEntityID.ToString() + CommonLogic.IIF(CommonLogic.ServerVariables("QUERY_STRING").IndexOf("cartrecid") != -1, "&cartrecid=" + CommonLogic.QueryStringUSInt("cartrecid").ToString(), "&showproduct=1"), String.Empty, true)) { m_PageOutput += AppLogic.RunXmlPackage(p, base.GetParser, ThisCustomer, SkinID, true, true); if (p.SectionTitle != "") { SectionTitle = p.SectionTitle; } if (p.SETitle != "") { SETitle = p.SETitle; } if (p.SEDescription != "") { SEDescription = p.SEDescription; } if (p.SEKeywords != "") { SEKeywords = p.SEKeywords; } if (p.SENoScript != "") { SENoScript = p.SENoScript; } } } } litOutput.Text = m_PageOutput; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public void Page_Load(object sender, EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { m_SkinBase.GoNonSecureAgain(); } n = m_EntityHelper.m_TblMgr.SetContext(m_EntityInstanceID); //Determine if the entity is map to the current store. if (n == null) { HttpContext.Current.Server.Transfer("pagenotfound.aspx"); } //Checking for multi store. CachelessStore store = new CachelessStore(); store.StoreID = AppLogic.StoreID(); MappedObject map = store.GetMapping(m_EntitySpecs.m_EntityName, m_EntityInstanceID); if (AppLogic.GlobalConfigBool("AllowEntityFiltering") == true && !map.IsMapped) { HttpContext.Current.Server.Transfer("pagenotfound.aspx"); } m_ThisEntityNodeContext = n; String SENameINURL = CommonLogic.QueryStringCanBeDangerousContent("SEName"); if (SENameINURL.Equals(XmlCommon.XmlField(GetActiveEntityNodeContext, "SEName"), StringComparison.InvariantCultureIgnoreCase) == false) { string QS = BuildQueryString(); String NewURL = string.Format("{0}{1}{2}", AppLogic.GetStoreHTTPLocation(false, false), SE.MakeEntityLink(m_EntityHelper.GetEntitySpecs.m_EntityName, m_EntityInstanceID, XmlCommon.XmlField(GetActiveEntityNodeContext, "SEName")), QS); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); HttpContext.Current.Response.Status = "301 Moved Permanently"; HttpContext.Current.Response.AddHeader("Location", NewURL); m_URLValidated = false; } if (m_URLValidated) { m_CategoryFilterID = CommonLogic.QueryStringUSInt("CategoryFilterID"); m_SectionFilterID = CommonLogic.QueryStringUSInt("SectionFilterID"); m_ProductTypeFilterID = CommonLogic.QueryStringUSInt("ProductTypeFilterID"); m_ManufacturerFilterID = CommonLogic.QueryStringUSInt("ManufacturerFilterID"); m_DistributorFilterID = CommonLogic.QueryStringUSInt("DistributorFilterID"); m_GenreFilterID = CommonLogic.QueryStringUSInt("GenreFilterID"); m_VectorFilterID = CommonLogic.QueryStringUSInt("VectorFilterID"); if (CommonLogic.QueryStringCanBeDangerousContent("CategoryFilterID").Length == 0) { if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("CategoryFilterID") != 0) { m_CategoryFilterID = CommonLogic.CookieUSInt("CategoryFilterID"); } } if (CommonLogic.QueryStringCanBeDangerousContent("SectionFilterID").Length == 0) { if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("SectionFilterID") != 0) { m_SectionFilterID = CommonLogic.CookieUSInt("SectionFilterID"); } } if (CommonLogic.QueryStringCanBeDangerousContent("ProductTypeFilterID").Length == 0) { if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("ProductTypeFilterID") != 0) { m_ProductTypeFilterID = CommonLogic.CookieUSInt("ProductTypeFilterID"); } if (m_ProductTypeFilterID != 0 && !AppLogic.ProductTypeHasVisibleProducts(m_ProductTypeFilterID)) { m_ProductTypeFilterID = 0; } } if (CommonLogic.QueryStringCanBeDangerousContent("ManufacturerFilterID").Length == 0) { if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("ManufacturerFilterID") != 0) { m_ManufacturerFilterID = CommonLogic.CookieUSInt("ManufacturerFilterID"); } } if (CommonLogic.QueryStringCanBeDangerousContent("DistributorFilterID").Length == 0) { if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("DistributorFilterID") != 0) { m_DistributorFilterID = CommonLogic.CookieUSInt("DistributorFilterID"); } } if (CommonLogic.QueryStringCanBeDangerousContent("GenreFilterID").Length == 0) { if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("GenreFilterID") != 0) { m_GenreFilterID = CommonLogic.CookieUSInt("GenreFilterID"); } } if (CommonLogic.QueryStringCanBeDangerousContent("VectorFilterID").Length == 0) { if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length == 0 && AppLogic.AppConfigBool("PersistFilters") && CommonLogic.CookieUSInt("VectorFilterID") != 0) { m_VectorFilterID = CommonLogic.CookieUSInt("VectorFilterID"); } } if (CommonLogic.QueryStringCanBeDangerousContent("ResetFilters").Length != 0) { m_CategoryFilterID = 0; m_SectionFilterID = 0; m_ManufacturerFilterID = 0; m_DistributorFilterID = 0; m_GenreFilterID = 0; m_VectorFilterID = 0; m_ProductTypeFilterID = 0; } if (AppLogic.AppConfigBool("PersistFilters")) { HttpContext.Current.Profile.SetPropertyValue("CategoryFilterID", m_CategoryFilterID.ToString()); HttpContext.Current.Profile.SetPropertyValue("SectionFilterID", m_SectionFilterID.ToString()); HttpContext.Current.Profile.SetPropertyValue("ManufacturerFilterID", m_ManufacturerFilterID.ToString()); HttpContext.Current.Profile.SetPropertyValue("DistributorFilterID", m_DistributorFilterID.ToString()); HttpContext.Current.Profile.SetPropertyValue("GenreFilterID", m_GenreFilterID.ToString()); HttpContext.Current.Profile.SetPropertyValue("VectorFilterID", m_VectorFilterID.ToString()); HttpContext.Current.Profile.SetPropertyValue("ProductTypeFilterID", m_ProductTypeFilterID.ToString()); } m_EntityInstanceName = m_EntityHelper.m_TblMgr.CurrentName(n, m_SkinBase.ThisCustomer.LocaleSetting); HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityName", m_EntitySpecs.m_EntityName); HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityInstanceID", m_EntityInstanceID.ToString()); HttpContext.Current.Profile.SetPropertyValue("LastViewedEntityInstanceName", m_EntityInstanceName); #region Vortx Mobile Xml Package Modification m_XmlPackage = Vortx.MobileFramework.MobileXmlPackageController.XmlPackageHook(m_EntityHelper.m_TblMgr.CurrentField(n, "XmlPackage").ToLowerInvariant(), m_SkinBase.ThisCustomer); #endregion if (m_XmlPackage.Length == 0) { m_XmlPackage = AppLogic.ro_DefaultEntityXmlPackage; // provide a default for backwards compatibility } String RunTimeParms = String.Format("EntityName={0}&EntityID={1}", m_EntitySpecs.m_EntityName, m_EntityInstanceID.ToString()); RunTimeParms += String.Format("&CatID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("CATEGORY", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_CategoryFilterID.ToString())); RunTimeParms += String.Format("&SecID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("SECTION", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_SectionFilterID.ToString())); RunTimeParms += String.Format("&ManID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("MANUFACTURER", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_ManufacturerFilterID.ToString())); RunTimeParms += String.Format("&DistID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("DISTRIBUTOR", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_DistributorFilterID.ToString())); RunTimeParms += String.Format("&GenreID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("GENRE", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_GenreFilterID.ToString())); RunTimeParms += String.Format("&VectorID={0}", CommonLogic.IIF(m_EntitySpecs.m_EntityName.Trim().Equals("VECTOR", StringComparison.InvariantCultureIgnoreCase), m_EntityInstanceID.ToString(), m_VectorFilterID.ToString())); RunTimeParms += String.Format("&ProductTypeFilterID={0}", m_ProductTypeFilterID.ToString()); // CacheEntityPageHTML is an UNSUPPORTED and UNDOCUMENTED AppConfig // caching does NOT honor cross entity filtering, or other filters. Use it only on high traffic sites // with entity pages that do NOT vary by params other than those used in the CacheName string below. // if you are showing prices, they will remain the same during the cache duration (AppLogic.CacheDurationMinutes setting, usually 1 hr) String CacheName = String.Empty; m_SkinBase.SETitle = m_EntityHelper.m_TblMgr.CurrentFieldByLocale(n, "SETitle", m_SkinBase.ThisCustomer.LocaleSetting); if (m_SkinBase.SETitle.Length == 0) { m_SkinBase.SETitle = Security.HtmlEncode(AppLogic.AppConfig("StoreName") + " - " + m_EntityInstanceName); } m_SkinBase.SEDescription = m_EntityHelper.m_TblMgr.CurrentFieldByLocale(n, "SEDescription", m_SkinBase.ThisCustomer.LocaleSetting); if (m_SkinBase.SEDescription.Length == 0) { m_SkinBase.SEDescription = Security.HtmlEncode(m_EntityInstanceName); } m_SkinBase.SEKeywords = m_EntityHelper.m_TblMgr.CurrentFieldByLocale(n, "SEKeywords", m_SkinBase.ThisCustomer.LocaleSetting); if (m_SkinBase.SEKeywords.Length == 0) { m_SkinBase.SEKeywords = Security.HtmlEncode(m_EntityInstanceName); } m_SkinBase.SENoScript = m_EntityHelper.m_TblMgr.CurrentFieldByLocale(n, "SENoScript", m_SkinBase.ThisCustomer.LocaleSetting); m_SkinBase.SectionTitle = Breadcrumb.GetEntityBreadcrumb(m_EntityInstanceID, m_EntityInstanceName, m_EntitySpecs.m_EntityName, m_SkinBase.ThisCustomer); if (m_URLValidated) { m_PageOutput = "<!-- XmlPackage: " + m_XmlPackage + " -->\n"; if (m_XmlPackage.Length == 0) { m_PageOutput += "<p><b><font color=red>XmlPackage format was chosen, but no XmlPackage was specified!</font></b></p>"; } else { String s = null; if (AppLogic.AppConfigBool("CacheEntityPageHTML")) { CacheName = String.Format("CacheEntityPageHTML|{0}|{1}|{2}|{3}|{4}|{5}|{6}", m_EntitySpecs.m_EntityName, m_EntityInstanceID.ToString(), m_SkinBase.ThisCustomer.CustomerLevelID.ToString(), m_SkinBase.ThisCustomer.LocaleSetting, CommonLogic.QueryStringUSInt("PageNum").ToString(), m_SkinBase.ThisCustomer.AffiliateID.ToString(), Vortx.MobileFramework.MobileHelper.isMobile() ? "Mobile" : "Desktop" ); s = (String)HttpContext.Current.Cache.Get(CacheName); if (s != null) { s = "<!-- CacheEntityPageHTML -->" + s; } m_SkinBase.SectionTitle = (String)HttpContext.Current.Cache.Get(CacheName + "|SectionTitle"); m_SkinBase.SETitle = (String)HttpContext.Current.Cache.Get(CacheName + "|SETitle"); m_SkinBase.SEDescription = (String)HttpContext.Current.Cache.Get(CacheName + "|SEDescription"); m_SkinBase.SEKeywords = (String)HttpContext.Current.Cache.Get(CacheName + "|SEKeywords"); m_SkinBase.SENoScript = (String)HttpContext.Current.Cache.Get(CacheName + "|SENoScript"); if (m_SkinBase.SectionTitle == null) { m_SkinBase.SectionTitle = String.Empty; } if (m_SkinBase.SETitle == null) { m_SkinBase.SETitle = String.Empty; } if (m_SkinBase.SEDescription == null) { m_SkinBase.SEDescription = String.Empty; } if (m_SkinBase.SEKeywords == null) { m_SkinBase.SEKeywords = String.Empty; } if (m_SkinBase.SENoScript == null) { m_SkinBase.SENoScript = String.Empty; } } if (s == null || s.Length == 0) { using (XmlPackage2 p = new XmlPackage2(m_XmlPackage, m_SkinBase.ThisCustomer, m_SkinBase.SkinID, "", RunTimeParms, String.Empty, true)) { s = AppLogic.RunXmlPackage(p, m_SkinBase.GetParser, m_SkinBase.ThisCustomer, m_SkinBase.SkinID, true, true); if (p.SectionTitle != "") { m_SkinBase.SectionTitle = p.SectionTitle; } if (p.SETitle != "") { m_SkinBase.SETitle = p.SETitle; } if (p.SEDescription != "") { m_SkinBase.SEDescription = p.SEDescription; } if (p.SEKeywords != "") { m_SkinBase.SEKeywords = p.SEKeywords; } if (p.SENoScript != "") { m_SkinBase.SENoScript = p.SENoScript; } if (AppLogic.AppConfigBool("CacheEntityPageHTML")) { HttpContext.Current.Cache.Insert(CacheName, s, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); HttpContext.Current.Cache.Insert(CacheName + "|SectionTitle", p.SectionTitle, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); HttpContext.Current.Cache.Insert(CacheName + "|SETitle", p.SETitle, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); HttpContext.Current.Cache.Insert(CacheName + "|SEDescription", p.SEDescription, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); HttpContext.Current.Cache.Insert(CacheName + "|SEKeywords", p.SEKeywords, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); HttpContext.Current.Cache.Insert(CacheName + "|SENoScript", p.SENoScript, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); } } } m_PageOutput += s; } } } AppLogic.eventHandler("ViewEntityPage").CallEvent("&ViewEntityPage=true"); //check if the postback was caused by the TableOrderAddToCart button if (m_SkinBase.IsPostBack && isTableOrderAddToCartPostBack) { HandleTableOrderAddToCart(); } }
protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } PackID = CommonLogic.QueryStringUSInt("PackID"); if (PackID == 0) { Response.Redirect("default.aspx"); } if (AppLogic.ProductHasBeenDeleted(PackID)) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } m_CategoryHelper = AppLogic.LookupHelper(base.EntityHelpers, "Category"); m_SectionHelper = AppLogic.LookupHelper(base.EntityHelpers, "Section"); CategoryID = CommonLogic.QueryStringUSInt("CategoryID"); SectionID = CommonLogic.QueryStringUSInt("SectionID"); if (CategoryID == 0 && SectionID == 0) { // no category or section passed in, pick first one that this product is mapped to: String tmpS = m_CategoryHelper.GetObjectEntities(PackID, true); if (tmpS.Length != 0) { String[] catIDs = tmpS.Split(','); CategoryID = Localization.ParseUSInt(catIDs[0]); } else { String tmpS2 = m_SectionHelper.GetObjectEntities(PackID, true); if (tmpS2.Length != 0) { String[] secIDs = tmpS2.Split(','); SectionID = Localization.ParseUSInt(secIDs[0]); } } } CategoryName = m_CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); SectionName = m_SectionHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select product.*,productvariant.price,productvariant.points,productvariant.saleprice from product with (NOLOCK) left outer join productvariant with (NOLOCK) on product.productid=productvariant.productid where productvariant.deleted=0 and productvariant.published=1 and product.ProductID=" + PackID.ToString(), conn)) { if (!rs.Read()) { Response.Redirect("default.aspx"); } base.ContentsBGColor = DB.RSField(rs, "ContentsBGColor"); base.PageBGColor = DB.RSField(rs, "PageBGColor"); base.GraphicsColor = DB.RSField(rs, "GraphicsColor"); SpecsInline = DB.RSFieldBool(rs, "SpecsInline"); SpecTitle = DB.RSFieldByLocale(rs, "SpecTitle", ThisCustomer.LocaleSetting); Points = DB.RSFieldInt(rs, "Points"); ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); ProductDescription = DB.RSFieldByLocale(rs, "Description", ThisCustomer.LocaleSetting); if (AppLogic.ReplaceImageURLFromAssetMgr) { ProductDescription = ProductDescription.Replace("../images", "images"); } FileDescription = new ProductDescriptionFile(PackID, ThisCustomer.LocaleSetting, SkinID).Contents; if (FileDescription.Length != 0) { ProductDescription += "<br/>" + FileDescription; } String ProductPicture = String.Empty; bool m_WatermarksEnabled = AppLogic.AppConfigBool("Watermark.Enabled"); if (m_WatermarksEnabled) { ProductPicture = String.Format("watermark.axd?productid={0}&size=medium", PackID.ToString()); } else { ProductPicture = AppLogic.LookupImage("Product", PackID, "medium", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); } LargePic = AppLogic.LookupImage("Product", PackID, "large", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); HasLargePic = (LargePic.Length != 0); String LargePicWatermarked = String.Format("watermark.axd?productid={0}&size=large", PackID.ToString()); String LargePicForPopup = LargePic; if (m_WatermarksEnabled) { LargePicForPopup = Server.UrlEncode(LargePicWatermarked); } RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); BasePrice = System.Decimal.Zero; if (DB.RSFieldDecimal(rs, "SalePrice") != System.Decimal.Zero) { BasePrice = DB.RSFieldDecimal(rs, "SalePrice"); } else { BasePrice = DB.RSFieldDecimal(rs, "Price"); } } } if (RequiresReg && !ThisCustomer.IsRegistered) { litOutput.Text = "<br/><br/><br/><br/><b>" + AppLogic.GetString("dyop.aspx.1", SkinID, ThisCustomer.LocaleSetting) + "</b><br/><br/><br/><a href=\"signin.aspx?returnurl=showproduct.aspx?" + Server.HtmlEncode(Server.UrlEncode(CommonLogic.ServerVariables("QUERY_STRING"))) + "\">" + AppLogic.GetString("dyop.aspx.2", SkinID, ThisCustomer.LocaleSetting) + "</a> " + AppLogic.GetString("dyop.aspx.3", SkinID, ThisCustomer.LocaleSetting); } else { PresetPackPrice = System.Decimal.Zero; PresetPackProducts = String.Empty; AppLogic.PresetPack(ThisCustomer, PackID, CartTypeEnum.ShoppingCart, out PresetPackPrice, out PresetPackProducts); m_XmlPackage = AppLogic.GetProductXmlPackage(PackID); using (XmlPackage2 p = new XmlPackage2(m_XmlPackage, ThisCustomer, SkinID, String.Empty, String.Empty, String.Empty, true)) { litOutput.Text = AppLogic.RunXmlPackage(p, null, ThisCustomer, SkinID, false, false); this.SETitle = p.SETitle; this.SEDescription = p.SEDescription; this.SEKeywords = p.SEKeywords; this.SENoScript = p.SENoScript; this.SectionTitle = p.SectionTitle; } } }
protected void Page_Load(object sender, EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/emailproduct.aspx", ThisCustomer); ProductID = CommonLogic.QueryStringUSInt("ProductID"); if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } // DOS attack prevention: if (AppLogic.OnLiveServer() && (Request.UrlReferrer == null || Request.UrlReferrer.Authority != Request.Url.Authority)) { Response.Redirect(SE.MakeDriverLink("EmailError")); } if (ProductID == 0) { Response.Redirect("~/default.aspx"); } if (AppLogic.ProductHasBeenDeleted(ProductID)) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } EntityHelper CategoryHelper = AppLogic.LookupHelper("Category", AppLogic.StoreID()); baseSkinID = (Page as SkinBase).SkinID; using (SqlConnection conn = DB.dbConn()) { conn.Open(); using (IDataReader rs = DB.GetRS("select p.*, pv.name variantname from product p with (NOLOCK) join productvariant pv with (NOLOCK) on p.ProductID = pv.ProductID and pv.isdefault = 1 where p.ProductID=" + ProductID.ToString(), conn)) { if (!rs.Read()) { Response.Redirect("default.aspx"); } SEName = DB.RSField(rs, "SEName"); ProductName = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting); VariantName = DB.RSFieldByLocale(rs, "VariantName", ThisCustomer.LocaleSetting); RequiresReg = DB.RSFieldBool(rs, "RequiresRegistration"); ProductDescription = DB.RSFieldByLocale(rs, "Description", ThisCustomer.LocaleSetting); if (AppLogic.ReplaceImageURLFromAssetMgr) { ProductDescription = ProductDescription.Replace("../images", "images"); } String FileDescription = new ProductDescriptionFile(ProductID, ThisCustomer.LocaleSetting, baseSkinID).Contents; if (FileDescription.Length != 0) { ProductDescription += "<div align=\"left\">" + FileDescription + "</div>"; } } } String SourceEntityInstanceName = String.Empty; SourceEntity = Profile.LastViewedEntityName; SourceEntityInstanceName = Profile.LastViewedEntityInstanceName; SourceEntityID = int.Parse(CommonLogic.IIF(CommonLogic.IsInteger(Profile.LastViewedEntityInstanceID), Profile.LastViewedEntityInstanceID, "0"));; // validate that source entity id is actually valid for this product: if (SourceEntityID != 0) { String sqlx = "select count(*) as N from dbo.productentity with (NOLOCK) where ProductID=" + ProductID.ToString() + " and EntityID=" + SourceEntityID.ToString() + " and EntityType = " + DB.SQuote(SourceEntity); if (DB.GetSqlN(sqlx) == 0) { SourceEntityID = 0; } } // we had no entity context coming in, try to find a category context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName); if (SourceEntityID > 0) { CategoryID = SourceEntityID; CategoryName = CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = CategoryID.ToString(); Profile.LastViewedEntityInstanceName = CategoryName; SourceEntity = EntityDefinitions.readonly_CategoryEntitySpecs.m_EntityName; SourceEntityInstanceName = CategoryName; } } // we had no entity context coming in, try to find a section context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName); if (SourceEntityID > 0) { SectionID = SourceEntityID; SectionName = CategoryHelper.GetEntityName(SectionID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = SectionID.ToString(); Profile.LastViewedEntityInstanceName = SectionName; SourceEntity = EntityDefinitions.readonly_SectionEntitySpecs.m_EntityName; SourceEntityInstanceName = SectionName; } } // we had no entity context coming in, try to find a Manufacturer context for this product, so they have some context if possible: if (SourceEntityID == 0) { SourceEntityID = EntityHelper.GetProductsFirstEntity(ProductID, EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName); if (SourceEntityID > 0) { ManufacturerID = SourceEntityID; ManufacturerName = CategoryHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); Profile.LastViewedEntityName = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; Profile.LastViewedEntityInstanceID = ManufacturerID.ToString(); Profile.LastViewedEntityInstanceName = ManufacturerName; SourceEntity = EntityDefinitions.readonly_ManufacturerEntitySpecs.m_EntityName; SourceEntityInstanceName = ManufacturerName; } } // build up breadcrumb if we need: (Page as SkinBase).SectionTitle = Breadcrumb.GetProductBreadcrumb(ProductID, ProductName, SourceEntity, SourceEntityID, ThisCustomer); reqToAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.13", baseSkinID, ThisCustomer.LocaleSetting); regexToAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.14", baseSkinID, ThisCustomer.LocaleSetting); reqFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.16", baseSkinID, ThisCustomer.LocaleSetting); regexFromAddress.ErrorMessage = AppLogic.GetString("emailproduct.aspx.17", baseSkinID, ThisCustomer.LocaleSetting); if (!this.IsPostBack) { InitializePageContent(); } }