Public feed
#723657
public QueryResult getTopicsForUser(int userId)
{
List<Topic> result = new List<Topic>();
using (DatabaseConnectionMonitor monior = new DatabaseConnectionMonitor(Database))
{
using (SqlCommand sqlCommand = Database.CreateCommand(string.Format(sqlFindByUser,
userId)))
{
using (SqlDataReader dataReader = sqlCommand.ExecuteReader())
{
while (dataReader.Read())
{
Topic topic = doLoad(dataReader);
topic.TextCount = dataReader.GetInt32(dataReader.FieldCount - 1);
result.Add(topic);
}
}
}
}
foreach (Topic topic in result)
assingParent(topic, result);
foreach (Topic topic in result)
topic.Weight = 0;
QueryResult queryResult = new QueryResult(Guid.NewGuid().ToString(), true, result);
Hashtable filter = new Hashtable();
filter["UserID"] = userId;
registerCollection(string.Format(sqlFindByUser, userId), queryResult.QueryId, new QueryOptions(true), filter);
return queryResult;
}