日期:2014-05-20 浏览次数:20964 次
public static List<KL_Prem_SysFun> GetMenu(int roleid) { var queryRoleRight = from KL_Prem_RoleRight in Entities.KL_Prem_RoleRight.Where(p => p.RoleId == roleid) select KL_Prem_RoleRight; var querySysFun = from KL_Prem_SysFun in Entities.KL_Prem_SysFun.Where(p => p.ParentNodeId == 0) select KL_Prem_SysFun; List<KL_Prem_SysFun> listSysfun = new List<KL_Prem_SysFun>(); KL_Prem_SysFun sysfunmodel; foreach (var sysfun in querySysFun) { foreach (var right in queryRoleRight) { if (sysfun.NodeId==right.NodeId) { sysfunmodel = new KL_Prem_SysFun(); sysfunmodel.DisplayName = sysfun.DisplayName; sysfunmodel.DisplayOrder = sysfun.DisplayOrder; sysfunmodel.NodeId = sysfun.NodeId; sysfunmodel.NodeURL = sysfun.NodeURL; sysfunmodel.ParentNodeId = sysfun.ParentNodeId; listSysfun.Add(sysfunmodel); } } } return listSysfun; }
public static List<KL_Prem_SysFun> GetMenu(int roleid) { var queryRoleRight = Entities.KL_Prem_RoleRight.Where(p => p.RoleId == roleid); var querySysFun = from KL_Prem_SysFun in Entities.KL_Prem_SysFun where KL_Prem_SysFun.ParentNodeId == 0&& queryRoleRight.Any(a=>a.NodeId==KL_Prem_SysFun.NodeId) select KL_Prem_SysFun; return querySysFun.ToList(); } //关系 public static List<KL_Prem_SysFun> GetMenu(int roleid) { var querySysFun = Entities.KL_Prem_SysFun.Where(w => w.ParentNodeId == 0 && w.KL_Prem_RoleRight.Any(a => a.RoleId == roleid && a.NodeId == w.NodeId)); return querySysFun.ToList(); }