/// <summary>
        /// 获取角色和菜单关联关系
        /// </summary>
        /// <returns>角色和菜单关联关系列表</returns>
        private List<RoleMenuInfo> GetRoleMenuModel()
        {
            List<RoleMenuInfo> roleMenuInfoList = new List<RoleMenuInfo>();

            MenuBll menuBll = new MenuBll();

            List<MenuInfo> menuList = menuBll.GetMenuListByParentId(0);

            if (menuList != null)
            {
                foreach (MenuInfo menu in menuList)
                {
                    CheckBoxList cbList = (CheckBoxList)trMenuList.FindControl("menuInfo_" + menu.MenuId);

                    if (cbList != null)
                    {
                        foreach (ListItem li in cbList.Items)
                        {
                            if (li.Selected == true)
                            {
                                RoleMenuInfo roleMenuInfo = new RoleMenuInfo();

                                roleMenuInfo.MenuId = Convert.ToInt32(li.Value);

                                roleMenuInfo.RoleId = RoleId;

                                roleMenuInfoList.Add(roleMenuInfo);
                            }
                        }
                    }
                }
            }
            return roleMenuInfoList;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MenuBll menuBll = new MenuBll();

            // List<MenuInfo> menuList = menuBll.GetTopMenuListByRoleId(LoginUser.RoleList);
            List<MenuInfo> menuList = LoginUser.MenuInfos;

            for (int i = 0; i < menuList.Count; i++)
            {
                MenuInfo menu = menuList[i];

                string menuName = menu.MenuName;

                int menuId = menu.MenuId;
                MenuUrl += "<div id='mainMenu" + i + "' onclick=Show(" + i + ")  class='MainClass'>" + menuName + "</div>";

                MenuUrl += "<div id='subMenu" + i + "' style='width:98%;overflow:auto' class='SubClass'>";
                List<MenuInfo> subMenuList = menuBll.GetMenuListByParentIdAdnUserId( menuId,LoginUser.UserId);

                for (int j = 0; j < subMenuList.Count; j++)
                {
                    MenuInfo subMenu = subMenuList[j];
                    string subMenuName = subMenu.MenuName;

                    string url = subMenu.MenuURL;

                    //MenuUrl += "<div onclick=SubMenuClick(this,img" + i + "_" + j + ",link" + i + "_" + j + ")  >";
                    MenuUrl += "<div   >";
                    MenuUrl += "<img id='img" + i + "_" + j + "' alt='' src='images/箭头黑.png'/>&nbsp;&nbsp;&nbsp;&nbsp;";
                    MenuUrl += "<a id='link" + i + "_" + j + "' href='" + url + "'>" + subMenuName + "</a><br>";

                    MenuUrl += "</div>";
                }

                MenuUrl += "</div>";
            }
        }
 public List<MenuInfo> GetMenuListByUserId(int userId)
 {
     MenuBll menuBll = new MenuBll();
     return menuBll.GetMenuListByUserId(userId);
 }
        private void InitMenuList()
        {
            MenuBll menuBll = new MenuBll();

            List<MenuInfo> menuList = menuBll.GetMenuListByParentId(0);

            RoleMenuBll roleMenuBll = new RoleMenuBll();

            List<RoleMenuInfo> roleMenuList =  roleMenuBll.GetRoleMenuListByRoleId(RoleId);

            if (menuList != null)
            {
                RoleBll roleBll = new RoleBll();

                RoleInfo roleInfo = roleBll.GetRoleById(RoleId);

                if (roleInfo == null)
                {
                    return;
                }
                foreach (MenuInfo menuInfo in menuList)
                {

                    Label lbl = new Label();

                    lbl.Text = menuInfo.MenuName;

                    trMenuList.Controls.Add(lbl);

                    List<MenuInfo> subMenuList = menuBll.GetMenuListByParentId(menuInfo.MenuId);

                    CheckBoxList cbList = new CheckBoxList();

                    cbList.ID = "menuInfo_" + menuInfo.MenuId;

                    cbList.RepeatDirection = RepeatDirection.Horizontal;

                    cbList.RepeatColumns = 4;

                    cbList.DataSource = subMenuList;
                    cbList.DataTextField = "MenuName";

                    cbList.DataValueField = "MenuId";

                    cbList.DataBind();

                    foreach (ListItem li in cbList.Items)
                    {

                        if (roleMenuList != null)
                        {
                            foreach (RoleMenuInfo roleMenu in roleMenuList)
                            {
                                if (li.Value == roleMenu.MenuId.ToString())
                                {
                                    li.Selected = true;
                                }
                            }
                        }

                    }
                    trMenuList.Controls.Add(cbList);
                }
            }
        }