protected void btnSave_Click(object sender, EventArgs e) { string[] accouts = hdnAllSelected.Value.Split(','); int TopMenuId = DataConvert.GetInt32(ddlTopMenus.SelectedValue); Johnny.CMS.BLL.SystemInfo.TopMenuBinding bll = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding(); bll.Delete(TopMenuId); for (int ix = 0; ix < accouts.Length; ix++) { if (accouts[ix] != string.Empty) { Johnny.CMS.OM.SystemInfo.TopMenuBinding model = new Johnny.CMS.OM.SystemInfo.TopMenuBinding(); model.TopMenuId = TopMenuId; model.MenuCategoryId = DataConvert.GetInt32(accouts[ix]); if (bll.Add(model) > 0) { SetMessage(GetMessage("C00001")); } else { SetMessage(GetMessage("C00002")); } } } CreateMenuCategoryList(); }
protected void btnSave_Click(object sender, EventArgs e) { string[] accouts = hdnAllSelected.Value.Split(','); int TopMenuId = DataConvert.GetInt32(ddlTopMenus.SelectedValue); Johnny.CMS.BLL.SystemInfo.TopMenuBinding bll = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding(); bll.Delete(TopMenuId); for (int ix = 0; ix < accouts.Length; ix++) { if (accouts[ix] != string.Empty) { Johnny.CMS.OM.SystemInfo.TopMenuBinding model = new Johnny.CMS.OM.SystemInfo.TopMenuBinding(); model.TopMenuId = TopMenuId; model.MenuCategoryId = DataConvert.GetInt32(accouts[ix]); if (bll.Add(model) > 0) { SetMessage(GetMessage("C00001")); } else SetMessage(GetMessage("C00002")); } } CreateMenuCategoryList(); }
//允许显示的菜单栏目 private void CreateRightAccount(HtmlSelect listcontrolright, int TopMenuId) { Johnny.CMS.BLL.SystemInfo.TopMenuBinding bll = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding(); listcontrolright.DataSource = bll.GetList(TopMenuId); listcontrolright.DataTextField = "MenuCategoryName"; listcontrolright.DataValueField = "MenuCategoryId"; listcontrolright.DataBind(); }
//允许显示的菜单栏目 private void CreateRightAccount(HtmlSelect listcontrolright, int TopMenuId) { Johnny.CMS.BLL.SystemInfo.TopMenuBinding bll = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding(); listcontrolright.DataSource = bll.GetList(TopMenuId); listcontrolright.DataTextField = "MenuCategoryName"; listcontrolright.DataValueField = "MenuCategoryId"; listcontrolright.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //菜单栏目 Johnny.CMS.BLL.SystemInfo.MenuCategory category = new Johnny.CMS.BLL.SystemInfo.MenuCategory(); IList <Johnny.CMS.OM.SystemInfo.MenuCategory> categoryModel = category.GetList(); //菜单 Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu(); IList <Johnny.CMS.OM.SystemInfo.Menu> menuModel = menu.GetList(true); //用户权限 Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts(); ArrayList arrPermission = new ArrayList(); arrPermission = accounts.GetUserPermission(DataConvert.GetString(Session["UserName"])); //顶部菜单与菜单类别 int iTopMenuId = DataConvert.GetInt32(Request.QueryString["TopMenuId"]); if (iTopMenuId <= 0) { iTopMenuId = 1; } Johnny.CMS.BLL.SystemInfo.TopMenuBinding topMainMenu = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding(); IList <Johnny.CMS.OM.SystemInfo.TopMenuBinding> topMainMenuModel = topMainMenu.GetList(iTopMenuId); //生成左侧菜单导航栏 foreach (Johnny.CMS.OM.SystemInfo.MenuCategory item in categoryModel) { if (CategoryContains(item.MenuCategoryId, topMainMenuModel)) { MainMenuItem mainmenu = new MainMenuItem(); mainmenu.Text = item.MenuCategoryName; foreach (Johnny.CMS.OM.SystemInfo.Menu subitem in menuModel) { //判断是否属于该主菜单,并且具有访问权限 if (subitem.MenuCategoryId == item.MenuCategoryId && arrPermission.Contains(subitem.PermissionId)) { SubMenuItem submenu = new SubMenuItem(); submenu.Text = subitem.MenuName; submenu.Url = subitem.PageLink; submenu.ToolTip = subitem.ToolTip; submenu.Image = subitem.Image; mainmenu.SubItems.Add(submenu); } } if (mainmenu.SubItems.Count > 0) { LeftMenu1.items.Add(mainmenu); } } } }
protected void Page_Load(object sender, EventArgs e) { //菜单栏目 Johnny.CMS.BLL.SystemInfo.MenuCategory category = new Johnny.CMS.BLL.SystemInfo.MenuCategory(); IList<Johnny.CMS.OM.SystemInfo.MenuCategory> categoryModel = category.GetList(); //菜单 Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu(); IList<Johnny.CMS.OM.SystemInfo.Menu> menuModel = menu.GetList(true); //用户权限 Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts(); ArrayList arrPermission = new ArrayList(); arrPermission = accounts.GetUserPermission(DataConvert.GetString(Session["UserName"])); //顶部菜单与菜单类别 int iTopMenuId = DataConvert.GetInt32(Request.QueryString["TopMenuId"]); if (iTopMenuId <= 0) iTopMenuId = 1; Johnny.CMS.BLL.SystemInfo.TopMenuBinding topMainMenu = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding(); IList<Johnny.CMS.OM.SystemInfo.TopMenuBinding> topMainMenuModel = topMainMenu.GetList(iTopMenuId); //生成左侧菜单导航栏 foreach (Johnny.CMS.OM.SystemInfo.MenuCategory item in categoryModel) { if (CategoryContains(item.MenuCategoryId, topMainMenuModel)) { MainMenuItem mainmenu = new MainMenuItem(); mainmenu.Text = item.MenuCategoryName; foreach (Johnny.CMS.OM.SystemInfo.Menu subitem in menuModel) { //判断是否属于该主菜单,并且具有访问权限 if (subitem.MenuCategoryId == item.MenuCategoryId && arrPermission.Contains(subitem.PermissionId)) { SubMenuItem submenu = new SubMenuItem(); submenu.Text = subitem.MenuName; submenu.Url = subitem.PageLink; submenu.ToolTip = subitem.ToolTip; submenu.Image = subitem.Image; mainmenu.SubItems.Add(submenu); } } if (mainmenu.SubItems.Count > 0) LeftMenu1.items.Add(mainmenu); } } }