コード例 #1
0
        static public String MakeObjectLink(String ObjectName, int ObjectID, String SEName)
        {
            string objectprefix = ObjectName.Substring(0, 1).ToLowerInvariant();

            if (SEName == null)
            {
                SEName = String.Empty;
            }
            String URL = String.Empty;
            String tmp = String.Empty;

            if (SEName.Length != 0)
            {
                tmp = MungeName(SEName);
            }
            else
            {
                tmp = SE.GetObjectSEName(ObjectName, ObjectID);
            }

            RouteValueDictionary dictionary = new RouteValueDictionary();

            dictionary.Add(ObjectName + "ID", ObjectID);
            dictionary.Add("SEName", tmp);

            VirtualPathData pathInfo = RouteTable.Routes.GetVirtualPath(null, ObjectName, dictionary);

            if (pathInfo != null)
            {
                URL = pathInfo.VirtualPath;
            }

            //URL = String.Format("{0}-{1}-{2}.aspx",objectprefix,ObjectID.ToString(),tmp);
            return(URL.ToLowerInvariant());
        }
コード例 #2
0
            public virtual XmlNode ToSiteMapTopicNode(XmlDocument context)
            {
                String tName = XmlCommon.GetLocaleEntry(Name, Customer.Current.LocaleSetting, true);

                Topic t = new Topic(tName, Customer.Current.LocaleSetting);

                return(SiteMapNode(t.SectionTitle, SE.MakeDriverLink(tName), context));
            }
コード例 #3
0
        private static string GoogleProductXML(SiteMap.SiteMapProduct product)
        {
            string link = SE.MakeProductLink(product.EntityID, product.SEName);

            if (!link.StartsWith("/"))
            {
                link = "/" + link;
            }
            return(string.Format("<url><loc>" + AppLogic.GetStoreHTTPLocation(false, false) + "{0}</loc><changefreq>{1}</changefreq><priority>{2}</priority></url>\n", link, AppLogic.AppConfig("GoogleSiteMap.ObjectChangeFreq"), AppLogic.AppConfig("GoogleSiteMap.ObjectPriority")));
        }
コード例 #4
0
        public static String GetEntitySEName(String EntityName, int EntityID)
        {
            String uname = String.Empty;

            if (EntityID != 0)
            {
                if (EntityName == "Product" || EntityName == "ProductVariant")
                {
                    using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                    {
                        con.Open();
                        using (IDataReader rs = DB.GetRS("Select Name,SEName from [" + EntityName.Replace("]", "") + "]  with (NOLOCK)  where " + EntityName + "ID=" + EntityID.ToString(), con))
                        {
                            if (rs.Read())
                            {
                                uname = DB.RSField(rs, "SEName");
                                if (uname.Length == 0)
                                {
                                    uname = DB.RSFieldByLocale(rs, "Name", Localization.GetUSLocale());                           // SENames are ALWAYS from U.S locale
                                    //update the SEName Field since it's empty
                                    DB.ExecuteSQL(String.Format("update [" + EntityName.Replace("]", "") + "] set SEName={0} where " + EntityName + "ID={1}", DB.SQuote(CommonLogic.Left(SE.MungeName(uname), 90)), EntityID));
                                }
                            }
                        }
                    }
                }
                else
                {
                    using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                    {
                        con.Open();
                        using (IDataReader rs = DB.GetRS("select SEName,Name from [" + EntityName.Replace("]", "") + "]  with (NOLOCK)  where " + EntityName + "ID=" + EntityID.ToString(), con))
                        {
                            if (rs.Read())
                            {
                                uname = DB.RSField(rs, "SEName");
                                if (uname.Length == 0)
                                {
                                    uname = DB.RSFieldByLocale(rs, "Name", Localization.GetUSLocale());
                                    //update the SEName Field since it's empty
                                    DB.ExecuteSQL(String.Format("update [" + EntityName.Replace("]", "") + "] set SEName={0} where " + EntityName + "ID={1}", DB.SQuote(CommonLogic.Left(SE.MungeName(uname), 90)), EntityID));
                                }
                            }
                        }
                    }
                }
            }
            return(CommonLogic.Left(SE.MungeName(uname), 90));
        }
コード例 #5
0
            public override XmlNode ToSiteMapNode(XmlDocument context)
            {
                XmlNode node = SiteMapNode(Name, SE.MakeEntityLink(EntityType, EntityID, SEName), context);

                if (SiteMap.Settings.ShowProducts)
                {
                    foreach (SiteMapProduct prod in Products)
                    {
                        node.AppendChild(prod.ToSiteMapNode(context));
                    }
                    foreach (NestedSiteMapEntity ent in Children)
                    {
                        node.AppendChild(ent.ToSiteMapNode(context));
                    }
                }
                return(node);
            }
