コード例 #1
0
        protected void Reply_Button_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                DataListItem Item  = (DataListItem)(((Control)sender).NamingContainer);
                int          index = Item.ItemIndex;
                if (((TextBox)AllMyNewCommentReply_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
                {
                    string[] arg           = e.CommandArgument.ToString().Split(',');
                    string   targetreplyid = arg[0];
                    string   commentid     = arg[1];
                    string   targetuserid  = arg[2];

                    MessageInfo reply = new MessageInfo();
                    reply.Anonymous     = 0;
                    reply.MessageID     = int.Parse(commentid);
                    reply.UserID        = user.UserID;
                    reply.TargetUserID  = int.Parse(targetuserid);
                    reply.TargetReplyID = int.Parse(targetreplyid);
                    reply.Content       = ((TextBox)AllMyNewCommentReply_DataList.Items[index].FindControl("Reply_TextBox")).Text;
                    reply.AddCommentReply();

                    mynewcommentreply       = user.GetNewCommentReply();
                    AspNetPager.RecordCount = mynewcommentreply.Tables["NewCommentReply"].Rows.Count;
                    AllMyNewCommentReply_DataList.DataSource = FilterTable(mynewcommentreply.Tables["NewCommentReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                    AllMyNewCommentReply_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();

                mynewcommentreply       = user.GetNewCommentReply();
                AspNetPager.RecordCount = mynewcommentreply.Tables["NewCommentReply"].Rows.Count;
                AllMyNewCommentReply_DataList.DataSource = FilterTable(mynewcommentreply.Tables["NewCommentReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewCommentReply_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,所以用这种法子给它改
            }
            AllMyNewCommentReply_DataList.DataSource = FilterTable(mynewcommentreply.Tables["NewCommentReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
            AllMyNewCommentReply_DataList.DataBind();
        }
コード例 #4
0
        protected void ReadAllNewCommentReply_Button_Click(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                MessageInfo replycomment = new MessageInfo();
                replycomment.UserID = user.UserID;
                replycomment.Type   = 3;
                replycomment.ReadType();

                mynewcommentreply       = user.GetNewCommentReply();
                AspNetPager.RecordCount = mynewcommentreply.Tables["NewCommentReply"].Rows.Count;
                AllMyNewCommentReply_DataList.DataSource = FilterTable(mynewcommentreply.Tables["NewCommentReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewCommentReply_DataList.DataBind();
                //Response.Redirect("/aspx/MyNewCommentReply.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)
            {
                mynewcommentreply       = user.GetNewCommentReply();
                AspNetPager.RecordCount = mynewcommentreply.Tables["NewCommentReply"].Rows.Count;
                AllMyNewCommentReply_DataList.DataSource = FilterTable(mynewcommentreply.Tables["NewCommentReply"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                AllMyNewCommentReply_DataList.DataBind();
            }
        }