/// <summary> /// 获取指定用户所参与群组列表 /// </summary> /// <param name="userId"></param> /// <returns></returns> public static IEnumerable <int> GetGroupsByUser(int userId) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Social_GetUserGroups", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId", userId); return(cmd.ExecuteDataTable().AsEnumerable().Select(dr => dr.Field <int>("GroupId"))); } }
/// <summary> /// 获取指定学校、指定角色类型的用户编号列表 /// </summary> /// <param name="schoolId"></param> /// <param name="userRole"></param> /// <returns></returns> public static IEnumerable <int> GetSchoolUserIds(int schoolId, int userRole) { using (DbCommander cmd = new DbCommander(DbConn.ReadDb, "SP_School_GetCsUsers", CommandType.StoredProcedure)) { cmd.AddInputParameters("SchoolId, UserRole", schoolId, userRole); return(cmd.ExecuteDataTable().AsEnumerable().Select(dr => dr.Field <int>("UserId"))); } }
/// <summary> /// 获取词、句、新闻信息分页列表数据 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="target">目标数据类型:0-词 1-句 2-新闻</param> /// <param name="sort">排序方式:0-升序,1-降序</param> /// <returns></returns> public static IEnumerable <WsnContent> GetWsnContentList(int pageIndex, int pageSize, int target, int sort) { using (DbCommander cmd = new DbCommander(DbConn.ReadDb, "SP_Material_Wsn_GetNewsList", CommandType.StoredProcedure)) { cmd.AddInputParameters("Target, PageIndex, PageSize, Sort", target, pageIndex, pageSize, sort); return(cmd.ExecuteDataTable().AsEnumerable().Select(dr => new WsnContent { NewsId = dr.Field <int>("NewsId"), Title = dr.Field <string>("Title"), SubTitle = dr.Field <string>("SubTitle"), CategoryName = dr.Field <string>("CategoryName"), ImagePath = dr.Field <string>("ImagePath"), AudioPath = dr.Field <string>("AudioPath") }).ToList()); } }