コード例 #6
0
        static public String MakeEntityLink(String EntityName, int EntityID, String SEName)
        {
            if (SEName == null)
            {
                SEName = String.Empty;
            }
            String URL = String.Empty;

            if (!AppLogic.IsAdminSite)
            {
                String tmp = String.Empty;
                if (SEName.Length != 0)
                {
                    tmp = MungeName(SEName);
                }
                else
                {
                    tmp = SE.GetEntitySEName(EntityName, EntityID);
                }

                RouteValueDictionary dictionary = new RouteValueDictionary();
                dictionary.Add(EntityName + "ID", EntityID);
                dictionary.Add("SEName", tmp);

                VirtualPathData pathInfo = RouteTable.Routes.GetVirtualPath(null, EntityName, dictionary);

                if (pathInfo != null)
                {
                    URL = pathInfo.VirtualPath;
                }
                //URL = String.Format("{0}-{1}-{2}.aspx",EntityName.Substring(0,1).ToLowerInvariant(),EntityID.ToString(),tmp);
            }
            else
            {
                URL = String.Format("show{0}.aspx?{1}ID={2}", EntityName, EntityName, EntityID.ToString());
            }
            return(URL.ToLowerInvariant());
        }
コード例 #7
0
 public virtual XmlNode ToSiteMapNode(XmlDocument context)
 {
     return(SiteMapNode(Name, SE.MakeEntityLink(EntityType, EntityID, SEName), context));
 }
コード例 #8
0
        private XmlNode CustomerServiceNode()
        {
            XmlNode cat = SiteMapNode(
                "menu.CustomerService".StringResource(),
                //AppLogic.ResolveUrl("~/t-service.aspx"),
                AppLogic.ResolveUrl(SE.MakeDriverLink("service")),
                mapDoc
                );


            cat.AppendChild(
                SiteMapNode(
                    "menu.YourAccount".StringResource(),
                    AppLogic.ResolveUrl("~/account.aspx"),
                    mapDoc
                    ));

            cat.AppendChild(
                SiteMapNode(
                    "menu.OrderHistory".StringResource(),
                    AppLogic.ResolveUrl("~/account.aspx"),
                    mapDoc
                    ));

            cat.AppendChild(
                SiteMapNode(
                    "menu.PolicyReturns".StringResource(),
                    //AppLogic.ResolveUrl("~/t-returns.aspx"),
                    AppLogic.ResolveUrl(SE.MakeDriverLink("returns")),
                    mapDoc
                    ));

            cat.AppendChild(
                SiteMapNode(
                    "menu.Shipping".StringResource(),
                    //AppLogic.ResolveUrl("~/t-shipping.aspx"),
                    AppLogic.ResolveUrl(SE.MakeDriverLink("shipping")),
                    mapDoc
                    ));

            cat.AppendChild(
                SiteMapNode(
                    "menu.Contact".StringResource(),
                    AppLogic.ResolveUrl("~/contactus.aspx"),
                    mapDoc
                    ));

            cat.AppendChild(
                SiteMapNode(
                    "menu.PolicyPrivacy".StringResource(),
                    //AppLogic.ResolveUrl("~/t-privacy.aspx"),
                    AppLogic.ResolveUrl(SE.MakeDriverLink("privacy")),
                    mapDoc
                    ));

            cat.AppendChild(
                SiteMapNode(
                    "menu.PolicySecurity".StringResource(),
                    //AppLogic.ResolveUrl("~/t-security.aspx"),
                    AppLogic.ResolveUrl(SE.MakeDriverLink("security")),
                    mapDoc
                    ));

            return(cat);
        }
