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.ContentType     = "text/xml";
            Response.ContentEncoding = new System.Text.UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            String EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            if (EntityName.IndexOf("<script>", StringComparison.InvariantCultureIgnoreCase) != -1)
            {
                throw new ArgumentException("SECURITY EXCEPTION");
            }
            String EntityID = CommonLogic.QueryStringCanBeDangerousContent("EntityID");

            EntityHelper eHlp = new EntityHelper(EntityDefinitions.LookupSpecs(EntityName));

            Response.Write("<urlset xmlns=\"" + AppLogic.AppConfig("GoogleSiteMap.Xmlns") + "\">");

            Response.Write("<url>");
            Response.Write("<loc>" + XmlCommon.XmlEncode(AppLogic.GetStoreHTTPLocation(false) + SE.MakeEntityLink(EntityName, EntityID, String.Empty)) + "</loc> ");
            Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.EntityChangeFreq") + "</changefreq> ");
            Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.EntityPriority") + "</priority> ");
            Response.Write("</url>");

            Response.Write(eHlp.GetEntityGoogleObjectList(EntityID, Localization.WebConfigLocale, String.Empty, String.Empty));

            Response.Write("</urlset>");
        }
Exemple #3
0
        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();
        }
Exemple #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new System.Text.UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

            String EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            AppLogic.CheckForScriptTag(EntityName);
            int EntityID = CommonLogic.QueryStringUSInt("EntityID");

            EntityHelper eHlp = AppLogic.LookupHelper(EntityName, AppLogic.StoreID());

            Response.Write("<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:mobile='http://www.google.com/schemas/sitemap-mobile/1.0'>\n");

            Response.Write("<url>");
            Response.Write("<loc>" + XmlCommon.XmlEncode(AppLogic.GetStoreHTTPLocation(false, false) + SE.MakeEntityLink(EntityName, EntityID, String.Empty)) + "</loc> ");
            Response.Write("<changefreq>" + AppLogic.AppConfig("GoogleSiteMap.EntityChangeFreq") + "</changefreq> ");
            Response.Write("<priority>" + AppLogic.AppConfig("GoogleSiteMap.EntityPriority") + "</priority> ");
            Response.Write("<mobile:mobile/></url>\n");

            Response.Write(GetMobileEntityGoogleObjectList(EntityDefinitions.LookupSpecs(EntityName), EntityID, Localization.GetDefaultLocale(), 0, 0));

            Response.Write("</urlset>");
        }
        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);
        }
        protected void UpdateDisplayOrder(object sender, EventArgs e)
        {
            foreach (RepeaterItem ri in subcategories.Items)
            {
                TextBox d   = (TextBox)ri.FindControl("DisplayOrder");
                TextBox eid = (TextBox)ri.FindControl("entityid");

                string displayorder = CommonLogic.IIF(CommonLogic.IsInteger(d.Text), d.Text, "1");
                DB.ExecuteSQL("update " + ViewState["entityname"].ToString() + " set displayorder = " + displayorder + " where " + ViewState["entityname"].ToString() + "ID = " + eid.Text);
            }

            //refresh the static entityhelper
            switch (ViewState["entityname"].ToString().ToUpperInvariant())
            {
            case "CATEGORY":
                AppLogic.CategoryStoreEntityHelper[0] = new EntityHelper(0, EntityDefinitions.LookupSpecs("Category"), true, 0);
                EntityXml = new EntityHelper(0, EntityDefinitions.LookupSpecs("Category"), false, 0).m_TblMgr.XmlDoc;

                break;

            case "SECTION":
                AppLogic.SectionStoreEntityHelper[0] = new EntityHelper(0, EntityDefinitions.LookupSpecs("Section"), true, 0);
                EntityXml = new EntityHelper(0, EntityDefinitions.LookupSpecs("Section"), false, 0).m_TblMgr.XmlDoc;
                break;

            case "MANUFACTURER":
                AppLogic.ManufacturerStoreEntityHelper[0] = new EntityHelper(0, EntityDefinitions.LookupSpecs("Manufacturer"), true, 0);
                EntityXml = new EntityHelper(0, EntityDefinitions.LookupSpecs("Manufacturer"), false, 0).m_TblMgr.XmlDoc;
                break;

            case "DISTRIBUTOR":
                AppLogic.DistributorStoreEntityHelper[0] = new EntityHelper(0, EntityDefinitions.LookupSpecs("Distributor"), true, 0);
                EntityXml = new EntityHelper(0, EntityDefinitions.LookupSpecs("Distributor"), false, 0).m_TblMgr.XmlDoc;
                break;

            case "GENRE":
                AppLogic.GenreStoreEntityHelper[0] = new EntityHelper(0, EntityDefinitions.LookupSpecs("Genre"), true, 0);
                EntityXml = new EntityHelper(0, EntityDefinitions.LookupSpecs("Genre"), false, 0).m_TblMgr.XmlDoc;
                break;

            case "VECTOR":
                AppLogic.VectorStoreEntityHelper[0] = new EntityHelper(0, EntityDefinitions.LookupSpecs("Vector"), true, 0);
                EntityXml = new EntityHelper(0, EntityDefinitions.LookupSpecs("Genre"), false, 0).m_TblMgr.XmlDoc;
                break;

            case "LIBRARY":
                AppLogic.LibraryStoreEntityHelper[0] = new EntityHelper(0, EntityDefinitions.LookupSpecs("Library"), true, 0);
                EntityXml = new EntityHelper(0, EntityDefinitions.LookupSpecs("Library"), false, 0).m_TblMgr.XmlDoc;
                break;
            }

            LoadBody();
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        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");

            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();
        }
