public IList <Permission> GetPermissionsNotInRole(string code, string categoryCode) { IList <Permission> allPermissions = permissionMgr.GetALlPermissionsByCategory(categoryCode); IList <Permission> rolePermissions = GetPermissionsByRoleCode(code, categoryCode); List <Permission> otherPermissions = new List <Permission>(); if (allPermissions != null && allPermissions.Count > 0) { foreach (Permission r in allPermissions) { if (!rolePermissions.Contains(r)) { otherPermissions.Add(r); } } } otherPermissions = otherPermissions.OrderBy(p => p.Description).ToList(); return(otherPermissions); }
public IList <Permission> GetPermissionsNotInUser(string code, string categoryCode) { IList <Permission> allPermissions = permissionMgr.GetALlPermissionsByCategory(categoryCode); IList <Permission> userPermissions = GetPermissionsByUserCode(code, categoryCode); List <Permission> otherPermissions = new List <Permission>(); if (allPermissions != null && allPermissions.Count > 0) { foreach (Permission r in allPermissions) { if (!userPermissions.Contains(r)) { otherPermissions.Add(r); } } } var q = otherPermissions.OrderBy(a => a.Description); return(q.ToList()); }