コード例 #9
0
ファイル: SiteMap.cs プロジェクト: lulzzz/BrandStore
        public SiteMap1(System.Collections.Generic.Dictionary <string, EntityHelper> EntityHelpers, int SkinID, Customer ThisCustomer)
        {
            bool   FromCache = false;
            String CacheName = String.Format("SiteMap1_{0}_{1}", SkinID.ToString(), ThisCustomer.LocaleSetting);

            if (AppLogic.CachingOn)
            {
                m_Contents = (String)HttpContext.Current.Cache.Get(CacheName);
                if (m_Contents != null)
                {
                    FromCache = true;
                }
            }

            if (!FromCache)
            {
                StringBuilder tmpS = new StringBuilder(50000);

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowCategories"))
                {
                    // Categories:
                    String s = AppLogic.LookupHelper("Category", 0).GetEntityULList(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, true, AppLogic.AppConfigBool("SiteMap.ShowProducts") && AppLogic.NumProductsInDB < 250, true, "sitemapul", true, 0, String.Empty);
                    if (s.Length != 0)
                    {
                        tmpS.Append("<b>");
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("<a href=\"newentities.aspx?entityname=category\">");
                        }
                        tmpS.Append(AppLogic.GetString("AppConfig.CategoryPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant());
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("</a>");
                        }
                        tmpS.Append("</b>");
                        tmpS.Append(s);
                    }
                }

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowSections"))
                {
                    // Sections:
                    String s = AppLogic.LookupHelper("Section", 0).GetEntityULList(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, true, AppLogic.AppConfigBool("SiteMap.ShowProducts") && AppLogic.NumProductsInDB < 250, true, "sitemapul", true, 0, String.Empty);
                    if (s.Length != 0)
                    {
                        tmpS.Append("<b>");
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("<a href=\"newentities.aspx?entityname=section\">");
                        }
                        tmpS.Append(AppLogic.GetString("AppConfig.SectionPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant());
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("</a>");
                        }
                        tmpS.Append("</b>");
                        tmpS.Append(s);
                    }
                }

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowLibraries"))
                {
                    // Libraries:
                    String s = AppLogic.LookupHelper("Library", 0).GetEntityULList(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, AppLogic.AppConfigBool("SiteMap.ShowDocuments"), true, true, "sitemapul", true, 0, String.Empty);
                    if (s.Length != 0)
                    {
                        tmpS.Append("<b>");
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("<a href=\"newentities.aspx?entityname=library\">");
                        }
                        tmpS.Append(AppLogic.GetString("AppConfig.LibraryPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant());
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("</a>");
                        }
                        tmpS.Append("</b>");
                        tmpS.Append(s);
                    }
                }

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowManufacturers"))
                {
                    // Manufacturers:
                    String s = AppLogic.LookupHelper("Manufacturer", 0).GetEntityULList(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, false, AppLogic.AppConfigBool("SiteMap.ShowProducts") && AppLogic.NumProductsInDB < 250, true, "sitemapul", true, 0, String.Empty);
                    if (s.Length != 0)
                    {
                        tmpS.Append("<b>");
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("<a href=\"newentities.aspx?entityname=manufacturer\">");
                        }
                        tmpS.Append(AppLogic.GetString("AppConfig.ManufacturerPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant());
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("</a>");
                        }
                        tmpS.Append("</b>");
                        tmpS.Append(s);
                    }
                }

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowTopics"))
                {
                    // Topics:
                    tmpS.Append("<b>");
                    if (AppLogic.IsAdminSite)
                    {
                        tmpS.Append("<a href=\"topics.aspx\">");
                    }
                    tmpS.Append(AppLogic.GetString("sitemap.aspx.2", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant());
                    if (AppLogic.IsAdminSite)
                    {
                        tmpS.Append("</a>");
                    }
                    tmpS.Append("</b>");
                    tmpS.Append("<ul class=\"sitemapul\">\n");

                    using (SqlConnection dbconn = DB.dbConn())
                    {
                        dbconn.Open();
                        using (IDataReader rs = DB.GetRS(string.Format("select count(*) as N from Topic with (NOLOCK) where {0} Deleted=0 AND Published=1 and (SkinID IS NULL or SkinID=0 or SkinID={1}) ", CommonLogic.IIF(AppLogic.IsAdminSite, "", "ShowInSiteMap=1 and "), SkinID.ToString()) + "; " + string.Format("select Name,Title,TopicID from Topic with (NOLOCK) where {0} Deleted=0 and Published=1 and (SkinID IS NULL or SkinID=0 or SkinID={1}) Order By DisplayOrder, Name ASC", CommonLogic.IIF(AppLogic.IsAdminSite, "", "ShowInSiteMap=1 and "), SkinID.ToString()), dbconn))
                        {
                            if (rs.Read() && DB.RSFieldInt(rs, "N") > 0)
                            {
                                if (rs.NextResult())
                                {
                                    while (rs.Read())
                                    {
                                        tmpS.Append("<li>");
                                        if (AppLogic.IsAdminSite)
                                        {
                                            tmpS.Append(String.Format("<a href=\"edittopic.aspx?topicid={0}\">", DB.RSFieldInt(rs, "TopicID").ToString()));
                                        }
                                        else
                                        {
                                            tmpS.Append("<a href=\"" + SE.MakeDriverLink(DB.RSFieldByLocale(rs, "Name", Localization.GetDefaultLocale())) + "\">");
                                        }
                                        tmpS.Append(Security.HtmlEncode(DB.RSFieldByLocale(rs, "Title", Localization.GetDefaultLocale())));
                                        tmpS.Append("</a>");
                                        tmpS.Append("</li>\n");
                                    }
                                }
                            }
                        }
                    }

                    // File Topics:
                    // create an array to hold the list of files
                    ArrayList fArray = new ArrayList();

                    // get information about our initial directory
                    String SFP = CommonLogic.SafeMapPath(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "App_Templates/Skin_" + SkinID.ToString() + "/template.htm").Replace("template.htm", "");

                    DirectoryInfo dirInfo = new DirectoryInfo(SFP);

                    // retrieve array of files & subdirectories
                    FileSystemInfo[] myDir = dirInfo.GetFileSystemInfos();

                    for (int i = 0; i < myDir.Length; i++)
                    {
                        // check the file attributes

                        // if a subdirectory, add it to the sArray
                        // otherwise, add it to the fArray
                        if (((Convert.ToUInt32(myDir[i].Attributes) & Convert.ToUInt32(FileAttributes.Directory)) > 0))
                        {
                        }
                        else
                        {
                            bool skipit = false;
                            if (!myDir[i].FullName.EndsWith("htm", StringComparison.InvariantCultureIgnoreCase) ||
                                (myDir[i].FullName.IndexOf("TEMPLATE", StringComparison.InvariantCultureIgnoreCase) != -1) ||
                                (myDir[i].FullName.IndexOf("AFFILIATE_", StringComparison.InvariantCultureIgnoreCase) != -1) ||
                                (myDir[i].FullName.IndexOf(AppLogic.ro_PMMicropay, StringComparison.InvariantCultureIgnoreCase) != -1))
                            {
                                skipit = true;
                            }
                            if (!skipit)
                            {
                                fArray.Add(Path.GetFileName(myDir[i].FullName));
                            }
                        }
                    }

                    if (fArray.Count != 0)
                    {
                        // sort the files alphabetically
                        fArray.Sort(0, fArray.Count, null);
                        for (int i = 0; i < fArray.Count; i++)
                        {
                            tmpS.Append("<li>");
                            if (!AppLogic.IsAdminSite) // admin site can't link to these kinds of topics
                            {
                                tmpS.Append("<a href=\"" + SE.MakeDriverLink(fArray[i].ToString().Replace(".htm", "")) + "\">");
                            }
                            else
                            {
                                tmpS.Append("(file based topic) ");
                            }
                            tmpS.Append(Security.HtmlEncode(CommonLogic.Capitalize(fArray[i].ToString().Replace(".htm", ""))));
                            if (!AppLogic.IsAdminSite)
                            {
                                tmpS.Append("</a>");
                            }
                            tmpS.Append("</li>\n");
                        }
                    }
                    tmpS.Append("</ul>\n");
                }
                m_Contents = tmpS.ToString();
                if (AppLogic.CachingOn)
                {
                    HttpContext.Current.Cache.Insert(CacheName, m_Contents, null, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// Gets the eval data.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <param name="target">The target.</param>
        /// <param name="entry">The entry.</param>
        /// <returns></returns>
        public static object GetEvalData(string expression, Type target, string entry)
        {
            Customer ThisCustomer = AppLogic.GetCurrentCustomer();
            bool     IsRegistered = CommonLogic.IIF(ThisCustomer != null, ThisCustomer.IsRegistered, false);

            string[] values  = expression.Split(',');
            string   command = values[0];

            switch (command.ToLowerInvariant())
            {
            case "cartprompt":
                return(AppLogic.GetString("AppConfig.CartPrompt", ThisCustomer.SkinID, ThisCustomer.LocaleSetting));

            case "currency_locale_robots_tag":
                return(CurrencyLocaleRobotsTag(ThisCustomer));

            case "num_cart_items":
                return(NumCartItemsParser(ThisCustomer));

            case "pageinfo":
                return(PageInfoParser(ThisCustomer));

            case "buysafeseal":
                return(BuySafeSealParser(ThisCustomer));

            case "bongoextend":
                return(BongoExtendParser(ThisCustomer));

            case "username":
                return(UserNameParser(ThisCustomer));

            case "signinout_link":
                return(SignInOutLinkParser(ThisCustomer));

            case "signinout_text":
                return(SignInOutTextParser(ThisCustomer));

            case "skinid":
                return(ThisCustomer.SkinID.ToString());

            case "stringresource":
                return(StringResourceParser(ThisCustomer, values));

            case "stringresourceformat":
                return(StringResourceFormatParser(ThisCustomer, values));

            case "appconfig":
                return(AppConfigParser(values));

            case "appconfigbool":
                return(AppConfigBoolParser(values));

            case "appconfigusint":
                return(AppConfigUSIntParser(values));

            case "topic":
                return(TopicParser(ThisCustomer, values));

            case "topictitle":
                return(Topic.GetTitle(values[1].Trim(), ThisCustomer.LocaleSetting, AppLogic.StoreID()));

            case "topiclink":
                return(SE.MakeDriverLink(values[1].Trim()));

            case "xmlpackage":
                if (values.Length >= 2)
                {
                    string xmlPackageName = values[1];
                    string runtimeParams  = values.Length >= 3 ? values[2] : string.Empty;

                    return(RunXmlPackage(ThisCustomer, xmlPackageName.Trim(), runtimeParams.Trim()));
                }
                else
                {
                    return("Invalid number of parameters");
                }


            case "stringformat":
                return(StringFormat(expression));

            case "user_menu_name":
                return(CommonLogic.IIF(!IsRegistered, "my account", ThisCustomer.FullName()));

            case "customerid":
                return(ThisCustomer.CustomerID.ToString());

            case "skinimagedir":
                return(AppLogic.SkinImageDir());

            case "skinimage":
                if (values.Length < 2)
                {
                    return("{Image File name not specified}");
                }
                string imgFile = values[1];
                return(AppLogic.SkinImage(imgFile.Trim()));

            case "adminlink":
                return(AppLogic.AdminLinkUrl(values[1].Trim()));

            case "google_ecom_tracking_v2":
                if (AppLogic.AppConfigBool("Google.DeprecatedEcomTokens.Enabled"))
                {
                    if (CommonLogic.GetThisPageName(false).ToLowerInvariant().StartsWith("orderconfirmation.aspx"))
                    {
                        return(String.Empty);
                    }
                    else
                    {
                        return(AppLogic.GetGoogleEComTrackingV2(ThisCustomer, false));
                    }
                }
                else
                {
                    return(String.Empty);
                }

            case "google_ecom_tracking_asynch":
                if (AppLogic.AppConfigBool("Google.DeprecatedEcomTokens.Enabled"))
                {
                    if (CommonLogic.GetThisPageName(false).ToLowerInvariant().StartsWith("orderconfirmation.aspx") ||
                        CommonLogic.GetThisPageName(false).ToLowerInvariant().StartsWith("mobileorderconfirmation.aspx"))
                    {
                        return(AppLogic.GetGoogleEComTrackingAsynch(ThisCustomer, true));
                    }
                    else
                    {
                        return(AppLogic.GetGoogleEComTrackingAsynch(ThisCustomer, false));
                    }
                }
                else
                {
                    return(String.Empty);
                }

            case "vbv":
                return(VBVParser(ThisCustomer));

            default:
                return(string.Empty);
            }
        }
コード例 #11
0
        public SiteMapComponentArt(Dictionary <string, EntityHelper> EntityHelpers, int SkinID, Customer ThisCustomer, bool showCustomerService)
        {
            bool   FromCache = false;
            String CacheName = String.Format("SiteMapComponentArt_{0}_{1}", SkinID.ToString(), ThisCustomer.LocaleSetting);

            if (AppLogic.CachingOn)
            {
                m_Contents = (String)HttpContext.Current.Cache.Get(CacheName);
                if (m_Contents != null)
                {
                    FromCache = true;
                }
            }

            if (!FromCache)
            {
                StringBuilder tmpS = new StringBuilder(50000);
                tmpS.Append("<SiteMap>\n");

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowCategories"))
                {
                    // Categories:
                    String s = AppLogic.LookupHelper("Category", 0).GetEntityComponentArtNode(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, true, AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowProducts") && AppLogic.NumProductsInDB < 250);
                    if (s.Length != 0)
                    {
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.CategoryPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\" NavigateUrl=\"newentities.aspx?entityname=category\">\n");
                        }
                        else
                        {
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.CategoryPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\">\n");
                        }
                        tmpS.Append(s);
                        tmpS.Append("</node>");
                    }
                }

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowSections"))
                {
                    // Sections:
                    String s = AppLogic.LookupHelper("Section", 0).GetEntityComponentArtNode(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, true, AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowProducts") && AppLogic.NumProductsInDB < 250);
                    if (s.Length != 0)
                    {
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.SectionPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\" NavigateUrl=\"newentities.aspx?entityname=section\">\n");
                        }
                        else
                        {
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.SectionPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\">\n");
                        }
                        tmpS.Append(s);
                        tmpS.Append("</node>");
                    }
                }

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowLibraries"))
                {
                    // Libraries:
                    String s = AppLogic.LookupHelper("Library", 0).GetEntityComponentArtNode(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, true, AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowDocuments") && AppLogic.NumProductsInDB < 250);
                    if (s.Length != 0)
                    {
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.LibraryPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\" NavigateUrl=\"newentities.aspx?entityname=library\">\n");
                        }
                        else
                        {
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.LibraryPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\">\n");
                        }
                        tmpS.Append(s);
                        tmpS.Append("</node>");
                    }
                }

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowManufacturers"))
                {
                    // Manufacturers:
                    String s = AppLogic.LookupHelper("Manufacturer", 0).GetEntityComponentArtNode(0, ThisCustomer.LocaleSetting, ThisCustomer.AffiliateID, ThisCustomer.CustomerLevelID, true, AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowProducts") && AppLogic.NumProductsInDB < 250);
                    if (s.Length != 0)
                    {
                        if (AppLogic.IsAdminSite)
                        {
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.ManufacturerPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\" NavigateUrl=\"newentities.aspx?entityname=manufacturer\">\n");
                        }
                        else
                        {
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("AppConfig.ManufacturerPromptPlural", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\">\n");
                        }
                        tmpS.Append(s);
                        tmpS.Append("</node>");
                    }
                }

                if (!AppLogic.IsAdminSite && AppLogic.AppConfigBool("SiteMap.ShowCustomerService") && showCustomerService)
                {
                    tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("menu.CustomerService", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)) + "\">\n");
                    tmpS.Append("	<node Text=\""+ XmlCommon.XmlEncodeAttribute(AppLogic.GetString("menu.YourAccount", SkinID, ThisCustomer.LocaleSetting)) + "\" NavigateUrl=\"account.aspx\" />\n");
                    tmpS.Append("	<node Text=\""+ XmlCommon.XmlEncodeAttribute(AppLogic.GetString("menu.OrderHistory", SkinID, ThisCustomer.LocaleSetting)) + "\" NavigateUrl=\"account.aspx\" />\n");

                    tmpS.Append("	<node Text=\""+ XmlCommon.XmlEncodeAttribute(AppLogic.GetString("menu.PolicyReturns", SkinID, ThisCustomer.LocaleSetting)) + "\" NavigateUrl=\"" + SE.MakeDriverLink("returns") + "\" />\n");
                    tmpS.Append("	<node Text=\""+ XmlCommon.XmlEncodeAttribute(AppLogic.GetString("menu.Shipping", SkinID, ThisCustomer.LocaleSetting)) + "\" NavigateUrl=\"" + SE.MakeDriverLink("shipping") + "\" />\n");
                    tmpS.Append("	<node Text=\""+ XmlCommon.XmlEncodeAttribute(AppLogic.GetString("menu.Contact", SkinID, ThisCustomer.LocaleSetting)) + "\" NavigateUrl=\"contactus.aspx\" />\n");
                    tmpS.Append("	<node Text=\""+ XmlCommon.XmlEncodeAttribute(AppLogic.GetString("menu.PolicyPrivacy", SkinID, ThisCustomer.LocaleSetting)) + "\" NavigateUrl=\"" + SE.MakeDriverLink("privacy") + "\" />\n");
                    tmpS.Append("	<node Text=\""+ XmlCommon.XmlEncodeAttribute(AppLogic.GetString("menu.PolicySecurity", SkinID, ThisCustomer.LocaleSetting)) + "\" NavigateUrl=\"" + SE.MakeDriverLink("security") + "\" />\n");
                    tmpS.Append("</node>\n");
                }

                if (AppLogic.IsAdminSite || AppLogic.AppConfigBool("SiteMap.ShowTopics"))
                {
                    // Topics:
                    if (AppLogic.IsAdminSite)
                    {
                        tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("sitemap.aspx.2", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\" NavigateUrl=\"topics.aspx\">\n");
                    }
                    else
                    {
                        tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(AppLogic.GetString("sitemap.aspx.2", SkinID, ThisCustomer.LocaleSetting).ToUpperInvariant()) + "\" NavigateUrl=\"\">\n");
                    }

                    using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                    {
                        con.Open();
                        using (IDataReader rs = DB.GetRS(string.Format("select Name,Title,TopicID,ShowInSiteMap from Topic with (NOLOCK) where {0} Deleted=0 and Published=1 and (SkinID IS NULL or SkinID=0 or SkinID={1}) Order By DisplayOrder, Name ASC", CommonLogic.IIF(AppLogic.IsAdminSite, "", "ShowInSiteMap=1 and "), SkinID.ToString()), con))
                        {
                            string displayname = string.Empty;
                            string name        = string.Empty;
                            while (rs.Read())
                            {
                                String URL = String.Empty;
                                name = DB.RSFieldByLocale(rs, "Name", ThisCustomer.LocaleSetting);
                                if (AppLogic.IsAdminSite)
                                {
                                    URL = String.Format("topics.aspx?EditTopicId={0}", DB.RSFieldInt(rs, "TopicID").ToString());
                                }
                                else
                                {
                                    URL = SE.MakeDriverLink(name);
                                }
                                displayname = XmlCommon.XmlEncodeAttribute(DB.RSFieldByLocale(rs, "Title", ThisCustomer.LocaleSetting));
                                if (displayname != string.Empty)
                                {
                                    if (name.IndexOf("GOOGLE", StringComparison.InvariantCultureIgnoreCase) == -1 && name.IndexOf("PHONE", StringComparison.InvariantCultureIgnoreCase) == -1 &&
                                        name.IndexOf("AFFILIATE", StringComparison.InvariantCultureIgnoreCase) == -1 && name.IndexOf("GIFTREGISTRY", StringComparison.InvariantCultureIgnoreCase) == -1 &&
                                        name.IndexOf("WISHLIST", StringComparison.InvariantCultureIgnoreCase) == -1 && name.IndexOf("CHECKOUTANON", StringComparison.InvariantCultureIgnoreCase) == -1 &&
                                        name.IndexOf("DOWNLOAD", StringComparison.InvariantCultureIgnoreCase) == -1 && name.IndexOf("GENRE", StringComparison.InvariantCultureIgnoreCase) == -1 &&
                                        name.IndexOf("DISTRIBUTOR", StringComparison.InvariantCultureIgnoreCase) == -1 && name.IndexOf("VECTOR", StringComparison.InvariantCultureIgnoreCase) == -1 &&
                                        name.IndexOf("CARTPAGEFOOTER", StringComparison.InvariantCultureIgnoreCase) == -1 && name.IndexOf("CODINSTRUCTIONS", StringComparison.InvariantCultureIgnoreCase) == -1)
                                    {
                                        tmpS.Append("<node Text=\"" + displayname + "\" NavigateUrl=\"" + XmlCommon.XmlEncodeAttribute(URL) + "\" />\n");
                                    }
                                }
                            }
                        }
                    }

                    // File Topics:
                    // create an array to hold the list of files
                    ArrayList fArray = new ArrayList();

                    // get information about our initial directory
                    String SFP = CommonLogic.SafeMapPath(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "App_Templates/Skin_" + SkinID.ToString() + "/template.htm").Replace("template.htm", "");

                    DirectoryInfo dirInfo = new DirectoryInfo(SFP);

                    // retrieve array of files & subdirectories
                    FileSystemInfo[] myDir = dirInfo.GetFileSystemInfos();

                    for (int i = 0; i < myDir.Length; i++)
                    {
                        // check the file attributes

                        // if a subdirectory, add it to the sArray
                        // otherwise, add it to the fArray
                        if (((Convert.ToUInt32(myDir[i].Attributes) & Convert.ToUInt32(FileAttributes.Directory)) > 0))
                        {
                        }
                        else
                        {
                            bool skipit = false;
                            if (!myDir[i].FullName.EndsWith("htm", StringComparison.InvariantCultureIgnoreCase) ||
                                (myDir[i].FullName.IndexOf("TEMPLATE", StringComparison.InvariantCultureIgnoreCase) != -1) ||
                                (myDir[i].FullName.IndexOf("AFFILIATE_", StringComparison.InvariantCultureIgnoreCase) != -1) ||
                                (myDir[i].FullName.IndexOf(AppLogic.ro_PMMicropay, StringComparison.InvariantCultureIgnoreCase) != -1))
                            {
                                skipit = true;
                            }
                            if (!skipit)
                            {
                                fArray.Add(Path.GetFileName(myDir[i].FullName));
                            }
                        }
                    }

                    if (fArray.Count != 0)
                    {
                        // sort the files alphabetically
                        fArray.Sort(0, fArray.Count, null);
                        for (int i = 0; i < fArray.Count; i++)
                        {
                            String URL = String.Empty;
                            if (!AppLogic.IsAdminSite) // admin site can't link to these kinds of topics
                            {
                                URL = SE.MakeDriverLink(fArray[i].ToString().Replace(".htm", ""));
                            }
                            tmpS.Append("<node Text=\"" + XmlCommon.XmlEncodeAttribute(CommonLogic.Capitalize(fArray[i].ToString().Replace(".htm", ""))) + "\" " + CommonLogic.IIF(URL.Length != 0, "NavigateUrl=\"" + XmlCommon.XmlEncodeAttribute(URL) + "\"", "") + "/>\n");
                        }
                    }
                    tmpS.Append("</node>");
                }

                tmpS.Append("</SiteMap>\n");
                m_Contents = tmpS.ToString();
                if (AppLogic.CachingOn)
                {
                    HttpContext.Current.Cache.Insert(CacheName, m_Contents, null, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);
                }
            }
        }
