Beispiel #1
0
 protected void ReplyMyCommentAnonymous_Button_Click(object sender, EventArgs e)
 {
     if (Session["UserInfo"] != null)
     {
         if (MyReplyComment_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(mycomment.Tables["CourseComment"].Rows[0]["CommentID"].ToString());
             replycomment.UserID        = user.UserID;
             replycomment.TargetUserID  = int.Parse(TargetUserID_TextBox.Text);
             replycomment.TargetReplyID = int.Parse(TargetReplyID_TextBox.Text);
             replycomment.Content       = MyReplyComment_TextBox.Text;
             if (1 == replycomment.AddCommentReply())
             {
                 AllDataBind();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(Page, GetType(), "replyfailed", "alert('回复失败');", true);
             }
         }
     }
     else
     {
         HttpContext.Current.Response.Write("<script type='text/javascript'>alert('闲置时间过长,请重新登录');location.href='" + Request.Url.AbsoluteUri + "'</script>");
     }
 }
Beispiel #2
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);
                }
            }
        }
Beispiel #3
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)AllComment_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)AllComment_DataList.Items[index].FindControl("Reply_TextBox")).Text;
             if (1 == replycomment.AddCommentReply())
             {
                 AllDataBind();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(Page, GetType(), "replyfailed", "alert('回复失败');", true);
             }
         }
     }
     else
     {
         HttpContext.Current.Response.Write("<script type='text/javascript'>alert('闲置时间过长,请重新登录');location.href='" + Request.Url.AbsoluteUri + "'</script>");
     }
 }