/// <summary> /// 获取用户及角色和所属分组 /// </summary> /// <returns></returns> public DataTable getUserRoleGroup(string keyValue) { var r = db.Queryable <user>().ToList(); DataTable dt = db.Queryable <user>().ToDataTable(); for (int i = 0; i < dt.Rows.Count; i++) { userRoleEx ure = new userRoleEx(); userGroupEx uge = new userGroupEx(); dt.Rows[i]["rolelist"] = ure.getRoleName(Convert.ToInt32(dt.Rows[i]["id"])); dt.Rows[i]["grouplist"] = uge.getGroupName(Convert.ToInt32(dt.Rows[i]["id"])); } return(dt); }
/// <summary> /// 获取用户表的分页并显示用户角色及分组 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize">页面的数据总数</param> /// <param name="searchStr">搜索的字段</param> /// <returns></returns> public List <user> getPaginationUserList(int pageIndex, int pageSize, Dictionary <string, object> searchStr) { userRoleEx ure = new userRoleEx(); userGroupEx uge = new userGroupEx(); List <user> entitylist = new List <user>(); var entitydata = getEntityList(searchStr); var pagerfirst = (pageIndex - 1) * pageSize; entitylist = entitydata.Skip(pagerfirst).Take(pageSize).ToList(); foreach (user us in entitylist) { us.rolelist = ure.getRoleName(us.id); us.grouplist = uge.getGroupName(us.id); } return(entitylist); }