Пример #1
0
        protected void ReplyCommentAnonymous_Button_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                DataListItem Item  = (DataListItem)(((Control)sender).NamingContainer);
                int          index = Item.ItemIndex;
                if (((TextBox)AllMyNewComment_DataList.Items[index].FindControl("Reply_TextBox")).Text.Trim() == "")
                {
                    ScriptManager.RegisterStartupScript(Page, GetType(), "nocontent", "alert('请输入内容!');", true);
                    //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('请输入内容!');location.href='" + Request.Url.AbsoluteUri + "'</script>");
                }
                else
                {
                    MessageInfo replycomment = new MessageInfo();
                    replycomment.Anonymous     = 1;
                    replycomment.MessageID     = int.Parse(e.CommandArgument.ToString());
                    replycomment.UserID        = user.UserID;
                    replycomment.TargetUserID  = int.Parse(TargetUserID_TextBox.Text);
                    replycomment.TargetReplyID = int.Parse(TargetReplyID_TextBox.Text);
                    replycomment.Content       = ((TextBox)AllMyNewComment_DataList.Items[index].FindControl("Reply_TextBox")).Text;
                    replycomment.AddCommentReply();

                    mynewcomment                        = user.GetNewComment();
                    AspNetPager.RecordCount             = mynewcomment.Tables["NewComment"].Rows.Count;
                    AllMyNewComment_DataList.DataSource = FilterTable(mynewcomment.Tables["NewComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                    AllMyNewComment_DataList.DataBind();
                    //Response.Redirect(Request.Url.AbsoluteUri);
                }
            }
        }
Пример #2
0
        protected void Delete_CommentReply_LinkButton_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                MessageInfo replycomment = new MessageInfo();
                replycomment.MessageID = int.Parse(e.CommandArgument.ToString());
                replycomment.DeleteCommentReply();

                mynewcomment                        = user.GetNewComment();
                AspNetPager.RecordCount             = mynewcomment.Tables["NewComment"].Rows.Count;
                AllMyNewComment_DataList.DataSource = FilterTable(mynewcomment.Tables["NewComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewComment_DataList.DataBind();
                //Response.Redirect(Request.Url.AbsoluteUri);
            }
        }
Пример #3
0
        protected void AspNetPager_PageChanged(object src, EventArgs e)
        {
            int index;// = AspNetPager.CurrentPageIndex;

            if (Request.QueryString["Page"] == null)
            {
                index = 1;
            }
            else
            {
                index = Convert.ToInt32(Request.QueryString["Page"]);
                AspNetPager.CurrentPageIndex = index;//一直都是1,所以用这种法子给它改
            }
            AllMyNewComment_DataList.DataSource = FilterTable(mynewcomment.Tables["NewComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
            AllMyNewComment_DataList.DataBind();
        }
Пример #4
0
        protected void ReadAllNewComment_Button_Click(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                MessageInfo comment = new MessageInfo();
                comment.UserID = user.UserID;
                comment.Type   = 1;
                comment.ReadType();

                mynewcomment                        = user.GetNewComment();
                AspNetPager.RecordCount             = mynewcomment.Tables["NewComment"].Rows.Count;
                AllMyNewComment_DataList.DataSource = FilterTable(mynewcomment.Tables["NewComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewComment_DataList.DataBind();
                //Response.Redirect("/aspx/MyNewComment.aspx");
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                user = Session["UserInfo"] as UserInfo;
            }
            else
            {
                Response.Redirect("/aspx/Login.aspx");
            }

            if (!Page.IsPostBack)
            {
                mynewcomment                        = user.GetNewComment();
                AspNetPager.RecordCount             = mynewcomment.Tables["NewComment"].Rows.Count;
                AllMyNewComment_DataList.DataSource = FilterTable(mynewcomment.Tables["NewComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewComment_DataList.DataBind();
            }
        }