コード例 #12
0
ファイル: Breadcrumb.cs プロジェクト: lulzzz/BrandStore
        public static String GetEntityBreadcrumb(int EntityID, String EntityInstanceName, String SourceEntity, Customer ThisCustomer)
        {
            String CacheName = String.Empty;

            if (AppLogic.CachingOn)
            {
                CacheName = String.Format("e_{0}_{1}_{2}_{3}", EntityID.ToString(), EntityInstanceName, SourceEntity, ThisCustomer.LocaleSetting);
                if (m_EntityHT.ContainsKey(CacheName))
                {
                    return(m_EntityHT[CacheName].ToString());
                }
            }

            String separator = AppLogic.AppConfig("BreadcrumbSeparator");

            if (separator.Length == 0)
            {
                separator = "&rarr;";
            }
            EntityHelper  hlp      = AppLogic.LookupHelper(SourceEntity, 0);
            StringBuilder st       = new StringBuilder(1024);
            int           ParentID = hlp.GetParentEntity(EntityID);

            while (ParentID != 0)
            {
                st.Insert(0, String.Format("<a class=\"SectionTitleText\" href=\"{0}\">{1}</a> {2} ", SE.MakeEntityLink(SourceEntity, ParentID, ""), hlp.GetEntityName(ParentID, ThisCustomer.LocaleSetting), separator));
                ParentID = hlp.GetParentEntity(ParentID);
            }
            st.Append(EntityInstanceName);
            st.Insert(0, "<span class=\"SectionTitleText\">");
            st.Append("</span>");
            String s = st.ToString();

            if (AppLogic.CachingOn)
            {
                m_EntityHT.Add(CacheName, s);
            }
            return(s);
        }
