protected void Comment_YouLikes(GridViewRow row) { GridView gridviewcomment = (GridView)row.FindControl("GridViewComments"); foreach (GridViewRow gvr in gridviewcomment.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { LinkButton linkLike = (LinkButton)gvr.FindControl("lbtnCommentLike"); Label labelLike = (Label)gvr.FindControl("lblCommentLike"); LinkButton linkLikeCount = (LinkButton)gvr.FindControl("lbtnCommentLikeUser"); HiddenField hfId = (HiddenField)gvr.FindControl("HiddenFieldId"); HiddenField hfdate = (HiddenField)gvr.FindControl("HiddenFieldCommentAddedDate"); Label labeldate = (Label)gvr.FindControl("lblCommentAddedDate"); DateTime date = Convert.ToDateTime(hfdate.Value); labeldate.Text = TimeAgo(date); long likecount = LikesBLL.countPost(hfId.Value, Global.WALL_COMMENT); if (likecount > 0) { linkLikeCount.Text = likecount.ToString() + " Users"; } else { linkLikeCount.Visible = false; } HiddenField Userownid = (HiddenField)gvr.FindControl("HiddenFieldCommentUserId"); LinkButton lbtnDeleteComment = (LinkButton)gvr.FindControl("lbtnDeleteComment"); if (Userownid.Value.Equals(Session["UserId"].ToString())) { lbtnDeleteComment.Visible = true; } LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL_COMMENT; objClass.UserId = Session["UserId"].ToString(); bool islike = LikesBLL.youLikes(objClass); if (islike) { labelLike.Text = ""; linkLike.Text = "UnLike"; } else { labelLike.Text = ""; linkLike.Text = "Like"; } } } }
protected void YouLikes() { foreach (GridViewRow gvr in GridViewWall.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { LinkButton linkLike = (LinkButton)gvr.FindControl("lbtnLike"); Label labelLike = (Label)gvr.FindControl("lblLike"); LinkButton linkLikeCount = (LinkButton)gvr.FindControl("lbtnUser"); HiddenField hfId = (HiddenField)gvr.FindControl("HiddenFieldId"); long likecount = LikesBLL.countPost(hfId.Value, Global.WALL); if (likecount > 0) { linkLikeCount.Text = likecount.ToString() + " Users"; } else { linkLikeCount.Visible = false; } LinkButton linkcountComments = (LinkButton)gvr.FindControl("lbtnViewComments"); long totalcomments = CommentsDAL.countComment(hfId.Value, Global.WALL); if (totalcomments > 2) { linkcountComments.Text = "View All " + totalcomments.ToString() + " Comments"; } else { linkcountComments.Visible = false; } LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); bool islike = LikesBLL.youLikes(objClass); if (islike) { labelLike.Text = "You Like This"; linkLike.Text = "UnLike"; } else { labelLike.Text = ""; linkLike.Text = "Like"; } } } }
protected void YouLikes() { LikesBO objClass = new LikesBO(); objClass.AtId = Photoid; objClass.Type = Global.VIDEO; objClass.UserId = Userid; bool islike = LikesBLL.youLikes(objClass); if (islike) { lblLike.Text = "You Like This"; lbtnLike.Text = "UnLike"; } else { lblLike.Text = ""; lbtnLike.Text = "Like"; } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /// POST LIKE MODULE //// //////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void YouLikes(GridViewRow gvr) { if (gvr.RowType == DataControlRowType.DataRow) { LinkButton linkLike = (LinkButton)gvr.FindControl("lbtnLike"); Label labelLike = (Label)gvr.FindControl("lblLike"); LinkButton linkLikeCount = (LinkButton)gvr.FindControl("lbtnUser"); HiddenField hfId = (HiddenField)gvr.FindControl("HiddenFieldWallId"); HiddenField hfuserId = (HiddenField)gvr.FindControl("HiddenFieldUserId"); HiddenField hfdate = (HiddenField)gvr.FindControl("HiddenFieldAddedDate"); Label labeldate = (Label)gvr.FindControl("lblAddedDate"); // Literal literalpost = (Literal)gvr.FindControl("LiteralPost"); //ImageButton imgbtn = (ImageButton)gvr.FindControl("ImageButton1"); DateTime date = Convert.ToDateTime(hfdate.Value); labeldate.Text = TimeAgo(date); //if (literalpost.Text.IndexOf("width") > 0) // imgbtn.Visible = false; long likecount = LikesBLL.countPost(hfId.Value, Global.WALL); if (likecount > 0) { linkLikeCount.Text = likecount.ToString() + " Likes"; } else { linkLikeCount.Visible = false; } LinkButton linkcountComments = (LinkButton)gvr.FindControl("lbtnViewComments"); long totalcomments = CommentsDAL.countComment(hfId.Value, Global.WALL); if (totalcomments > 2) { linkcountComments.Text = "View All " + totalcomments.ToString() + " Comments"; } else { linkcountComments.Text = totalcomments.ToString() + " Comments"; } if (totalcomments <= 0) { linkcountComments.Visible = false; } HiddenField Userownid = (HiddenField)gvr.FindControl("HiddenFieldUserId"); LinkButton lbtnDelete = (LinkButton)gvr.FindControl("lbtnDelete"); if (Userownid.Value.Equals(Session["UserId"].ToString())) { lbtnDelete.Visible = true; } LikesBO objClass = new LikesBO(); objClass.AtId = hfId.Value; objClass.Type = Global.WALL; objClass.UserId = Session["UserId"].ToString(); bool islike = LikesBLL.youLikes(objClass); if (islike) { labelLike.Text = ""; linkLike.Text = "UnLike"; } else { labelLike.Text = ""; linkLike.Text = "Like"; } } }