protected void Page_Load(object sender, EventArgs e) { EntityId = CommonLogic.QueryStringNativeInt("EntityID"); EntityType = string.IsNullOrEmpty(CommonLogic.QueryStringCanBeDangerousContent("EntityType")) ? EntityTypes.Category.ToString() : CommonLogic.QueryStringCanBeDangerousContent("EntityType"); EntitySpecs = EntityDefinitions.LookupSpecs(EntityType); EntityHelper = new EntityHelper(0, EntitySpecs, 0); if (IsPostBack) { return; } ddEntityType.SelectedValue = EntityType.ToLower(); ddEntity.SelectedValue = EntityId.ToString(); var currentEntity = new Entity(EntityId, EntityType); TopLevelString = BuildTopLevelString(EntityType); CurrentEntityName = GetCurrentEntityName(currentEntity); PopulateEntityDropDown(EntityType); SetupBreadcrumbData(currentEntity); DataBind(); }
protected void Page_Load(object sender, EventArgs e) { eID = CommonLogic.QueryStringNativeInt("EntityID"); eName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); eSpecs = EntityDefinitions.LookupSpecs(eName); switch (eName.ToUpperInvariant()) { case "SECTION": ViewState["entityname"] = "Section"; EntityPlural = "Sections"; break; case "MANUFACTURER": ViewState["entityname"] = "Manufacturer"; EntityPlural = "Manufacturers"; break; case "DISTRIBUTOR": ViewState["entityname"] = "Distributor"; EntityPlural = "Distributors"; break; case "GENRE": ViewState["entityname"] = "Genre"; EntityPlural = "Genres"; break; case "VECTOR": ViewState["entityname"] = "Vector"; EntityPlural = "Vectors"; break; case "LIBRARY": ViewState["entityname"] = "Library"; EntityPlural = "Libraries"; break; default: ViewState["entityname"] = "Category"; EntityPlural = "Categories"; break; } if (eID == 0) { lblpagehdr.Text = "Set " + ViewState["entityname"].ToString() + " Display Order"; lblpagehdr.Visible = true; } else { lblpagehdr.Visible = false; } if (!IsPostBack) { EntityXml = new EntityHelper(0, eSpecs, !AppLogic.IsAdminSite, 0).m_TblMgr.XmlDoc; LoadBody(); } }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); cust = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; EntityID = CommonLogic.QueryStringUSInt("EntityID"); if (EntityID < 1) { EntityID = CommonLogic.FormNativeInt("EntityID"); } EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); if (String.IsNullOrEmpty(EntityName)) { EntityName = CommonLogic.FormCanBeDangerousContent("EntityName"); } m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting); return; } if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { ProductCollection products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID); products.PageSize = 0; products.PageNum = 1; products.PublishedOnly = false; products.ReturnAllVariants = true; DataSet dsProducts = products.LoadFromDB(); int NumProducts = products.NumProducts; foreach (DataRow row in dsProducts.Tables[0].Rows) { if (DB.RowFieldBool(row, "IsDownload")) { int ThisProductID = DB.RowFieldInt(row, "ProductID"); int ThisVariantID = DB.RowFieldInt(row, "VariantID"); StringBuilder sql = new StringBuilder(1024); sql.Append("update productvariant set "); String DLoc = CommonLogic.FormCanBeDangerousContent("DownloadLocation_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); if (DLoc.StartsWith("/")) { DLoc = DLoc.Substring(1, DLoc.Length - 1); // remove leading / char! } sql.Append("DownloadLocation=" + DB.SQuote(DLoc)); sql.Append(" where VariantID=" + ThisVariantID.ToString()); DB.ExecuteSQL(sql.ToString()); } } dsProducts.Dispose(); } LoadBody(); }
protected override void OnInit(EventArgs e) { EntitySpecs = EntityDefinitions.LookupSpecs(EntityType); EntityHelper = new EntityHelper(0, EntitySpecs, 0); HeaderText.Text = String.Format("Products for {0}", EntityHelper.GetEntityBreadcrumb6(EntityId, ThisCustomer.LocaleSetting)); base.OnInit(e); }
public ShowEntityPage(EntitySpecs eSpecs, SkinBase sb) { m_EntitySpecs = eSpecs; m_SkinBase = sb; m_EntityHelper = AppLogic.LookupHelper(m_EntitySpecs.m_EntityName, 0); m_ResourcePrefix = String.Format("show{0}.aspx.", m_EntitySpecs.m_EntityName.ToLowerInvariant()); m_EntityInstanceID = CommonLogic.QueryStringUSInt(m_EntityHelper.GetEntitySpecs.m_EntityName + "ID"); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); if (CommonLogic.QueryStringCanBeDangerousContent("EntityName").Length == 0) { Response.Redirect(AppLogic.AdminLinkUrl("default.aspx")); } m_EntitySpecs = EntityDefinitions.LookupSpecs(CommonLogic.QueryStringCanBeDangerousContent("EntityName")); SectionTitle = String.Format(AppLogic.GetString("Token", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("AppConfig." + m_EntitySpecs.m_EntityName + "PromptPlural", SkinID, ThisCustomer.LocaleSetting)); AdminLogic.EntityListPageFormHandler(m_EntitySpecs, ThisCustomer, SkinID); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); if (CommonLogic.QueryStringCanBeDangerousContent("EntityName").Length == 0) { Response.Redirect(AppLogic.AdminLinkUrl("default.aspx")); } m_EntitySpecs = EntityDefinitions.LookupSpecs(CommonLogic.QueryStringCanBeDangerousContent("EntityName")); m_ErrorMsg = AdminLogic.EntityEditPageFormHandler(this, m_EntitySpecs, ThisCustomer, SkinID); SectionTitle = "<a href=\"" + AppLogic.AdminLinkUrl("entities.aspx") + "?entityname=" + m_EntitySpecs.m_EntityName + "\">" + AppLogic.GetString("AppConfig." + m_EntitySpecs.m_EntityName + "PromptPlural", SkinID, ThisCustomer.LocaleSetting) + "</a> - Manage " + AppLogic.GetString("AppConfig." + m_EntitySpecs.m_EntityName + "PromptPlural", SkinID, ThisCustomer.LocaleSetting); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); cust = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; EntityID = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { ltBody.Text = "Invalid Parameters"; return; } if (CommonLogic.FormBool("IsSubmit")) { if (EntityID != 0) { DB.ExecuteSQL(String.Format("delete from {0}{1} where {2}ID={3}", m_EntitySpecs.m_ObjectName, m_EntitySpecs.m_EntityName, m_EntitySpecs.m_EntityName, EntityID.ToString())); } for (int i = 0; i <= Request.Form.Count - 1; i++) { if (Request.Form.Keys[i].IndexOf("DisplayOrder_") != -1) { String[] keys = Request.Form.Keys[i].Split('_'); int ObjectID = Localization.ParseUSInt(keys[1]); int DispOrd = 1; try { DispOrd = Localization.ParseUSInt(Request.Form[Request.Form.Keys[i]]); } catch { } DB.ExecuteSQL(String.Format("insert into {0}{1}({2}ID,{3}ID,DisplayOrder) values({4},{5},{6})", m_EntitySpecs.m_ObjectName, m_EntitySpecs.m_EntityName, m_EntitySpecs.m_EntityName, m_EntitySpecs.m_ObjectName, EntityID.ToString(), ObjectID.ToString(), DispOrd.ToString())); } } } LoadBody(); }
protected void Page_Load(object sender, System.EventArgs e) { EntityId = CommonLogic.QueryStringUSInt("EntityID"); EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(EntitySpecs, 0); if (EntityId == 0 || EntityName.Length == 0) { RenderContainer.Text = "Invalid Parameters"; return; } SelectedLocale = LocaleSource.GetDefaultLocale(); Render(SelectedLocale.Name); DataBind(); }
protected void Page_Load(object sender, System.EventArgs e) { EntityId = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(EntitySpecs, 0); if (EntityId == 0 || EntityName.Length == 0) { AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); MainBody.Visible = false; return; } SelectedLocale = LocaleSource.GetDefaultLocale(); LoadBody(SelectedLocale.Name); }
public String GetMobileListProductsSQL(EntitySpecs eSpecs, int EntityInstanceID, int AffiliateID, int CustomerLevelID, bool AllowKits, bool AllowPacks, bool OrderByLooks) { String OneVariantSQL = String.Empty; String FilterSQL = String.Empty; String OrderBySQL = String.Empty; String FinalSQL = String.Empty; FinalSQL = "exec aspdnsf_GetSimpleObjectEntityList @entityname=" + DB.SQuote(eSpecs.m_EntityName); if (EntityInstanceID != 0) { FinalSQL += ", @entityid=" + EntityInstanceID.ToString(); } if (AppLogic.AppConfigBool("Filter" + eSpecs.m_ObjectName + "sByAffiliate")) { FinalSQL += ", @affiliateid=" + AffiliateID.ToString(); } if (AppLogic.AppConfigBool("Filter" + eSpecs.m_ObjectName + "sByCustomerLevel")) { FinalSQL += ", @customerlevelid=" + CustomerLevelID.ToString(); } if (!AllowKits) { FinalSQL += ", @AllowKits=0"; } if (!AllowPacks) { FinalSQL += ", @AllowPacks=0"; } if (!AppLogic.IsAdminSite) { FinalSQL += ", @PublishedOnly=1"; } if (OrderByLooks) { FinalSQL += ", @OrderByLooks=1"; } return(FinalSQL); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); EntityID = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = AppLogic.LookupHelper(EntityHelpers, m_EntitySpecs.m_EntityName); if (EntityID == 0 || EntityName.Length == 0) { Response.Redirect(AppLogic.AdminLinkUrl("default.aspx")); } if (CommonLogic.FormBool("IsSubmit")) { if (EntityID != 0) { DB.ExecuteSQL(String.Format("delete from {0}{1} where {2}ID={3}", m_EntitySpecs.m_ObjectName, m_EntitySpecs.m_EntityName, m_EntitySpecs.m_EntityName, EntityID.ToString())); } for (int i = 0; i <= Request.Form.Count - 1; i++) { if (Request.Form.Keys[i].IndexOf("DisplayOrder_") != -1) { String[] keys = Request.Form.Keys[i].Split('_'); int ObjectID = Localization.ParseUSInt(keys[1]); int DispOrd = 1; try { DispOrd = Localization.ParseUSInt(Request.Form[Request.Form.Keys[i]]); } catch { } DB.ExecuteSQL(String.Format("insert into {0}{1}({2}ID,{3}ID,DisplayOrder) values({4},{5},{6})", m_EntitySpecs.m_ObjectName, m_EntitySpecs.m_EntityName, m_EntitySpecs.m_EntityName, m_EntitySpecs.m_ObjectName, EntityID.ToString(), ObjectID.ToString(), DispOrd.ToString())); } } } SectionTitle = AppLogic.GetString("admin.sectiontitle.displayorder", SkinID, LocaleSetting); RenderHtml(); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); cust = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; EntityID = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting); return; } LoadBody(); }
public String GetMobileEntityGoogleObjectList(EntitySpecs eSpecs, int EntityID, String LocaleSetting, int AffiliateID, int CustomerLevelID) { String CacheName = String.Format("GetMobileEntityGoogleObjectList_{0}_{1}_{2}_{3}_{4}", eSpecs.m_EntityName, EntityID.ToString(), LocaleSetting, AffiliateID.ToString(), CustomerLevelID.ToString()); if (AppLogic.CachingOn) { String s = (String)HttpContext.Current.Cache.Get(CacheName); if (s != null) { return(s); } } String StoreLoc = AppLogic.GetStoreHTTPLocation(false); StringBuilder tmpS = new StringBuilder(1000); String sql = GetMobileListProductsSQL(eSpecs, EntityID, AffiliateID, CustomerLevelID, true, true, false); using (SqlConnection dbconn = DB.dbConn()) { dbconn.Open(); using (IDataReader rs = DB.GetRS(sql, dbconn)) { while (rs.Read()) { tmpS.Append("<url>"); tmpS.Append("<loc>" + StoreLoc + SE.MakeObjectAndEntityLink(eSpecs.m_ObjectName, eSpecs.m_EntityName, DB.RSFieldInt(rs, "ObjectID"), EntityID, DB.RSField(rs, "SEName")) + "</loc> "); tmpS.Append("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.ObjectChangeFreq") + "</changefreq> "); tmpS.Append("<priority>" + AppLogic.AppConfig("GoogleSiteMap.ObjectPriority") + "</priority> "); tmpS.Append("<mobile:mobile/></url>\n"); } } } if (AppLogic.CachingOn) { HttpContext.Current.Cache.Insert(CacheName, tmpS.ToString(), null, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); } return(tmpS.ToString()); }
public String GetMobileEntityGoogleSiteMap(EntityHelper passedEntityHelper, EntitySpecs eSpecs, int ForParentEntityID, String LocaleSetting, bool AllowCaching, bool RecurseChildren) { String CacheName = String.Format("GetMobileEntityGoogleSiteMap_{0}_{1}_{2}_{3}", eSpecs.m_EntityName, ForParentEntityID.ToString(), LocaleSetting, RecurseChildren.ToString()); if (AppLogic.CachingOn) { String Menu = (String)HttpContext.Current.Cache.Get(CacheName); if (Menu != null) { return(Menu); } } String StoreLoc = AppLogic.GetStoreHTTPLocation(false); StringWriter tmpS = new StringWriter(); String XslFile = "MobileEntityGoogleSiteMap"; XslCompiledTransform xForm; string XslFilePath = CommonLogic.SafeMapPath(XslFile + ".xslt"); xForm = (XslCompiledTransform)HttpContext.Current.Cache.Get(XslFilePath); if (xForm == null) { xForm = new XslCompiledTransform(false); xForm.Load(XslFilePath); HttpContext.Current.Cache.Insert(XslFilePath, xForm, new CacheDependency(XslFilePath)); } XsltArgumentList xslArgs = new XsltArgumentList(); xslArgs.AddParam("entity", "", eSpecs.m_EntityName); xslArgs.AddParam("ForParentEntityID", "", ForParentEntityID); xslArgs.AddParam("StoreLoc", "", StoreLoc); xForm.Transform(passedEntityHelper.m_TblMgr.XmlDoc, xslArgs, tmpS); if (AppLogic.CachingOn) { HttpContext.Current.Cache.Insert(CacheName, tmpS.ToString(), null, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero); } return(tmpS.ToString()); }
private void InitializeEntityTypes() { entitySpecs = EntityDefinitions.LookupSpecs(EntityType); switch (EntityType.ToUpperInvariant()) { case "MANUFACTURER": InitializeClientSideHelpers("Manufacturer"); entityHelper = AppLogic.ManufacturerStoreEntityHelper[0]; break; case "DISTRIBUTOR": ShowEmailFields(); InitializeClientSideHelpers("Distributor"); entityHelper = AppLogic.DistributorStoreEntityHelper[0]; break; default: InitializeClientSideHelpers("Category"); entityHelper = AppLogic.CategoryStoreEntityHelper[0]; break; } }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); cust = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; EntityID = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting); return; } if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { for (int i = 0; i <= Request.Form.Count - 1; i++) { String FieldName = Request.Form.Keys[i]; if (FieldName.StartsWith("shippingcost", StringComparison.InvariantCultureIgnoreCase) && !FieldName.EndsWith("_vldt", StringComparison.InvariantCultureIgnoreCase)) { String[] FieldNameSplit = FieldName.Split('_'); int ThisVariantID = Localization.ParseUSInt(FieldNameSplit[1]); int ThisShippingMethodID = Localization.ParseUSInt(FieldNameSplit[2]); decimal ShippingCost = CommonLogic.FormUSDecimal(FieldName); DB.ExecuteSQL("delete from ShippingByProduct where VariantID=" + ThisVariantID.ToString() + " and ShippingMethodID=" + ThisShippingMethodID.ToString()); DB.ExecuteSQL("insert ShippingByProduct(VariantID,ShippingMethodID,ShippingCost) values(" + ThisVariantID.ToString() + "," + ThisShippingMethodID.ToString() + "," + Localization.CurrencyStringForDBWithoutExchangeRate(ShippingCost) + ")"); } } } LoadBody(); }
protected void Page_Load(object sender, System.EventArgs e) { EntityId = CommonLogic.QueryStringUSInt("EntityID"); EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(EntitySpecs, 0); if (EntityId == 0 || EntityName.Length == 0) { ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting); return; } if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { for (var i = 0; i <= Request.Form.Count - 1; i++) { var fieldName = Request.Form.Keys[i]; if (fieldName.StartsWith("shippingcost", StringComparison.InvariantCultureIgnoreCase) && !fieldName.EndsWith("_vldt", StringComparison.InvariantCultureIgnoreCase)) { var fieldNameSplit = fieldName.Split('_'); var variantId = Localization.ParseUSInt(fieldNameSplit[1]); var shippingMethodId = Localization.ParseUSInt(fieldNameSplit[2]); var shippingCost = CommonLogic.FormUSDecimal(fieldName); DB.ExecuteSQL("delete from ShippingByProduct where VariantID=" + variantId.ToString() + " and ShippingMethodID=" + shippingMethodId.ToString()); DB.ExecuteSQL("insert ShippingByProduct(VariantID,ShippingMethodID,ShippingCost) values(" + variantId.ToString() + "," + shippingMethodId.ToString() + "," + Localization.CurrencyStringForDBWithoutExchangeRate(shippingCost) + ")"); } } AlertMessageDisplay.PushAlertMessage("The shipping costs have been saved.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } SelectedLocale = LocaleSource.GetDefaultLocale(); LoadBody(SelectedLocale.Name); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); EntityID = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { Response.Redirect(AppLogic.AdminLinkUrl("default.aspx")); } if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { for (int i = 0; i <= Request.Form.Count - 1; i++) { String FieldName = Request.Form.Keys[i]; if (FieldName.StartsWith("setitle", StringComparison.InvariantCultureIgnoreCase)) { String[] FieldNameSplit = FieldName.Split('_'); int TheProductID = Localization.ParseUSInt(FieldNameSplit[1]); int TheVariantID = Localization.ParseUSInt(FieldNameSplit[2]); string inputVal = AppLogic.FormLocaleXml("SETitle", CommonLogic.FormCanBeDangerousContent(FieldName), ThisCustomer.ThisCustomerSession.Session("entityUserLocale"), "Product", TheProductID); if (inputVal.Length == 0) { DB.ExecuteSQL("update Product set SETitle=NULL where ProductID=" + TheProductID.ToString()); } else { DB.ExecuteSQL("update Product set SETitle=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString()); } } if (FieldName.StartsWith("sekeywords", StringComparison.InvariantCultureIgnoreCase)) { String[] FieldNameSplit = FieldName.Split('_'); int TheProductID = Localization.ParseUSInt(FieldNameSplit[1]); int TheVariantID = Localization.ParseUSInt(FieldNameSplit[2]); string inputVal = AppLogic.FormLocaleXml("SEKeywords", CommonLogic.FormCanBeDangerousContent(FieldName), ThisCustomer.ThisCustomerSession.Session("entityUserLocale"), "Product", TheProductID); if (inputVal.Length == 0) { DB.ExecuteSQL("update Product set SEKeywords=NULL where ProductID=" + TheProductID.ToString()); } else { DB.ExecuteSQL("update Product set SEKeywords=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString()); } } if (FieldName.StartsWith("sedescription", StringComparison.InvariantCultureIgnoreCase)) { String[] FieldNameSplit = FieldName.Split('_'); int TheProductID = Localization.ParseUSInt(FieldNameSplit[1]); int TheVariantID = Localization.ParseUSInt(FieldNameSplit[2]); string inputVal = AppLogic.FormLocaleXml("SEDescription", CommonLogic.FormCanBeDangerousContent(FieldName), ThisCustomer.ThisCustomerSession.Session("entityUserLocale"), "Product", TheProductID); if (inputVal.Length == 0) { DB.ExecuteSQL("update Product set SEDescription=NULL where ProductID=" + TheProductID.ToString()); } else { DB.ExecuteSQL("update Product set SEDescription=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString()); } } if (FieldName.StartsWith("senoscript", StringComparison.InvariantCultureIgnoreCase)) { String[] FieldNameSplit = FieldName.Split('_'); int TheProductID = Localization.ParseUSInt(FieldNameSplit[1]); int TheVariantID = Localization.ParseUSInt(FieldNameSplit[2]); string inputVal = AppLogic.FormLocaleXml("SENoScript", CommonLogic.FormCanBeDangerousContent(FieldName), ThisCustomer.ThisCustomerSession.Session("entityUserLocale"), "Product", TheProductID); if (inputVal.Length == 0) { DB.ExecuteSQL("update Product set SENoScript=NULL where ProductID=" + TheProductID.ToString()); } else { DB.ExecuteSQL("update Product set SENoScript=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString()); } } } } LoadBody(); }
protected void Page_Load(object sender, System.EventArgs e) { EntityID = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { AlertMessageDisplay.PushAlertMessage(AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting), AspDotNetStorefrontControls.AlertMessage.AlertType.Error); return; } if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { var products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID); products.PageSize = 0; products.PageNum = 1; products.PublishedOnly = false; products.ReturnAllVariants = true; var dsProducts = products.LoadFromDB(); var NumProducts = products.NumProducts; foreach (DataRow row in dsProducts.Tables[0].Rows) { var ThisProductID = DB.RowFieldInt(row, "ProductID"); var ThisVariantID = DB.RowFieldInt(row, "VariantID"); var Price = System.Decimal.Zero; var SalePrice = System.Decimal.Zero; var MSRP = System.Decimal.Zero; var Cost = System.Decimal.Zero; if (CommonLogic.FormCanBeDangerousContent("Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0) { Price = CommonLogic.FormUSDecimal("Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); } if (CommonLogic.FormCanBeDangerousContent("SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0) { SalePrice = CommonLogic.FormUSDecimal("SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); } if (CommonLogic.FormCanBeDangerousContent("MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0) { MSRP = CommonLogic.FormUSDecimal("MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); } if (CommonLogic.FormCanBeDangerousContent("Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0) { Cost = CommonLogic.FormUSDecimal("Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); } var sql = new StringBuilder(1024); sql.Append("update productvariant set "); sql.Append("Price=" + Localization.DecimalStringForDB(Price) + ","); sql.Append("SalePrice=" + CommonLogic.IIF(SalePrice != System.Decimal.Zero, Localization.DecimalStringForDB(SalePrice), "NULL") + ","); sql.Append("MSRP=" + CommonLogic.IIF(MSRP != System.Decimal.Zero, Localization.DecimalStringForDB(MSRP), "NULL") + ","); sql.Append("Cost=" + CommonLogic.IIF(Cost != System.Decimal.Zero, Localization.DecimalStringForDB(Cost), "NULL")); sql.Append(" where VariantID=" + ThisVariantID.ToString()); DB.ExecuteSQL(sql.ToString()); } dsProducts.Dispose(); AlertMessageDisplay.PushAlertMessage("The prices have been updated.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } SelectedLocale = LocaleSource.GetDefaultLocale(); LoadBody(SelectedLocale.Name); }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; eID = CommonLogic.QueryStringNativeInt("EntityID"); eName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); eSpecs = EntityDefinitions.LookupSpecs(eName); entity = new EntityHelper(eSpecs, 0); pID = CommonLogic.QueryStringNativeInt("ProductID"); ProductSKU = AppLogic.GetProductSKU(pID); if (!IsPostBack) { ltEntity.Text = entity.GetEntityBreadcrumb6(eID, ThisCustomer.LocaleSetting); ltProduct.Text = "<a href=\"" + AppLogic.AdminLinkUrl("entityEditProducts.aspx") + "?iden=" + pID + "&entityName=" + eName + "&entityFilterID=" + eID + "\">" + AppLogic.GetProductName(pID, ThisCustomer.LocaleSetting) + " (" + pID + ")</a>"; string query = CommonLogic.QueryStringCanBeDangerousContent("searchfor"); ViewState["SQLString"] = selectSQL; //set page settings if (ThisCustomer.ThisCustomerSession.Session("productVariantsSort").Length == 0) { ViewState["Sort"] = "DisplayOrder, Name"; } else { ViewState["Sort"] = ThisCustomer.ThisCustomerSession.Session("productVariantsSort"); } if (ThisCustomer.ThisCustomerSession.Session("productVariantsOrder").Length == 0) { ViewState["SortOrder"] = "ASC"; } else { ViewState["SortOrder"] = ThisCustomer.ThisCustomerSession.Session("productVariantsOrder"); } if (ThisCustomer.ThisCustomerSession.Session("productVariantsSearch").Length != 0) { query = ThisCustomer.ThisCustomerSession.Session("productVariantsSearch"); } resultFilter(query); btnDeleteVariants.Attributes.Add("onclick", string.Format( "return confirm('{0}');", DeleteAllPrompt)); if (0 < DB.GetSqlN("select count(*) N from ShoppingCart with (NOLOCK) where ProductID=" + pID.ToString() + " and CartType=" + ((int)CartTypeEnum.RecurringCart).ToString())) { btnDeleteVariants.Enabled = false; btnDeleteVariants.Visible = false; } AppLogic.MakeSureProductHasAtLeastOneVariant(pID); } AppLogic.EnsureProductHasADefaultVariantSet(pID); }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); eID = CommonLogic.QueryStringNativeInt("EntityFilterID"); eName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); eSpecs = EntityDefinitions.LookupSpecs(eName); switch (eName.ToUpperInvariant()) { case "SECTION": ltPreEntity.Text = AppLogic.GetString("admin.common.SectionApos", SkinID, LocaleSetting); entity = new EntityHelper(EntityDefinitions.readonly_SectionEntitySpecs, 0); break; case "MANUFACTURER": ltPreEntity.Text = AppLogic.GetString("admin.common.ManufacturerApos", SkinID, LocaleSetting); entity = new EntityHelper(EntityDefinitions.readonly_ManufacturerEntitySpecs, 0); break; case "DISTRIBUTOR": ltPreEntity.Text = AppLogic.GetString("admin.common.DistributorApos", SkinID, LocaleSetting); entity = new EntityHelper(EntityDefinitions.readonly_DistributorEntitySpecs, 0); break; case "GENRE": ltPreEntity.Text = AppLogic.GetString("admin.common.GenreApos", SkinID, LocaleSetting); entity = new EntityHelper(EntityDefinitions.readonly_GenreEntitySpecs, 0); break; case "VECTOR": ltPreEntity.Text = AppLogic.GetString("admin.common.VectorApos", SkinID, LocaleSetting); entity = new EntityHelper(EntityDefinitions.readonly_VectorEntitySpecs, 0); break; case "LIBRARY": ltPreEntity.Text = AppLogic.GetString("admin.common.LibraryApos", SkinID, LocaleSetting); entity = new EntityHelper(EntityDefinitions.readonly_LibraryEntitySpecs, 0); break; default: ltPreEntity.Text = AppLogic.GetString("admin.common.CategoryApos", SkinID, LocaleSetting); entity = new EntityHelper(EntityDefinitions.readonly_CategoryEntitySpecs, 0); break; } if (!IsPostBack) { ltEntity.Text = entity.GetEntityBreadcrumb6(eID, LocaleSetting); string query = CommonLogic.QueryStringCanBeDangerousContent("searchfor"); loadTree(); loadTypes(); ViewState["SQLString"] = selectSQL; //set page settings if (ThisCustomer.ThisCustomerSession.Session("ProductsSort").Length == 0) { ViewState["Sort"] = "Name"; } else { ViewState["Sort"] = ThisCustomer.ThisCustomerSession.Session("ProductsSort"); } if (ThisCustomer.ThisCustomerSession.Session("ProductsOrder").Length == 0) { ViewState["SortOrder"] = "ASC"; } else { ViewState["SortOrder"] = ThisCustomer.ThisCustomerSession.Session("ProductsOrder"); } if (ThisCustomer.ThisCustomerSession.Session("ProductsSearch").Length != 0) { query = ThisCustomer.ThisCustomerSession.Session("ProductsSearch"); } if (ThisCustomer.ThisCustomerSession.Session("ProductsTree").Length != 0) { treeMain.FindNode(ThisCustomer.ThisCustomerSession.Session("ProductsTree")).Selected = true; } if (ThisCustomer.ThisCustomerSession.Session("ProductsType").Length != 0) { ddTypes.Items.FindByValue(ThisCustomer.ThisCustomerSession.Session("ProductsType")).Selected = true; } resultFilter(query); txtSearch.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('btnSearch','')"); if (AppLogic.MaxProductsExceeded()) { btnAdd.Enabled = false; btnAdd.CssClass = "normalButtonsDisabled"; ltError.Text = "<font class=\"errorMsg\">" + AppLogic.GetString("admin.entityProducts.ErrorMsg", SkinID, LocaleSetting) + "</font> "; } else { btnAdd.Enabled = true; btnAdd.CssClass = "normalButtons"; } } }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); cust = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; EntityID = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting); return; } if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { ProductCollection products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID); products.PageSize = 0; products.PageNum = 1; products.PublishedOnly = false; products.ReturnAllVariants = true; DataSet dsProducts = products.LoadFromDB(); int NumProducts = products.NumProducts; foreach (DataRow row in dsProducts.Tables[0].Rows) { int ThisProductID = DB.RowFieldInt(row, "ProductID"); int ThisVariantID = DB.RowFieldInt(row, "VariantID"); decimal Price = System.Decimal.Zero; decimal SalePrice = System.Decimal.Zero; decimal MSRP = System.Decimal.Zero; decimal Cost = System.Decimal.Zero; if (CommonLogic.FormCanBeDangerousContent("Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0) { Price = CommonLogic.FormUSDecimal("Price_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); } if (CommonLogic.FormCanBeDangerousContent("SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0) { SalePrice = CommonLogic.FormUSDecimal("SalePrice_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); } if (CommonLogic.FormCanBeDangerousContent("MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0) { MSRP = CommonLogic.FormUSDecimal("MSRP_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); } if (CommonLogic.FormCanBeDangerousContent("Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()).Length != 0) { Cost = CommonLogic.FormUSDecimal("Cost_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); } StringBuilder sql = new StringBuilder(1024); sql.Append("update productvariant set "); sql.Append("Price=" + Localization.DecimalStringForDB(Price) + ","); sql.Append("SalePrice=" + CommonLogic.IIF(SalePrice != System.Decimal.Zero, Localization.DecimalStringForDB(SalePrice), "NULL") + ","); sql.Append("MSRP=" + CommonLogic.IIF(MSRP != System.Decimal.Zero, Localization.DecimalStringForDB(MSRP), "NULL") + ","); sql.Append("Cost=" + CommonLogic.IIF(Cost != System.Decimal.Zero, Localization.DecimalStringForDB(Cost), "NULL")); sql.Append(" where VariantID=" + ThisVariantID.ToString()); DB.ExecuteSQL(sql.ToString()); } dsProducts.Dispose(); } LoadBody(); }
protected void Page_Load(object sender, System.EventArgs e) { EntityID = CommonLogic.QueryStringUSInt("EntityID"); if (EntityID < 1) { EntityID = CommonLogic.FormNativeInt("EntityID"); } EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); if (String.IsNullOrEmpty(EntityName)) { EntityName = CommonLogic.FormCanBeDangerousContent("EntityName"); } m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { ltBody.Text = AppLogic.GetString("admin.common.InvalidParameters", SkinID, LocaleSetting); return; } if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { var products = new ProductCollection(m_EntitySpecs.m_EntityName, EntityID); products.PageSize = 0; products.PageNum = 1; products.PublishedOnly = false; products.ReturnAllVariants = true; using (var dsProducts = products.LoadFromDB()) { var NumProducts = products.NumProducts; foreach (DataRow row in dsProducts.Tables[0].Rows) { if (DB.RowFieldBool(row, "IsDownload")) { var ThisProductID = DB.RowFieldInt(row, "ProductID"); var ThisVariantID = DB.RowFieldInt(row, "VariantID"); var sql = new StringBuilder(1024); sql.Append("update productvariant set "); var DLoc = CommonLogic.FormCanBeDangerousContent("DownloadLocation_" + ThisProductID.ToString() + "_" + ThisVariantID.ToString()); if (DLoc.StartsWith("/")) { DLoc = DLoc.Substring(1, DLoc.Length - 1); // remove leading / char! } sql.Append("DownloadLocation=" + DB.SQuote(DLoc)); sql.Append(" where VariantID=" + ThisVariantID.ToString()); DB.ExecuteSQL(sql.ToString()); } } } AlertMessage.PushAlertMessage("Download Files Saved", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } SelectedLocale = LocaleSource.GetDefaultLocale(); LoadBody(SelectedLocale.Name); }
protected void Page_Load(object sender, System.EventArgs e) { EntityID = CommonLogic.QueryStringUSInt("EntityID");; EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName"); m_EntitySpecs = EntityDefinitions.LookupSpecs(EntityName); Helper = new EntityHelper(m_EntitySpecs, 0); if (EntityID == 0 || EntityName.Length == 0) { Response.Redirect(AppLogic.AdminLinkUrl("default.aspx")); } SelectedLocale = LocaleSource.GetDefaultLocale(); if (CommonLogic.FormCanBeDangerousContent("IsSubmit").Equals("TRUE", StringComparison.InvariantCultureIgnoreCase)) { for (var i = 0; i <= Request.Form.Count - 1; i++) { var FieldName = Request.Form.Keys[i]; if (FieldName.StartsWith("setitle", StringComparison.InvariantCultureIgnoreCase)) { var FieldNameSplit = FieldName.Split('_'); var TheProductID = Localization.ParseUSInt(FieldNameSplit[1]); var TheVariantID = Localization.ParseUSInt(FieldNameSplit[2]); var inputVal = AppLogic.FormLocaleXml("SETitle", CommonLogic.FormCanBeDangerousContent(FieldName), SelectedLocale.Name, "Product", TheProductID); if (inputVal.Length == 0) { DB.ExecuteSQL("update Product set SETitle=NULL where ProductID=" + TheProductID.ToString()); } else { DB.ExecuteSQL("update Product set SETitle=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString()); } } if (FieldName.StartsWith("sekeywords", StringComparison.InvariantCultureIgnoreCase)) { var FieldNameSplit = FieldName.Split('_'); var TheProductID = Localization.ParseUSInt(FieldNameSplit[1]); var TheVariantID = Localization.ParseUSInt(FieldNameSplit[2]); var inputVal = AppLogic.FormLocaleXml("SEKeywords", CommonLogic.FormCanBeDangerousContent(FieldName), SelectedLocale.Name, "Product", TheProductID); if (inputVal.Length == 0) { DB.ExecuteSQL("update Product set SEKeywords=NULL where ProductID=" + TheProductID.ToString()); } else { DB.ExecuteSQL("update Product set SEKeywords=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString()); } } if (FieldName.StartsWith("sedescription", StringComparison.InvariantCultureIgnoreCase)) { var FieldNameSplit = FieldName.Split('_'); var TheProductID = Localization.ParseUSInt(FieldNameSplit[1]); var TheVariantID = Localization.ParseUSInt(FieldNameSplit[2]); var inputVal = AppLogic.FormLocaleXml("SEDescription", CommonLogic.FormCanBeDangerousContent(FieldName), SelectedLocale.Name, "Product", TheProductID); if (inputVal.Length == 0) { DB.ExecuteSQL("update Product set SEDescription=NULL where ProductID=" + TheProductID.ToString()); } else { DB.ExecuteSQL("update Product set SEDescription=" + DB.SQuote(inputVal) + " where ProductID=" + TheProductID.ToString()); } } } AlertMessageDisplay.PushAlertMessage("The search engine fields have been saved.", AspDotNetStorefrontControls.AlertMessage.AlertType.Success); } LoadBody(SelectedLocale.Name); }