/// <summary> /// 获取功能按钮数据 /// </summary> /// <returns></returns> private object GetModuleButtonData() { var data = authorizeBLL.GetModuleButtonList(SystemInfo.CurrentUserId); var dataModule = data.Distinct(new Comparint <ModuleButtonEntity>("ModuleId")); Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (ModuleButtonEntity item in dataModule) { var buttonList = data.Where(t => t.ModuleId.Equals(item.ModuleId)); dictionary.Add(item.ModuleId, buttonList); } return(dictionary); }
private object GetButtonData() { var data = authorizeBLL.GetModuleButtonList(SystemInfo.CurrentUserId); Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (ModuleButtonEntity item in data) { var fieldItem = new { EnCode = item.EnCode, FullName = item.FullName }; dictionary.Add(item.ModuleButtonId, fieldItem); } return(dictionary); }
/// <summary> /// 获取功能按钮数据 /// </summary> /// <returns></returns> private object GetModuleButtonData() { var data = authorizeBLL.GetModuleButtonList(SystemInfo.CurrentUserId); var dataModule = data.Distinct(new Comparint <ModuleButtonEntity>("ModuleId")); Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (ModuleButtonEntity item in dataModule) { if (!string.IsNullOrEmpty(item.ModuleId)) { var buttonList = data.Where(t => t.ModuleId.Equals(item.ModuleId)); dictionary.Add(item.ModuleId, buttonList); } } return(dictionary); //var data = authorizeBLL.GetModuleButtonListByUserId(SystemInfo.CurrentUserId); //var dataModule = moduleBLL.GetModuleIds(); //Dictionary<string, object> dictionary = new Dictionary<string, object>(); //foreach(DataRow item in dataModule.Rows) //{ // string moduleId = item[0].ToString(); // if (!string.IsNullOrEmpty(moduleId)) // { // var buttonList = data.Select("ModuleId='" + moduleId + "'"); // dictionary.Add(moduleId, buttonList.ToList()); // } //} //return dictionary; }
public ActionResult ModuleButtonTreeJson(string roleId) { var existModuleButton = permissionBLL.GetModuleButtonList(roleId); var moduleData = authorizeBLL.GetModuleList(SystemInfo.CurrentUserId); var moduleButtonData = authorizeBLL.GetModuleButtonList(SystemInfo.CurrentUserId); var treeList = new List <TreeEntity>(); foreach (ModuleEntity item in moduleData) { if (item.IsMenu == 1) { bool hasChildren = moduleButtonData.Count(t => t.ModuleId == item.ModuleId) == 0 ? false : true; if (hasChildren == false) { continue; } } TreeEntity tree = new TreeEntity(); tree.id = item.ModuleId; tree.text = item.FullName; tree.value = item.ModuleId; tree.checkstate = existModuleButton.Count(t => t.ItemId == item.ModuleId); tree.showcheck = true; tree.isexpand = true; tree.complete = true; tree.hasChildren = true; tree.parentId = item.ParentId; tree.img = item.Icon; treeList.Add(tree); } foreach (ModuleButtonEntity item in moduleButtonData) { TreeEntity tree = new TreeEntity(); bool hasChildren = moduleButtonData.Count(t => t.ParentId == item.ModuleButtonId) == 0 ? false : true; tree.id = item.ModuleButtonId; tree.text = item.FullName; tree.value = item.ModuleButtonId; if (item.ParentId == "0") { tree.parentId = item.ModuleId; } else { tree.parentId = item.ParentId; } tree.checkstate = existModuleButton.Count(t => t.ItemId == item.ModuleButtonId); tree.showcheck = true; tree.isexpand = true; tree.complete = true; tree.img = "fa fa-wrench " + item.ModuleId; tree.hasChildren = hasChildren; treeList.Add(tree); } return(Content(treeList.TreeToJson())); }