public static SimpleDataSet MapTopicToSimpleDataIndexItem(ReadOnlyTopic topic, SimpleDataSet simpleDataSet, int id, string indexType) { //First generate the accumulated comment text: var commentText = string.Empty; foreach (var currentComment in topic.Comments.Where(c => c.IsSpam == false)) { commentText += currentComment.Body; } var body = library.StripHtml(topic.Body + commentText); simpleDataSet.NodeDefinition.NodeId = id; simpleDataSet.NodeDefinition.Type = indexType; simpleDataSet.RowData.Add("body", body); if (!string.IsNullOrEmpty(commentText)) { simpleDataSet.RowData.Add("comments", commentText); } simpleDataSet.RowData.Add("nodeName", topic.Title); simpleDataSet.RowData.Add("updateDate", topic.Updated.ToString("yyyy-MM-dd HH:mm:ss")); simpleDataSet.RowData.Add("nodeTypeAlias", "forum"); simpleDataSet.RowData.Add("urlName", topic.UrlName); simpleDataSet.RowData.Add("createDate", topic.Created.ToString("yyyy-MM-dd HH:mm:ss")); simpleDataSet.RowData.Add("latestCommentId", topic.LatestComment.ToString()); simpleDataSet.RowData.Add("latestReplyAuthorId", topic.LatestReplyAuthor.ToString()); if (!string.IsNullOrEmpty(topic.LastReplyAuthorName)) { simpleDataSet.RowData.Add("latestReplyAuthorName", topic.LastReplyAuthorName); } simpleDataSet.RowData.Add("authorId", topic.MemberId.ToString()); if (!string.IsNullOrEmpty(topic.AuthorName)) { simpleDataSet.RowData.Add("authorName", topic.AuthorName); } simpleDataSet.RowData.Add("parentId", topic.ParentId.ToString()); simpleDataSet.RowData.Add("replies", topic.Replies.ToString()); simpleDataSet.RowData.Add("locked", topic.Locked.ToString()); simpleDataSet.RowData.Add("solved", topic.Answer.ToString()); simpleDataSet.RowData.Add("version", topic.Version.ToString()); return(simpleDataSet); }
public void SendNotifications(ReadOnlyTopic topic, string memberName, string url) { var newForumTopicNotification = new NotificationsCore.Notifications.NewForumTopic(); newForumTopicNotification.SendNotification(topic, memberName, url); }