Example #1
0
 protected void btnRply_Click(object sender, EventArgs e)
 {
     if (Session["UserName"] != null)
     {
         if (Page.IsValid)
         {
             Button        btn           = (Button)sender;
             string        a             = ((TextBox)btn.Parent.FindControl("txtReplyContent")).Text.Trim();
             ReplyComments replycomments = new ReplyComments();
             replycomments.ComID           = Int32.Parse((btn.Parent.FindControl("HiddenFieldComID") as HiddenField).Value);
             replycomments.UserID          = int.Parse(Session["UserID"].ToString());
             replycomments.ReplyComContent = ((TextBox)btn.Parent.FindControl("txtReplyContent")).Text.Trim();
             replycomments.ReplyComTime    = DateTime.Now;
             int result = ReplyCommentsService.Insert(replycomments);
             if (result >= 1)
             {
                 ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('回复成功!')", true);
                 visibleflag = true;
                 BindComments();
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('回复失败!')", true);
             }
         }
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('您必须先登录才能回复');", true);
         ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "updateScript", "window.location.href='Login.aspx'", true);
     }
 }
Example #2
0
        //回复
        protected void huifu_Click(object sender, EventArgs e)
        {
            Button bt = (Button)sender;

            if (Session["User_ID"] != null)
            {
                try
                {
                    ReplyComments replycomments = new ReplyComments();
                    replycomments.ReplyComments_Content = (bt.Parent.FindControl("txtContent") as TextBox).Text;
                    replycomments.ReplyComments_Time    = DateTime.Now;
                    replycomments.User_ID     = int.Parse(Session["User_ID"].ToString());
                    replycomments.Comments_ID = Int32.Parse((bt.Parent.FindControl("HiddenField1") as HiddenField).Value);
                    if (ReplyCommentsService.addreplycomments(replycomments) == 1)
                    {
                        txtContent.Text = "";
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('回复评论成功!');", true);
                        flag = true;
                        BindBC();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('回复评论失败!');", true);
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("错误原因:" + ex.Message);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('对不起,请先登录!');", true);
            }
        }
        public async Task <List <ReplyCommentsDto> > GetAllReplyCommentsInfo(Guid commentParentId)
        {
            using (IReplyCommentsService reply = new ReplyCommentsService())
            {
                var data = await reply.GetAllAsync()
                           .Include(m => m.Comment.User)
                           .Where(m => m.Comment.Article.UserId == commentParentId)
                           .OrderByDescending(m => m.CreateTime)
                           .Select(m => new ReplyCommentsDto()
                {
                    NickName               = m.ReplierUser.NickName,       //回复人
                    ByReplyNickName        = m.TargetToReplyUser.NickName, //被回复人
                    ReplyContent           = m.ReplyContent,               //回复内容
                    ImagePath              = m.ReplierUser.ImagePath,
                    ReplierId              = m.ReplierId,                  //回复用户Id
                    TargetToReplyId        = m.TargetToReplyId,            //回复目标用户Id
                    ReplyToTargetCommentId = m.ReplyToTargetCommentId,     //回复目标评论Id
                    Id = m.Id,
                    CommentParentId = m.CommentParentId,
                    CreateTime      = m.CreateTime
                }).ToListAsync();

                return(data);
            }
        }
Example #4
0
 //回复评论
 protected void btnRply_Click(object sender, EventArgs e)
 {
     if (Session["UserName"] != null)
     {
         if (Page.IsValid)
         {
             LinkButton    btn           = (LinkButton)sender;
             int           UserID        = Convert.ToInt32(Session["UserID"]);
             ReplyComments ReplyComments = new ReplyComments();
             ReplyComments.ComID           = Int32.Parse((btn.Parent.FindControl("HiddenFieldComID") as HiddenField).Value);
             ReplyComments.UserID          = UserID;
             ReplyComments.ReplyComContent = ((TextBox)btn.Parent.FindControl("txtReplyContent")).Text;
             ReplyComments.ReplyComTime    = DateTime.Now;
             int result = ReplyCommentsService.InsertReplyComments(ReplyComments);
             if (result >= 1)
             {
                 ScriptManager.RegisterClientScriptBlock(ReplyUpdatePanel, this.GetType(), "click", "alert('回复成功')", true);
                 visibleflag = true;
                 BindMessage();
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(ReplyUpdatePanel, this.GetType(), "click", "alert('回复失败')", true);
             }
         }
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(ReplyUpdatePanel, this.GetType(), "click", "alert('您必须先登录才能发表评论');", true);
         ScriptManager.RegisterStartupScript(ReplyUpdatePanel, MessageUpdatePanel.GetType(), "updateScript", "window.location.href='Login.aspx'", true);
     }
 }
        public async Task RemoveReturnComment(Guid id)
        {
            using (IReplyCommentsService replyComments = new ReplyCommentsService())
            {
                var data = await replyComments.GetAllAsync().Where(m => m.Id == id).FirstAsync();

                await replyComments.RemoveAsync(data);
            }
        }
Example #6
0
        //数据绑定
        private void BindAct()
        {
            DataTable dt = ReplyCommentsService.SelectAll();

            if (dt != null && dt.Rows.Count > 0)
            {
                ListView1.DataSource = dt;
                ListView1.DataBind();
            }
        }
Example #7
0
        protected void listView1_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            Repeater rpt        = e.Item.FindControl("Repeater2") as Repeater;//找到里层的repeate;
            int      commentsid = Convert.ToInt32(((Label)e.Item.FindControl("Label1")).Text);

            if (Request.QueryString["pro_id"] != null)
            {
                rpt.DataSource = ReplyCommentsService.acgreplycomments(commentsid);
                rpt.DataBind();
            }
        }
Example #8
0
        //回复他人的评论删除
        protected void btnDelete3_Click(object sender, EventArgs e)
        {
            Button bt = (Button)sender;
            int    id = Convert.ToInt32(((HiddenField)(bt.Parent.FindControl("HiddenField4"))).Value);

            if (ReplyCommentsService.Delete(id) > 0)
            {
                BindTComments();
                Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
            }
        }
Example #9
0
        //删除事件
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Button bt = (Button)sender;
            int    id = Convert.ToInt32(((HiddenField)(bt.Parent.FindControl("HiddenField1"))).Value);

            if (ReplyCommentsService.Delete(id) > 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "<script language='javascript' >alert('删除成功!');</script>");
                BindAct();
            }
        }
 public async Task CreateReplyToComment(Guid replierId, Guid targetToReplyId, string content, int replyType, Guid commentParentId, Guid replyToTargetCommentId)   //回复人、被回复人、回复内容、回复类型
 {
     using (IReplyCommentsService reply = new ReplyCommentsService())
     {
         await reply.CreateAsync(new ReplyComments()
         {
             ReplierId              = replierId,
             TargetToReplyId        = targetToReplyId,
             ReplyContent           = content,
             ReplyType              = replyType,
             CommentParentId        = commentParentId,
             ReplyToTargetCommentId = replyToTargetCommentId
         });
     }
 }
Example #11
0
 protected void lvComments_ItemDataBound(object sender, ListViewItemEventArgs e)
 {
     if (e.Item.ItemType == ListViewItemType.DataItem)
     {
         HiddenField hiddenComID = e.Item.FindControl("HiddenFieldComID") as HiddenField;
         int         ComID       = int.Parse(hiddenComID.Value);
         Repeater    rpt         = e.Item.FindControl("RepeaterReplyComments") as Repeater;
         DataTable   dt          = ReplyCommentsService.SelectReplyComments(ComID);
         if (dt != null && dt.Rows.Count > 0)
         {
             rpt.DataSource = dt;
             rpt.DataBind();
         }
     }
 }
Example #12
0
 //绑定他人评论
 protected void BindTComments()
 {
     ListView2.DataSource = ReplyCommentsService.replyusers(int.Parse(Session["User_ID"].ToString()));
     ListView2.DataBind();
 }