Пример #1
0
 protected void btnSysMenu_Click(object sender, EventArgs e)
 {
     System.IO.StreamWriter sw = null;
     try
     {
         _allMM = Business.Do <IManageMenu>().GetTree("sys", true, true);
         string tmp = "";
         //当前根节点
         Extend.MenuNode root = new Extend.MenuNode(null, _allMM);
         //for (int i = 0; i < root.Childs.Length; i++)
         //{
         //    var n = new Node(root.Childs[i], data);
         //    //tmp+=this.BuildNode(n,data,"rootMenu");
         //}
         if (root.IsChilds)
         {
             //递归生成子菜单
             tmp += this._BuildMenuItem(root.Childs[0], 0, root.Childs[0].MM_Name);
         }
         //创建静态文件
         sw = new System.IO.StreamWriter(Server.MapPath(this._staticPath) + this._sysMenu, false, System.Text.Encoding.UTF8);
         sw.Write(tmp);
         sw.Flush();
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
     finally
     {
         sw.Close();
         sw.Dispose();
     }
 }
Пример #2
0
        /// <summary>
        /// 生成系统菜单
        /// </summary>
        /// <returns></returns>
        private string _BuildMenu(Song.Entities.ManageMenu[] mm)
        {
            string tmp = "";

            //当前根节点
            Extend.MenuNode root = new Extend.MenuNode(null, mm);
            if (root.IsChilds)
            {
                //递归生成子菜单
                tmp += this._BuildMenuItem(root.Childs[0], 0, root.Childs[0].MM_Name);
            }
            return(tmp);
        }