Exemple #11
0
        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);
        }
Exemple #13
0
        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();
        }
Exemple #15
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");

            String EntityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            if (EntityName.IndexOf("<script>", StringComparison.InvariantCultureIgnoreCase) != -1)
            {
                throw new ArgumentException("SECURITY EXCEPTION");
            }

            String EntityID = CommonLogic.QueryStringCanBeDangerousContent("EntityID");

            if (EntityName.Length != 0 && EntityID != String.Empty)
            {
                EntityHelper eHlp = new EntityHelper(EntityDefinitions.LookupSpecs(EntityName));
                Response.Write(XmlCommon.XmlEncode(AppLogic.GetStoreHTTPLocation(false) + SE.MakeEntityLink(EntityName, EntityID, String.Empty)) + Environment.NewLine);
                Response.Write(eHlp.GetEntityYahooObjectList(EntityID, Localization.WebConfigLocale, String.Empty, String.Empty));
            }
        }
Exemple #16
0
        protected void loadDD()
        {
            ddCategory.Items.Clear();
            ddSection.Items.Clear();
            ddManufacturer.Items.Clear();


            ddCategory.Items.Add(new ListItem(" - " + AppLogic.GetString("admin.common.AllCategories", SkinID, LocaleSetting) + " - ", "0"));
            ddSection.Items.Add(new ListItem(" - " + AppLogic.GetString("admin.common.AllSections", SkinID, LocaleSetting) + " - ", "0"));
            ddManufacturer.Items.Add(new ListItem(" - " + AppLogic.GetString("admin.common.AllManufacturers", SkinID, LocaleSetting) + " -", "0"));

            //Categories
            EntityHelper Helper = new EntityHelper(EntityDefinitions.LookupSpecs("Category"), 0);
            ArrayList    al     = Helper.GetEntityArrayList(0, String.Empty, 0, cust.LocaleSetting, false);

            foreach (ListItemClass li in al)
            {
                ddCategory.Items.Add(new ListItem(li.Item, li.Value.ToString()));
            }

            //Sections
            Helper = new EntityHelper(EntityDefinitions.LookupSpecs("Section"), 0);
            al     = Helper.GetEntityArrayList(0, String.Empty, 0, cust.LocaleSetting, false);
            foreach (ListItemClass li in al)
            {
                ddSection.Items.Add(new ListItem(li.Item, li.Value.ToString()));
            }

            //Products


            //Manufacturers
            Helper = new EntityHelper(EntityDefinitions.LookupSpecs("Manufacturer"), 0);
            al     = Helper.GetEntityArrayList(0, String.Empty, 0, cust.LocaleSetting, false);
            foreach (ListItemClass li in al)
            {
                ddManufacturer.Items.Add(new ListItem(li.Item, li.Value.ToString()));
            }
        }
Exemple #17
0
        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;
            }
        }
