/// <summary> /// 新建主题构造函数 /// </summary> /// <param name="rootMessage"></param> /// <param name="forum"></param> public ForumThread(ThreadRootMessage rootMessage, Guid forumId) { this._rootMessage = rootMessage; this._forumId = forumId; this._state = new ForumThreadState(this) { ClickCount = 0, MessageCount = 0, ModifiedDate = rootMessage.CreationDate }; this._threadId = Guid.NewGuid(); this._rootMessage.ForumThreadID = this._threadId; }
public static ThreadRootMessage CreateFromPersist(Guid id, DateTime creationDate, DateTime modifiedDate, Guid account, Guid forumId, MessageVO msgVO) { ThreadRootMessage trm = new ThreadRootMessage(); trm._messageId = id; trm._creationDate = creationDate; trm._modifiedDate = modifiedDate; trm._account = account; trm._forum = forumId; trm._messageVO = msgVO; return(trm); }
public static ThreadRootMessage CreateFromReader(IDataReader r) { ThreadRootMessage msg = new ThreadRootMessage(); msg._messageId = new Guid(r["MessageID"].ToString()); msg._creationDate = Convert.ToDateTime(r["CreationDate"]); msg._modifiedDate = Convert.ToDateTime(r["ModifiedDate"]); msg._forumThreadId = new Guid(r["ThreadID"].ToString()); msg._forum = new Guid(r["ForumID"].ToString()); msg._account = new Guid(r["AccountID"].ToString()); MessageVO msgVO = new MessageVO(); msgVO.Body = HttpUtility.HtmlDecode(r["Body"].ToString()); msgVO.RewardPoints = Convert.ToInt32(r["RewardPoints"] ?? 0); msgVO.Subject = r["Subject"].ToString(); msg._messageVO = msgVO; return(msg); }
/// <summary> /// 普通对象,可以被缓存并复用 /// </summary> /// <param name="rootMessage">主题的根:帖子</param> public ForumThread(ThreadRootMessage rootMessage) { this._rootMessage = rootMessage; }