private void updateCount( ForumPost post, User user, IMember owner, IApp app ) { ForumTopic topic = post.Topic; if (topic == null) { topic = topicService.GetById( post.TopicId, owner ); } topic.Replies = topicService.CountReply( post.TopicId ); topic.RepliedUserName = user.Name; topic.RepliedUserFriendUrl = user.Url; topic.Replied = DateTime.Now; topicService.UpdateReply( topic ); ForumBoard fb = ForumBoard.findById( post.ForumBoardId ); fb.TodayPosts++; fb.Posts = boardService.CountPost( fb.Id ); LastUpdateInfo info = new LastUpdateInfo(); info.PostId = post.Id; info.PostType = typeof( ForumPost ).Name; info.PostTitle = post.Title; info.CreatorName = user.Name; info.CreatorUrl = user.Url; info.UpdateTime = DateTime.Now; fb.LastUpdateInfo = info; fb.Updated = info.UpdateTime; boardService.Update( fb ); ForumApp forum = app as ForumApp; forum.PostCount++; forum.TodayPostCount++; forum.LastUpdateMemberName = user.Name; forum.LastUpdateMemberUrl = user.Url; forum.LastUpdatePostTitle = post.Title; forum.LastUpdateTime = post.Created; forumService.Update( forum ); userService.AddPostCount( user ); }
private void updateForumLastupdate( ForumTopic topic, User user ) { ForumBoard fb = boardService.GetById( topic.ForumBoard.Id, topic.OwnerId, topic.OwnerType ); LastUpdateInfo info = new LastUpdateInfo(); info.PostId = topic.Id; info.PostType = typeof( ForumTopic ).Name; info.PostTitle = topic.Title; info.CreatorName = user.Name; info.CreatorUrl = user.Url; info.UpdateTime = DateTime.Now; fb.LastUpdateInfo = info; fb.Updated = info.UpdateTime; boardService.Update( fb ); }
private String getLastUpdateInfo( LastUpdateInfo info ) { if (info.IsEmpty()) return string.Empty; String lnkPost = ""; if (info.PostType.Equals( typeof( ForumTopic ).Name )) lnkPost = to( new TopicController().Show, info.PostId ); else if (info.PostType.Equals( typeof( ForumPost ).Name )) lnkPost = to( new PostController().Show, info.PostId ); return string.Format( "<div class=\"fblastTitle\"><a href='{0}'>{1}</a></div><div class=\"fblastTime\">by <a href='{3}'>{2}</a> at {4}</div>", lnkPost, strUtil.CutString( info.PostTitle, 30 ), info.CreatorName, toUser( info.CreatorUrl ), info.UpdateTime.ToShortDateString() ); }
private void updateCount( ForumTopic topic, User user, IApp app ) { ForumBoard fb = boardService.GetById( topic.ForumBoard.Id, topic.OwnerId, topic.OwnerType ); fb.TodayPosts++; fb.Topics = boardService.CountTopic( fb.Id ); LastUpdateInfo info = new LastUpdateInfo(); info.PostId = topic.Id; info.PostType = typeof( ForumTopic ).Name; info.PostTitle = topic.Title; info.CreatorName = user.Name; info.CreatorUrl = user.Url; info.UpdateTime = DateTime.Now; fb.LastUpdateInfo = info; fb.Updated = info.UpdateTime; boardService.Update( fb ); ForumApp forum = app as ForumApp; forum.TopicCount = forum.CountTopic(); forum.TodayTopicCount++; forum.LastUpdateMemberName = user.Name; forum.LastUpdateMemberUrl = user.Url; forum.LastUpdatePostTitle = topic.Title; forum.LastUpdateTime = topic.Created; forumService.Update( forum ); userService.AddPostCount( user ); }
public virtual void UpdateLastInfo( ForumBoard fb ) { ForumTopic topic = ForumTopic .find( "ForumBoardId=" + fb.Id + " and " + TopicStatus.GetShowCondition() + " order by Id desc" ) .first(); LastUpdateInfo info = new LastUpdateInfo(); info.PostId = topic.Id; info.PostType = typeof( ForumTopic ).Name; info.PostTitle = topic.Title; User user = topic.Creator; info.CreatorName = user.Name; info.CreatorUrl = user.Url; info.UpdateTime = topic.Created; fb.LastUpdateInfo = info; fb.Updated = info.UpdateTime; db.update( fb ); }