public override void CopyFrom(BasicThread thread) { base.CopyFrom(thread); PollThreadV5 poll = (PollThreadV5)thread; this.AlwaysEyeable = poll.AlwaysEyeable; this.CreateDate = poll.CreateDate; this.ExpiresDate = poll.ExpiresDate; this.Multiple = poll.Multiple; this.PollItems = poll.PollItems; this.VotedUserIDs = poll.VotedUserIDs; }
protected void Page_Load(object sender, EventArgs e) { int threadID = _Request.Get<int>("ThreadID", Method.Get, 0); if (threadID <= 0) { ShowError(new InvalidParamError("ThreadID").Message); } BasicThread thread = PostBOV5.Instance.GetThread(threadID); if (thread is PollThreadV5) { } else { ShowError("该主题不是投票帖"); } poll = (PollThreadV5)thread; //SetPageTitle("投票详细情况"); if (!AllSettings.Current.ForumPermissionSet.Nodes.GetPermission(poll.ForumID).Can(My, ForumPermissionSetNode.Action.ViewPollDetail)) ShowError("您所在的用户组没有权限查看详细投票情况!"); if (thread == null) ShowError("主题不存在!"); if (MyUserID == thread.PostUserID || AllSettings.Current.ForumPermissionSet.Nodes.GetPermission(poll.ForumID).Can(My, ForumPermissionSetNode.Action.AlwaysViewContents) || poll.AlwaysEyeable || poll.IsVoted(MyUserID)) { } else { ShowError("需要投票后才能查看详细投票情况!"); } PollItemDetailList = PostBOV5.Instance.GetPollItemDetails(threadID); foreach (PollItem pi in poll.PollItems) { VoteTotalCount += pi.PollItemCount; } }
public ThreadCollectionV5(DataReaderWrap readerWrap) { while (readerWrap.Next) { BasicThread thread; ThreadType threadType = readerWrap.Get <ThreadType>("ThreadType"); switch (threadType) { case ThreadType.Poll: PollThreadV5 poll = new PollThreadV5(readerWrap); poll.IsClosed = poll.ExpiresDate <= DateTimeUtil.Now; thread = (BasicThread)poll; break; case ThreadType.Polemize: PolemizeThreadV5 polemize = new PolemizeThreadV5(readerWrap); polemize.IsClosed = polemize.ExpiresDate <= DateTimeUtil.Now; thread = (BasicThread)polemize; break; case ThreadType.Question: QuestionThread question = new QuestionThread(readerWrap); if (question.IsClosed == false) { question.IsClosed = question.ExpiresDate <= DateTimeUtil.Now; } thread = (BasicThread)question; break; default: thread = new BasicThread(readerWrap); break; } this.Add(thread); } }
protected override void GetThread() { if (IsOnlyLookOneUser) { Response.Redirect(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, 1, LookUserID, PostBOV5.Instance.GetThreadTypeString(ThreadType.Normal), ForumListPage)); } if (IsUnapprovePosts) { BbsRouter.JumpToUrl(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, PostBOV5.Instance.GetThreadTypeString(ThreadType.Normal)), "type=" + Type); } int? total; if (string.IsNullOrEmpty(Type)) { ThreadType realThreadType; PostBOV5.Instance.GetPollWithReplies(ThreadID, PageNumber, PageSize, true, UpdateView, out m_PollThread, out m_PostList, out realThreadType); //如果不是 投票 则跳到相应的页面 if (realThreadType != ThreadType.Poll) { Response.Redirect(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, PostBOV5.Instance.GetThreadTypeString(realThreadType))); } } else { BasicThread thread; GetPosts(ThreadType.Poll, out m_TotalPosts, out thread, out m_PostList); m_PollThread = (PollThreadV5)thread; } PostBOV5.Instance.ProcessKeyword(m_PostList, ProcessKeywordMode.TryUpdateKeyword); //if (_Request.IsSpider == false) //{ //List<int> userIDs = new List<int>(); //foreach (PostV5 post in m_PostList) //{ // userIDs.Add(post.UserID); //} //UserBO.Instance.GetUsers(userIDs, GetUserOption.WithAll); UserBO.Instance.GetUsers(m_PostList.GetUserIds(), GetUserOption.WithAll); //} }
public override int Vote(IEnumerable<int> itemIDs, int threadID, int userID, string nickName, PollThreadV5 poll) { string itemIDsString = StringUtil.Join(itemIDs); using (SqlQuery query = new SqlQuery()) { query.CommandText = "bx_v5_Vote"; query.CommandType = CommandType.StoredProcedure; query.CreateParameter<string>("@ItemIDs", itemIDsString, SqlDbType.VarChar, 8000); query.CreateParameter<int>("@ThreadID", threadID, SqlDbType.Int); query.CreateParameter<int>("@UserID", userID, SqlDbType.Int); query.CreateParameter<string>("@NickName", nickName, SqlDbType.NVarChar, 64); query.CreateParameter<int>("@ErrorCode", SqlDbType.Int, ParameterDirection.ReturnValue); string extendData = null; using (XSqlDataReader reader = query.ExecuteReader()) { extendData = GetExtendData(poll, ThreadType.Poll, reader, true); } int returnValue = (int)query.Parameters["@ErrorCode"].Value; if (returnValue == 0 && extendData != null) { UpdateThreadExtendData(extendData, threadID, query); } return returnValue; } }
private BasicThread GetThread(XSqlDataReader reader, DateTime? expiresDate) { ThreadType threadType = reader.Get<ThreadType>("ThreadType"); switch (threadType) { case ThreadType.Poll: PollThreadV5 poll = new PollThreadV5(reader); if (expiresDate != null) poll.IsClosed = expiresDate.Value <= DateTimeUtil.Now; return (BasicThread)poll; case ThreadType.Polemize: PolemizeThreadV5 polemize = new PolemizeThreadV5(reader); if (expiresDate != null) polemize.IsClosed = expiresDate.Value <= DateTimeUtil.Now; return (BasicThread)polemize; case ThreadType.Question: QuestionThread question = new QuestionThread(reader); if (question.IsClosed == false) { if (expiresDate != null) question.IsClosed = expiresDate.Value <= DateTimeUtil.Now; } return (BasicThread)question; default: return new BasicThread(reader); } }