Hello retroviz
I've made the scroll feature. Thank you. You can see it at
http://www.cei-esas.com.pt, on the right side.
The other issue (order by ViewCount, Rating, etc.):
Do you mean change the SqlArticlesProvider.cs method
/// <summary>
/// Retrieves all articles
/// </summary>
public override List<ArticleDetails> GetArticles(int pageIndex, int pageSize)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("tbh_Articles_GetArticles", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@PageIndex", SqlDbType.Int).Value = pageIndex;
cmd.Parameters.Add("@PageSize", SqlDbType.Int).Value = pageSize;
cn.Open();
return GetArticleCollectionFromReader(ExecuteReader(cmd), false);
}
}
to something similar of the Forum Threads in the DAL (SqlForumsProvider.cs)?
/// <summary>
/// Retrieves approved threads (from any forum) by page
/// </summary>
public override List<PostDetails> GetThreads(string sortExpression, int pageIndex, int pageSize)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
sortExpression = EnsureValidSortExpression(sortExpression);
int lowerBound = pageIndex * pageSize + 1;
int upperBound = (pageIndex + 1) * pageSize;
string sql = string.Format(@"SELECT * FROM
(
SELECT tbh_Posts.PostID, tbh_Posts.AddedDate, tbh_Posts.AddedBy, tbh_Posts.AddedByIP,
tbh_Posts.ForumID, tbh_Posts.ParentPostID, tbh_Posts.Title, tbh_Posts.Approved,
tbh_Posts.Closed, tbh_Posts.ViewCount, tbh_Posts.ReplyCount, tbh_Posts.LastPostDate,
tbh_Posts.LastPostBy, tbh_Forums.Title AS ForumTitle,
ROW_NUMBER() OVER (ORDER BY {0}) AS RowNum
FROM tbh_Posts INNER JOIN tbh_Forums ON tbh_Posts.ForumID = tbh_Forums.ForumID
WHERE ParentPostID = 0 AND Approved = 1
) ForumThreads
WHERE ForumThreads.RowNum BETWEEN {1} AND {2}
ORDER BY RowNum ASC", sortExpression, lowerBound, upperBound);
SqlCommand cmd = new SqlCommand(sql, cn);
cn.Open();
return GetPostCollectionFromReader(ExecuteReader(cmd), false);
}
}
Thank you.
Cheers.
Luis J.