Example #1
0
        protected string LoadCustomCont(PageCache pageCache)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            string[,] Linkfmt =
            {
                { "<link rel=\"stylesheet\" href=\"{0}\" type=\"text/css\" />", "css" }
                ,
                { "<script type=\"text/javascript\" src=\"{0}\"></script>",     "js"  }
            };


            #region 引用 客製內容

            for (int i = 0; i < (Linkfmt.Length / 2); i++)
            {
                string linkfmt    = Linkfmt[i, 0] + "\r\n";
                string folder     = Server.MapPath("~/websites/") + pageCache.SiteSN + "\\";
                string checkExt   = "." + Linkfmt[i, 1];
                string ViewFolder = "~/WebSites/" + pageCache.SiteSN + "/";

                if (Directory.Exists((folder)))
                {
                    foreach (string FileNames in Directory.GetFiles(folder))
                    {
                        DirectoryInfo FileNamesInfo = new DirectoryInfo(FileNames);
                        FileInfo      TmpFileInfo   = new FileInfo(FileNames);

                        if (TmpFileInfo.Extension.ToLower() == checkExt)
                        {
                            System.Web.UI.Control newControl = new System.Web.UI.Control();

                            var resolvedUrl = newControl.ResolveUrl(ViewFolder + TmpFileInfo.Name);
                            sb.AppendFormat(linkfmt, resolvedUrl);
                        }
                    }
                }
            }

            #endregion

            return(sb.ToString());
        }
Example #2
0
 protected String Resolve(String path)
 {
     System.Web.UI.Control resolver = new System.Web.UI.Control();
     return resolver.ResolveUrl(path);
 }
        public static string GetContentPageMenu(System.Web.UI.Control page, string path, string pinnumber)
        {
            if (page != null)
            {
                string menu         = string.Empty;
                string relativePath = Conversion.GetRelativePath(path);
                // Collection<BOMenu> rootMenus = GetRootMenuCollection(relativePath);

                Collection <BOMenu> rootMenus = GetMenuCollection(relativePath, 1, pinnumber);

                if (rootMenus == null)
                {
                    return(string.Empty);
                }

                if (rootMenus.Count > 0)
                {
                    int i = 1;

                    string ss = "<div id='cssmenu'><ul><li><a href='#'><span>You are In: " + rootMenus[0].MenuName + "</span></a></li>";
                    foreach (BOMenu rootMenu in rootMenus)
                    {
                        string AccPane = "<li><a href='#'><span> " + rootMenu.MenuText + "</span></a>";

                        menu += string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, AccPane);

                        // menu += string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, "<div class='sub-menu'><div class='menu-title'>{0}</div>", rootMenu.MenuText);


                        Collection <BOMenu> childMenus = GetMenuCollection(rootMenu.MenuId, 2, pinnumber);

                        if (childMenus.Count > 0)
                        {
                            menu += "<ul>";

                            foreach (BOMenu childMenu in childMenus)
                            {
                                menu += string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, "<li><a href=" + page.ResolveUrl(childMenu.Url) + ">" + childMenu.MenuText + "</a></li>");
                                // menu += string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, "<a href='{0}' title='{1}' data-menucode='{2}' class='sub-menu-anchor'>{1}</a>", page.ResolveUrl(childMenu.Url), childMenu.MenuText, childMenu.MenuCode);
                            }

                            menu += "</ul>";
                        }

                        menu += "</li>";
                        i     = i + 1;
                    }

                    menu = ss + menu;
                }

                string FinalMenuString = menu + "</ul></div>";

                return(FinalMenuString);
            }

            return(null);
        }
Example #4
0
        public static string GetContentPageMenu(System.Web.UI.Control page, string path)
        {
            if (page != null)
            {
                string menu = string.Empty;
                Collection <MixERP.Net.Common.Models.Core.Menu> rootMenus = MixERP.Net.BusinessLayer.Core.Menu.GetRootMenuCollection(path);

                if (rootMenus.Count > 0)
                {
                    foreach (MixERP.Net.Common.Models.Core.Menu rootMenu in rootMenus)
                    {
                        menu += string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, "<div class='sub-menu'><div class='menu-title'>{0}</div>", rootMenu.MenuText);

                        Collection <MixERP.Net.Common.Models.Core.Menu> childMenus = MixERP.Net.BusinessLayer.Core.Menu.GetMenuCollection(rootMenu.MenuId, 2);

                        if (childMenus.Count > 0)
                        {
                            foreach (MixERP.Net.Common.Models.Core.Menu childMenu in childMenus)
                            {
                                menu += string.Format(System.Threading.Thread.CurrentThread.CurrentCulture, "<a href='{0}' title='{1}' data-menucode='{2}' class='sub-menu-anchor'>{1}</a>", page.ResolveUrl(childMenu.Url), childMenu.MenuText, childMenu.MenuCode);
                            }
                        }

                        menu += "</div>";
                    }
                }

                return(menu);
            }

            return(null);
        }