/// <summary> /// Setups the default values. /// </summary> public override void AddSampleData() { Message message = new Message(1); message.Name = "Welcome to your new SharePoint Forum"; message.UserId = 1; message.Body = "<DIV>This is an example post in your SharePoint Forum installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!</DIV>"; RepositoryRegistry.MessageRepository.Save(message); }
public static SharePointListItem CreateDto(Message message) { string[] postValues = { "Title", message.Name, "TopicID", message.TopicId.ToString(), "Body", message.Body, "UserID", message.UserId.ToString(), }; return new SharePointListItem(message.Id, postValues); }
public static Message CreateDomainObject(SharePointListItem listItem) { Message message = new Message(Convert.ToInt32(listItem["TopicID"])); message.Name = listItem["Title"]; message.UserId = Convert.ToInt32(listItem["UserID"]); message.Author = RepositoryRegistry.ForumUserRepository.GetBySharePointId(message.UserId); message.Created = Convert.ToDateTime(listItem["Created"]); message.Body = listItem["Body"]; message.Id = listItem.Id; return message; }
public void Save(Message message) { SharePointListItem listItem = MessageMapper.CreateDto(message); if (message.Id == 0) { Provider.AddListItem(ForumConstants.Lists_Posts, listItem); // TopicRepository.IncreasePostCount(message.TopicId); } else { Provider.UpdateListItem(ForumConstants.Lists_Posts, listItem); } }
public IList<Message> FindByKeywords(string keywords) { // TODO this is broken and needs to use CAML instead IList<Message> messages = new List<Message>(); if (keywords == null) return messages; SPSearchResultCollection searchResults = ForumApplication.Instance.SpWeb.SearchListItems(keywords); foreach (SPSearchResult result in searchResults) { if (result.ListName.ToUpper() == ForumConstants.Lists_Posts.ToUpper()) { Message message = new Message(0); message.Name = result.Title; messages.Add(message); } } return messages; }
public void Save(Message message) { _dao.Save(message); }