public override BanUserOperationCollection GetBanUserLogsByUserID(int userid) { using (SqlQuery query = new SqlQuery()) { query.CommandText = @" SELECT * FROM bx_BanUserLogs WHERE UserID = @userid ORDER BY OperationTime DESC; SELECT * FROM bx_BanUserLogForumInfos WHERE LogID IN(SELECT LogID FROM bx_BanUserLogs WHERE UserID = @userid) ORDER BY LogID DESC;"; query.CreateParameter <int>("@userid", userid, SqlDbType.Int); using (XSqlDataReader reader = query.ExecuteReader()) { BanUserOperationCollection collection = new BanUserOperationCollection(reader); BanUserOperation operation = null; if (reader.NextResult()) { while (reader.Next) { BanForumInfo foruminfo = new BanForumInfo(reader); if (operation != null && foruminfo.ID == operation.ID) { operation.ForumInfoList.Add(foruminfo); } else { operation = collection.GetValue(foruminfo.ID); operation.ForumInfoList.Add(foruminfo); } } } return(collection); } } }
public override List <BanForumInfo> GetBanForumInfos(int banLogID) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "SELECT * FROM bx_BanUserLogForumInfos WHERE LogID = @LogID"; query.CreateParameter <int>("@LogID", banLogID, SqlDbType.Int); using (XSqlDataReader reader = query.ExecuteReader()) { List <BanForumInfo> results = new List <BanForumInfo>(); while (reader.Next) { BanForumInfo foruminfo = new BanForumInfo(reader); results.Add(foruminfo); } return(results); } } }
public override BanUserOperationCollection GetBanUserLogsByUserID(int userid) { using (SqlQuery query = new SqlQuery()) { query.CommandText = @" SELECT * FROM bx_BanUserLogs WHERE UserID = @userid ORDER BY OperationTime DESC; SELECT * FROM bx_BanUserLogForumInfos WHERE LogID IN(SELECT LogID FROM bx_BanUserLogs WHERE UserID = @userid) ORDER BY LogID DESC;"; query.CreateParameter<int>("@userid", userid, SqlDbType.Int); using (XSqlDataReader reader = query.ExecuteReader()) { BanUserOperationCollection collection = new BanUserOperationCollection(reader); BanUserOperation operation = null; if(reader.NextResult()) { while (reader.Next) { BanForumInfo foruminfo = new BanForumInfo(reader); if (operation != null && foruminfo.ID == operation.ID) operation.ForumInfoList.Add(foruminfo); else { operation = collection.GetValue(foruminfo.ID); operation.ForumInfoList.Add(foruminfo); } } } return collection; } } }
public override List<BanForumInfo> GetBanForumInfos(int banLogID) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "SELECT * FROM bx_BanUserLogForumInfos WHERE LogID = @LogID"; query.CreateParameter<int>("@LogID", banLogID, SqlDbType.Int); using (XSqlDataReader reader = query.ExecuteReader()) { List<BanForumInfo> results = new List<BanForumInfo>(); while (reader.Next) { BanForumInfo foruminfo = new BanForumInfo(reader); results.Add(foruminfo); } return results; } } }