コード例 #13
0
ファイル: Breadcrumb.cs プロジェクト: lulzzz/BrandStore
        public static String GetProductBreadcrumb(int ProductID, String ProductName, String SourceEntity, int SourceEntityID, Customer ThisCustomer)
        {
            String CacheName = String.Empty;

            if (AppLogic.CachingOn)
            {
                CacheName = String.Format("p_{0}_{1}_{2}_{3}", ProductID.ToString(), SourceEntity, SourceEntityID.ToString(), ThisCustomer.LocaleSetting);
                if (m_ProductHT.ContainsKey(CacheName))
                {
                    return(m_ProductHT[CacheName].ToString());
                }
            }
            String separator = AppLogic.AppConfig("BreadcrumbSeparator");

            if (separator.Length == 0)
            {
                separator = "&rarr;";
            }
            StringBuilder st = new StringBuilder(2048);

            if (SourceEntityID != 0)
            {
                EntityHelper hlp    = AppLogic.LookupHelper(SourceEntity, 0);
                int          ThisID = SourceEntityID;
                while (ThisID != 0)
                {
                    st.Insert(0, String.Format("<a class=\"SectionTitleText\" href=\"{0}\">{1}</a> {2} ", SE.MakeEntityLink(SourceEntity, ThisID, ""), hlp.GetEntityName(ThisID, ThisCustomer.LocaleSetting), separator));
                    ThisID = hlp.GetParentEntity(ThisID);
                }
            }
            st.Append(ProductName);
            st.Insert(0, "<span class=\"SectionTitleText\">");
            st.Append("</span>");
            String s = st.ToString();

            if (AppLogic.CachingOn)
            {
                // possible race condition... check again...
                if (m_ProductHT.ContainsKey(CacheName) == false)
                {
                    m_ProductHT.Add(CacheName, s);
                }
            }
            return(s);
        }