protected List <DiscussionPanel> Get_Threads() { List <DiscussionPanel> panels = new List <DiscussionPanel> { }; DataSetTableAdapters.FilmsTableAdapter filmsta = new DataSetTableAdapters.FilmsTableAdapter(); DataSet.FilmsDataTable films = filmsta.GetActiveFilmsAlphabetically(); foreach (DataSet.FilmsRow film in films) { DataSetTableAdapters.PostsTableAdapter poststa = new DataSetTableAdapters.PostsTableAdapter(); DataSet.PostsDataTable posts = poststa.GetPostsByFilmId(film.Id, true); DataSet.PostsRow lastpost = null; if (posts.Count > 0) { lastpost = posts.Last(); } string url = "/DiscussionBoard/discussion.aspx?id=" + film.Id.ToString(); DiscussionPanel panel = new DiscussionPanel(film, lastpost, posts.Count, url); panels.Add(panel); } return(panels); }
public DiscussionPanel(DataSet.FilmsRow film, DataSet.PostsRow lastpost, int postcount, string url) { Film = film; LastPost = lastpost; PostCount = postcount; URL = url; }