public ActionResult RoleMenu(long?RoleId) { if (RoleId == null || RoleId == 0) { return(Content("请重新操作!")); } var list = new List <Models.RoleBasisModels.RoleMenuModel>(); var menu = new Cache.Sys_MenuBasisCache().Get(Common.FormsTicket.SystemCode); var roleMenu = new Cache.Sys_RoleMenuCache().Get(RoleId.Value); var operate = new Cache.Sys_MenuOperateCache(); var roleOp = new Cache.Sys_RoleOperateCache().Get(RoleId.Value); foreach (var item in menu.Where(c => c.ParentId == Common.Constant.LONG_DEFAULT)) { foreach (var mItem in menu.Where(c => c.ParentId == item.Id)) { var opList = new List <Models.RoleBasisModels.RoleOperateModel>(); foreach (var r in operate.Get(mItem.Id)) { //操作码权限 var ro = roleOp.Where(c => c.OperateId == r.Id).FirstOrDefault(); opList.Add(new Models.RoleBasisModels.RoleOperateModel { OperateId = r.Id, OperateName = r.OperateName, MenuId = mItem.Id, IsSelect = ro != null ? true : false, Id = ro != null ? ro.Id : 0 }); } //二级菜单 var m1 = roleMenu.Where(c => c.MenuId == mItem.Id).FirstOrDefault(); list.Add(new Models.RoleBasisModels.RoleMenuModel { MenuId = mItem.Id, ParentId = mItem.ParentId, MenuName = mItem.MenuName, IsSelect = m1 != null ? true : false, Id = m1 != null ? m1.Id:0, OperateList = opList }); } //一级菜单 var m = roleMenu.Where(c => c.MenuId == item.Id).FirstOrDefault(); list.Add(new Models.RoleBasisModels.RoleMenuModel { MenuId = item.Id, ParentId = item.ParentId, MenuName = item.MenuName, IsSelect = m != null ? true : false, Id = m != null ? m.Id : 0, }); } ViewBag.RoleId = RoleId.Value; return(View(list)); }
public ActionResult OperateCreate(long?MenuId, long?OperateId) { var model = new Models.MenuBasisModels.MenuOperateModel(); if (MenuId == null) { return(Content("请重新选择操作码!")); } if (OperateId != null) { var cache = new Cache.Sys_MenuOperateCache().Get(MenuId.Value).Where(c => c.Id == OperateId).FirstOrDefault(); model = new Models.MenuBasisModels.MenuOperateModel { Id = cache.Id.ToString(), MenuId = cache.MenuId.ToString(), OperateSort = cache.OperateSort, OperateCode = cache.OperateCode, OperateName = cache.OperateName }; } return(View(model)); }
public ActionResult OperateList(long?MenuId) { if (MenuId == null) { return(Content("请重新选择操作码!")); } var cache = new Cache.Sys_MenuOperateCache().Get(MenuId.Value); var list = new List <Models.MenuBasisModels.MenuOperateModel>(); foreach (var item in cache) { list.Add(new Models.MenuBasisModels.MenuOperateModel { Id = item.Id.ToString(), MenuId = item.MenuId.ToString(), OperateCode = item.OperateCode, OperateSort = item.OperateSort, OperateName = item.OperateName }); } ViewBag.MenuId = MenuId.Value; return(View(list)); }