예제 #1
0
        protected void MsgRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = e.Item.DataItem as DataRowView;
                //判断信息类型
                switch (dr["MsgType"].ToString())
                {
                case "1":

                    e.Item.FindControl("normal").Visible = true;
                    break;

                case "2":
                    e.Item.FindControl("vote").Visible = true;
                    //用户投过票,或投票已到期,则直接显示结果页
                    if (HasVote(dr["VoteResult"].ToString(), buser.GetLogin().UserID) || Convert.ToDateTime(dr["EndTime"]) < DateTime.Now)
                    {
                        e.Item.FindControl("vote_user_div").Visible  = false;
                        e.Item.FindControl("msg_op_btn_div").Visible = false;
                        (e.Item.FindControl("vote_result_div") as System.Web.UI.HtmlControls.HtmlGenericControl).Style.Add("display", "block");
                    }
                    Repeater  rep = e.Item.FindControl("VoteResultRep") as Repeater;
                    DataTable dt  = msgBll.GetVoteResultDT(dr["VoteOP"].ToString(), dr["VoteResult"].ToString());
                    rep.DataSource = dt;
                    rep.DataBind();
                    break;

                case "3":
                    e.Item.FindControl("longarticle").Visible = true;
                    break;
                }
            }
        }
예제 #2
0
        public void LoadVote()
        {
            M_Blog_Msg msgMod = GetMsgMod();

            vote.Visible = true;
            if (HasVote(msgMod.VoteResult, buser.GetLogin().UserID) || msgMod.EndTime < DateTime.Now)
            {
                vote_user_div.Visible  = false;
                msg_op_btn_div.Visible = false;
                (vote_result_div as System.Web.UI.HtmlControls.HtmlGenericControl).Style.Add("display", "block");
            }
            Repeater  rep = VoteResultRep as Repeater;
            DataTable dt  = msgBll.GetVoteResultDT(msgMod.VoteOP, msgMod.VoteResult);

            rep.DataSource = dt;
            rep.DataBind();
        }
        protected void MsgRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //加载用户回复列表
                Literal      replyList = e.Item.FindControl("ReplyList_L") as Literal;
                DataRowView  dr        = e.Item.DataItem as DataRowView;
                int          pid       = Convert.ToInt32(dr["ID"]);
                StringWriter sw        = new StringWriter();
                Server.Execute("/Plat/Blog/ReplyList.aspx?pid=" + pid + "&PageSize=" + replyPageSize + "&PageIndex=1", sw);
                if (!LView.Equals("timeline") && !LView.Equals("tomht"))
                {
                    replyList.Text = Regex.Match(sw.ToString(), "(?<=(start>))[.\\s\\S]*?(?=(</start))", RegexOptions.IgnoreCase).Value;
                }
                //判断信息类型
                switch (dr["MsgType"].ToString())
                {
                case "1":

                    e.Item.FindControl("normal").Visible = true;
                    break;

                case "2":
                    e.Item.FindControl("vote").Visible = true;
                    //用户投过票,或投票已到期,则直接显示结果页
                    if (HasVote(dr["VoteResult"].ToString(), buser.GetLogin().UserID) || Convert.ToDateTime(dr["EndTime"]) < DateTime.Now)
                    {
                        e.Item.FindControl("vote_user_div").Visible  = false;
                        e.Item.FindControl("msg_op_btn_div").Visible = false;
                        (e.Item.FindControl("vote_result_div") as System.Web.UI.HtmlControls.HtmlGenericControl).Style.Add("display", "block");
                    }
                    Repeater  rep = e.Item.FindControl("VoteResultRep") as Repeater;
                    DataTable dt  = msgBll.GetVoteResultDT(dr["VoteOP"].ToString(), dr["VoteResult"].ToString());
                    rep.DataSource = dt;
                    rep.DataBind();
                    break;

                case "3":
                    e.Item.FindControl("longarticle").Visible = true;
                    break;
                }
            }
        }