Exemple #18
0
        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)
        {
            Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;

            MobileHelper.RedirectPageWhenMobileIsDisabled("~/googleindex.aspx", ThisCustomer);

            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new System.Text.UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

            Response.Write("<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n");
            Response.Write("<sitemap>");
            Response.Write("<loc>" + AppLogic.GetStoreHTTPLocation(false) + "mobilegoogletopics.aspx</loc>");
            Response.Write("</sitemap>\n");

            Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.CategoryStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Category"), 0, MobilePlatform.MobileLocaleDefault, true, true));
            Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.SectionStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Section"), 0, MobilePlatform.MobileLocaleDefault, true, true));
            Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.ManufacturerStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Manufacturer"), 0, MobilePlatform.MobileLocaleDefault, true, true));
            Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.DistributorStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Distributor"), 0, MobilePlatform.MobileLocaleDefault, true, true));
            Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.GenreStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Genre"), 0, MobilePlatform.MobileLocaleDefault, true, true));
            Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.VectorStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Vector"), 0, MobilePlatform.MobileLocaleDefault, true, true));
            Response.Write(GetMobileEntityGoogleSiteMap(AppLogic.LibraryStoreEntityHelper[0], EntityDefinitions.LookupSpecs("Library"), 0, MobilePlatform.MobileLocaleDefault, true, true));

            Response.Write("</sitemapindex>");
        }
Exemple #21
0
        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();
        }
Exemple #22
0
    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, 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, 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);
        }
        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);
        }
