public TopicCollection FindByForumId(int id) { TopicCollection topicCollection = new TopicCollection(); SharePointListDescriptor descriptor = Provider.GetListItemsByField(ForumConstants.Lists_Topics, "ForumID", id.ToString()); foreach (SharePointListItem listItem in descriptor.SharePointListItems) { topicCollection.Add(TopicMapper.CreateDomainObject(listItem)); } return topicCollection; }
public TopicCollection GetAll() { TopicCollection topicCollection = new TopicCollection(); SharePointListDescriptor descriptor = Provider.GetAllListItems(ForumConstants.Lists_Topics); foreach (SharePointListItem listItem in descriptor.SharePointListItems) { topicCollection.Add(TopicMapper.CreateDomainObject(listItem)); } return topicCollection; }
public TopicCollection FindInactive() { SharePointListDescriptor listItems = Provider.GetListItemsByField( ForumConstants.Lists_Topics, "NumPosts", "1"); TopicCollection topics = new TopicCollection(); foreach (SharePointListItem item in listItems.SharePointListItems) { topics.Add(TopicMapper.CreateDomainObject(item)); } return topics; }
public TopicCollection FindByDate(DateTime dateCriteria) { string isoDate = SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateCriteria); SharePointListDescriptor listItems = Provider.GetListItemsByField(ForumConstants.Lists_Topics, "Modified", isoDate); TopicCollection topics = new TopicCollection(); foreach (SharePointListItem item in listItems.SharePointListItems) { topics.Add(TopicMapper.CreateDomainObject(item)); } return topics; }
protected void DisplayTopics(TopicCollection topics) { topics.Sort("LastPost", SortDirection.Descending); foreach (Topic topic in topics) { Controls.Add(new LiteralControl("<tr class=\"ms-alternating\">")); Controls.Add(new LiteralControl(string.Format("<td valign=\"top\"><img src=\"{0}\"></td>", ForumApplication.Instance.ForumImage))); string postLink = ForumApplication.Instance.GetLink(SharePointForumControls.ViewMessages, "topic={0}", topic.Id); Controls.Add(new LiteralControl(string.Format("<td align=left><strong><a href=\"{0}\">{1}</a></strong></td>", postLink, topic.Name))); Controls.Add(new LiteralControl(string.Format("<td align=middle width=7%>{0}</td>", topic.Replies))); Controls.Add(new LiteralControl(string.Format("<td align=middle width=20%>{0}</td>", HtmlUtility.CreateProfileLink(topic.Author)))); Controls.Add(new LiteralControl(string.Format("<td align=middle width=7%>{0}</td>", topic.Views))); Controls.Add(new LiteralControl(string.Format("<td align=middle width=25%>{0}<br>{1}</td>", topic.LastPost.ToString("ddd MMM d, yyyy h:m tt"), topic.Author.Name))); Controls.Add(new LiteralControl("</tr>")); } }