Esempio n. 1
0
 public static bool IsRegistered(Type entityType)
 {
     return(EntityDefinitions.ContainsKey(entityType));
 }
Esempio n. 2
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();
        }
Esempio n. 3
0
 public static void RemoveEntityDefinition(IEntityDefinition definition)
 {
     EntityDefinitions.TryRemove(definition.EntityType, out _);
 }
Esempio n. 4
0
 public static void RemoveAllDefinitions()
 {
     EntityDefinitions.Clear();
 }
Esempio n. 5
0
        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)
        {
            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>");
        }
Esempio n. 7
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";
                }
            }
        }
Esempio n. 8
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");
            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);
        }
        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));
        }