Esempio n. 1
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);
     }
 }
Esempio n. 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);
            }
        }
Esempio n. 3
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);
     }
 }
Esempio n. 4
0
        //存表的信息
        public int Insert(ReplyComments replycomments)
        {
            string sql = "insert into ReplyComments values(@ComID,@UserID,@ReplyComContent,@ReplyComTime)";

            SqlParameter[] sp = new SqlParameter[] {
                new SqlParameter("@ComID", replycomments.ComID),
                new SqlParameter("@UserID", replycomments.UserID),
                new SqlParameter("@ReplyComContent", replycomments.ReplyComContent),
                new SqlParameter("@ReplyComTime", replycomments.ReplyComTime)
            };
            return(DBHelper.GetExcuteNonQuery(sql, sp));
        }
Esempio n. 5
0
        /// <summary>
        /// Gửi like và unlike Reply
        /// </summary>
        /// <param name="isLike"></param>
        /// <param name="reply"></param>
        public static void SendLike(bool isLike, ref ReplyComments reply)
        {
            if (Helper.Instance().ListReplyComment.ContainsKey(reply.Id))
            {
                Helper.Instance().ListReplyComment[reply.Id] = reply;
            }
            else
            {
                Helper.Instance().ListReplyComment.Add(reply.Id, reply);
            }
            QHMessage msg;

            //like reply
            if (isLike)
            {
                msg = new QHMessage((ushort)PingPongMsg.MSG_LIKE_REQ);
            }
            //unlike reply
            else
            {
                msg = new QHMessage((ushort)PingPongMsg.MSG_UNLIKE_REQ);
            }
            if (reply != null)
            {
                var id = Helper.Instance().MyAccount.Number_Id;
                if (id > 0)
                {
                    msg.SetAt((byte)MsgLikeReqArg.NumberID, new QHNumber(id));
                }
                else
                {
                    return;
                }
                if (reply.Id > 0)
                {
                    msg.SetAt((byte)MsgLikeReqArg.ReplyID, new QHNumber(reply.Id));
                }
                else
                {
                    return;
                }
                Services.Service.Instiance().Like = Services.StatueLike.Reply;
                Services.Service.Instiance().SendMessage(msg);
            }
        }
Esempio n. 6
0
        public async Task <CommonResponse> ReplySharingComment(string Musicid, string Commentid, ReplyComments comments)
        {
            comments.Time = (int)DateUtil.NowToUnix();
            var result = await _sharing.ReplyMusicSharingComment(Musicid, ObjectId.Parse(Commentid), comments);

            return(new CommonResponse {
                StatusCode = result ? 0 : -1
            });
        }
Esempio n. 7
0
 public static int Insert(ReplyComments replycomments)
 {
     return(ireplycomments.Insert(replycomments));
 }
Esempio n. 8
0
 //添加被评论
 public static int addreplycomments(ReplyComments replycomments)
 {
     return(ireplycomments.addreplycomments(replycomments));
 }
Esempio n. 9
0
        public async Task <bool> ReplyMusicSharingComment(string Musicid, ObjectId Commentid, ReplyComments comments)
        {
            // var musicFilter = Builders<MusicComments>.Filter.Eq("musicid",Musicid);
            // var root = await (await _context.MusicComments.FindAsync(musicFilter)).FirstOrDefaultAsync();;
            // if(root != null)
            // {
            //     Builders<MusicComments>.Update.Push("comments.$[].comments",comments);
            // }
            // return false;
            comments._id = ObjectId.GenerateNewId();
            var filters = Builders <MusicComments> .Filter.Eq(r => r.Musicid, Musicid) & Builders <MusicComments> .Filter.Eq("comments._id", Commentid);

            var pusher = Builders <MusicComments> .Update.Push("comments.$[].comments", comments);

            var updated = await _context.MusicComments.UpdateOneAsync(filters, pusher);

            return(updated.ModifiedCount == 1);
        }
Esempio n. 10
0
 public async Task <JsonResult> ReplySharingComment([FromQuery] string musicid, [FromQuery] string commentid, [FromBody] ReplyComments comments)
 {
     return(new JsonResult(await _sharing.ReplySharingComment(musicid, commentid, comments)));
 }
Esempio n. 11
0
 public static int InsertReplyComments(ReplyComments replyComments)
 {
     //throw new NotImplementedException();
     return(iReplyComments.InsertReplyComments(replyComments));
 }