Exemple #26
0
        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>&nbsp;&nbsp;&nbsp;";
                }
                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");

            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();
        }
        public ViewResult Index(int?productTypeFilterId)
        {
            var customer = HttpContext.GetCustomer();
            var settings = SiteMapSettingsProvider.LoadSiteMapSettings();

            var viewModel = new SiteMapViewModel
            {
                ShowCategories      = settings.ShowCategories,
                ShowManufacturers   = settings.ShowManufacturers,
                ShowSections        = settings.ShowSections,
                ShowTopics          = settings.ShowTopics,
                ShowProducts        = settings.ShowProducts,
                ShowCustomerService = settings.ShowCustomerService
            };

            if (settings.ShowProducts)
            {
                // Using named routes drastically improves performance for sites with many products.
                var routingConfiguration = RoutingConfigurationProvider.GetRoutingConfiguration();

                string productRouteName;
                if (routingConfiguration.LegacyRouteGenerationEnabled)
                {
                    productRouteName = RouteNames.Product;
                }
                else if (routingConfiguration.SeNameOnlyRoutesEnabled)
                {
                    productRouteName = RouteNames.ModernProductSeNameOnly;
                }
                else
                {
                    productRouteName = RouteNames.ModernProduct;
                }

                using (var connection = new SqlConnection(DB.GetDBConn()))
                    using (var command = connection.CreateCommand())
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.CommandText = "aspdnsf_GetProducts";
                        command.Parameters.AddWithValue("@CustomerLevelID", customer.CustomerLevelID);
                        command.Parameters.AddWithValue("@affiliateID", customer.AffiliateID);
                        command.Parameters.AddWithValue("@ProductTypeID", productTypeFilterId);
                        command.Parameters.AddWithValue("@InventoryFilter", settings.InventoryThreshold);
                        command.Parameters.AddWithValue("@localeName", customer.LocaleSetting);
                        command.Parameters.AddWithValue("@storeID", customer.StoreID);
                        command.Parameters.AddWithValue("@filterProduct", settings.ProductFiltering);
                        command.Parameters.AddWithValue("@ViewType", 1);
                        command.Parameters.AddWithValue("@pagenum", 1);
                        command.Parameters.AddWithValue("@pagesize", 2147483647);
                        command.Parameters.AddWithValue("@StatsFirst", 0);
                        command.Parameters.AddWithValue("@publishedonly", 1);
                        command.Parameters.AddWithValue("@ExcludeKits", 0);
                        command.Parameters.AddWithValue("@ExcludeSysProds", 1);

                        connection.Open();

                        using (var reader = command.ExecuteReader())
                            while (reader.Read())
                            {
                                var id = reader.FieldInt("ProductID");

                                var localizedName = XmlCommon.GetLocaleEntry(
                                    reader.Field("name"),
                                    customer.LocaleSetting,
                                    fallBack: true);

                                var seName = reader.Field("sename");

                                viewModel.Products.Add(
                                    new Models.SiteMapEntity
                                {
                                    Name = localizedName,
                                    Url  = Url.BuildProductLink(id, seName)
                                });
                            }
                    }
            }

            if (settings.ShowTopics)
            {
                using (var connection = DB.dbConn())
                {
                    connection.Open();
                    using (var reader = DB.GetRS(
                               @"declare @storeSpecificTopics table
						(
							topicid int,
							name varchar(max),
							title varchar(max),
							storeid int,
							displayorder int
						)

						insert into @storeSpecificTopics
							select topicid, name, title, storeid, displayorder from topic as dt with (nolock)
								where showinsitemap = 1
								and deleted = 0
								and published = 1
								and(storeid = @storeId)
								and @filterTopic = 1

						select topicid, name, title, storeid, displayorder from topic as dt with (nolock)
							where showinsitemap = 1
							and deleted = 0
							and published = 1
							and(storeid = 0)
							and name not in (select name from @storeSpecificTopics)
						union select * from @storeSpecificTopics
						order by displayorder, title"                        ,
                               connection,
                               new SqlParameter("@filterTopic", settings.TopicFiltering),
                               new SqlParameter("@storeId", customer.StoreID)))
                    {
                        while (reader.Read())
                        {
                            var topicId = reader.FieldInt("topicid");

                            var name = reader.Field("name");

                            var localizedTitle = XmlCommon.GetLocaleEntry(
                                reader.Field("title"),
                                customer.LocaleSetting,
                                fallBack: true);

                            viewModel.Topics.Add(
                                new Models.SiteMapEntity()
                            {
                                Name = localizedTitle,
                                Url  = Url.BuildTopicLink(name)
                            });
                        }
                    }
                }
            }

            if (settings.ShowCustomerService)
            {
                viewModel.CustomerService.Add(
                    new Models.SiteMapEntity()
                {
                    Name = AppLogic.GetString("menu.YourAccount"),
                    Url  = Url.Action(ActionNames.Index, ControllerNames.Account)
                });

                viewModel.CustomerService.Add(
                    new Models.SiteMapEntity()
                {
                    Name = AppLogic.GetString("menu.OrderHistory"),
                    Url  = string.Concat(
                        Url.Action(ActionNames.Index, ControllerNames.Account),
                        "#orderhistory")
                });

                viewModel.CustomerService.Add(
                    new Models.SiteMapEntity()
                {
                    Name = AppLogic.GetString("menu.Contact"),
                    Url  = Url.Action(ActionNames.Index, ControllerNames.ContactUs)
                });
            }

            if (settings.ShowCategories)
            {
                EntityHelper entityHelper =
                    new EntityHelper(
                        CacheMinutes: 0,
                        eSpecs: EntityDefinitions.LookupSpecs(EntityTypes.Category),
                        PublishedOnly: true,
                        StoreID: 0);

                viewModel.Categories = AddEntities(
                    entityHelper
                    .m_TblMgr
                    .XmlDoc
                    .SelectNodes("/root/Entity"),
                    customer,
                    EntityTypes.Category);
            }

            if (settings.ShowSections)
            {
                EntityHelper entityHelper =
                    new EntityHelper(
                        CacheMinutes: 0,
                        eSpecs: EntityDefinitions.LookupSpecs(EntityTypes.Section),
                        PublishedOnly: true,
                        StoreID: 0);

                viewModel.Sections = AddEntities(
                    entityHelper
                    .m_TblMgr
                    .XmlDoc
                    .SelectNodes("/root/Entity"),
                    customer,
                    EntityTypes.Section);
            }

            if (settings.ShowManufacturers)
            {
                EntityHelper entityHelper =
                    new EntityHelper(
                        CacheMinutes: 0,
                        eSpecs: EntityDefinitions.LookupSpecs(EntityTypes.Manufacturer),
                        PublishedOnly: true,
                        StoreID: 0);

                viewModel.Manufacturers = AddEntities(
                    entityHelper
                    .m_TblMgr
                    .XmlDoc
                    .SelectNodes("/root/Entity"),
                    customer,
                    EntityTypes.Manufacturer);
            }

            return(View(ViewNames.SiteMap, viewModel));
        }