/// <summary> /// 绑定信息 /// </summary> private void BindInfo() { List <SqlWhere> sqlWhereList = new List <SqlWhere>(); sqlWhereList.Add(new SqlWhere(SystemMenuModel.FATHERID, SqlWhere.Oper.Equal, 0)); sqlWhereList.Add(new SqlWhere(SystemMenuModel.ENABLED, SqlWhere.Oper.Equal, true)); List <SystemMenuModel> systemMenuList = bll_systemMenu.GetList(sqlWhereList); Repeater1.DataSource = systemMenuList; Repeater1.DataBind(); if (admin.Pkid > 0) { myhead = "编辑"; Realname.Value = admin.Realname; Username.Value = admin.Username; Notes.Value = admin.Notes; Enabled.Checked = admin.Enabled; if (admin.Inbuilt) { RuleTr1.Visible = false; RuleTr2.Visible = true; } } else { myhead = "新增"; } }
//创建菜单 public StringBuilder CreateSysMenu(int fatherId, string fatherCode) { StringBuilder strHtml = new StringBuilder(); if (fatherId > 0) { strHtml.Append("<ul id=\"sub").Append(fatherId).Append("\" class=\"children\">"); } List <SqlWhere> sqlWhereList = new List <SqlWhere>(); sqlWhereList.Add(new SqlWhere(SystemMenuModel.ENABLED, SqlWhere.Oper.Equal, true)); sqlWhereList.Add(new SqlWhere(SystemMenuModel.FATHERID, SqlWhere.Oper.Equal, fatherId)); List <SystemMenuModel> menuList = bll_systemMenu.GetList(sqlWhereList); foreach (SystemMenuModel menu in menuList) { string ruleCode = menu.Title; if (!String.IsNullOrEmpty(fatherCode)) { ruleCode = fatherCode + "_" + ruleCode; } if (!bll_admin.RuleAuth(ruleCode, admin)) { continue; } string rel = String.Empty; if (menu.HasChild) { rel = " rel=\"sub" + menu.Pkid.ToString() + "\""; } strHtml.Append("<li>"); strHtml.Append("<a url=\"").Append(menu.Url).Append("\" val=\"").Append(menu.Pkid).Append("\"").Append(rel).Append(">").Append(menu.Title).Append("</a>"); //if (!String.IsNullOrEmpty(menu.AddPageUrl)) strHtml.Append(" <span url=\"").Append(menu.AddPageUrl).Append("\" val=\"").Append(menu.Pkid).Append("\" onclick=\"aClick($(this));\" key=\"").Append(menu.Title).Append("\" title=\"新增\"></span>"); if (menu.HasChild) { strHtml.Append(CreateSysMenu(menu.Pkid, menu.Title)); } strHtml.Append("</li>"); } if (fatherId > 0) { strHtml.Append("</ul>"); } return(strHtml); }