public int GetLikedfriendsComment(int commentID) { RateAndTagDAL dal = new RateAndTagDAL(); Comments aComment = new Comments(commentID); string memberId = Context.Session["memberID"].ToString(); Member aMember = new Member(memberId); dal.DeleteCommentLike(aMember, aComment); //like count int numberofCommentLikes = newsFeedDAL.CountCommentsLikes(aComment); return(numberofCommentLikes); }
public int LikeAComment(int commentID) { NotificationDAL notificationDAL = new NotificationDAL(); //LIKE A COMMENT RateAndTagDAL dal = new RateAndTagDAL(); Comments aComment = new Comments(commentID); List <Member> MemberList = new List <Member>(); MemberList = notificationDAL.GetCommentOwner(aComment); Member aFriend = new Member(MemberList[0].MemberId); string memberId = Context.Session["memberID"].ToString(); Member aMember = new Member(memberId); //checking if u have already rated the comment if (dal.CommentRatingExists(aMember, aComment) == 0) { //proceed and rate if u havnt commented dal.RateComment(aMember, aComment); List <Rating> RatingList = new List <Rating>(); RatingList = notificationDAL.GetCommentRatingID(aComment, aMember); Rating aRating = new Rating(RatingList[0].RatingId); if (RatingList.Count > 0) { notificationDAL.InsertCommentRatingNotification(aRating, aMember, aFriend, aComment); } } else { //you have already rated the comment //MessageBox.Show("already rated by u"); } //like count int numberofCommentLikes = newsFeedDAL.CountCommentsLikes(aComment); return(numberofCommentLikes); }
public int UnlikeAPost(int postID) { //like method here RateAndTagDAL dal = new RateAndTagDAL(); Post aPost = new Post(postID); string memberId = Context.Session["memberID"].ToString(); Member aMember = new Member(memberId); dal.DeletePostLike(aMember, aPost); aPost.PostId = postID; int numberofPostLikes = newsFeedDAL.CountPostLikes(aPost); return(numberofPostLikes); }
public int LikeAPost(int postID) { NotificationDAL notificationDAL = new NotificationDAL(); RateAndTagDAL dal = new RateAndTagDAL(); Post aPost = new Post(postID); List <Member> MemberList = new List <Member>(); MemberList = notificationDAL.GetPostOwner(aPost); Member aFriend = new Member(MemberList[0].MemberId); string memberId = Context.Session["memberID"].ToString(); Member aMember = new Member(memberId); //Check if like exists if (dal.PostRatingExists(aMember, aPost) == 0) { dal.RatePost(aMember, aPost); List <Rating> RatingList = new List <Rating>(); RatingList = notificationDAL.GetPostRatingID(aPost, aMember); Rating aRating = new Rating(RatingList[0].RatingId); if (RatingList.Count > 0) { notificationDAL.InsertPostRatingNotification(aRating, aMember, aFriend, aPost); } } else { //MessageBox.Show("already rated by u"); } aPost.PostId = postID; int numberofPostLikes = newsFeedDAL.CountPostLikes(aPost); return(numberofPostLikes); }
public string GetPeopleLikedPost(int postID) { StringBuilder concatinater = new StringBuilder(); if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else { Member aMember = new Member(Context.Session["memberID"].ToString()); Post aPost = new Post(postID); aPost.PostId = postID; RateAndTagDAL rateAndTagDAL = new RateAndTagDAL(); List <Member> GetPeopleLikedPost = new List <Member>(); GetPeopleLikedPost = rateAndTagDAL.GetPeopleLikedPost(aPost); concatinater.Append("<div class='postinfo width50% floatLeft tip'> <a title='"); for (int i = 0; i < GetPeopleLikedPost.Count; ++i) { concatinater.Append(GetPeopleLikedPost[i].MemberId); concatinater.Append("<br />"); } } return(concatinater.ToString()); //Details Left //foreach (var Member in AllLikedMembers) //{ // concatinater.Append(Member.DisplayName); // concatinater.Append("<br />"); //} }
public int UnlikeAPost(int postID) { //like method here RateAndTagDAL dal = new RateAndTagDAL(); Post aPost = new Post(postID); string memberId = Context.Session["memberID"].ToString(); Member aMember = new Member(memberId); dal.DeletePostLike(aMember, aPost); aPost.PostId = postID; int numberofPostLikes = newsFeedDAL.CountPostLikes(aPost); return numberofPostLikes; }
public int UnlikeAComment(int commentID) { RateAndTagDAL dal = new RateAndTagDAL(); Comments aComment = new Comments(commentID); string memberId = Context.Session["memberID"].ToString(); Member aMember = new Member(memberId); dal.DeleteCommentLike(aMember, aComment); //like count int numberofCommentLikes = newsFeedDAL.CountCommentsLikes(aComment); return numberofCommentLikes; }
public int LikeAPost(int postID) { NotificationDAL notificationDAL = new NotificationDAL(); RateAndTagDAL dal = new RateAndTagDAL(); Post aPost = new Post(postID); List<Member> MemberList = new List<Member>(); MemberList = notificationDAL.GetPostOwner(aPost); Member aFriend = new Member(MemberList[0].MemberId); string memberId = Context.Session["memberID"].ToString(); Member aMember = new Member(memberId); //Check if like exists if (dal.PostRatingExists(aMember, aPost) == 0) { dal.RatePost(aMember, aPost); List<Rating> RatingList = new List<Rating>(); RatingList = notificationDAL.GetPostRatingID(aPost, aMember); Rating aRating = new Rating(RatingList[0].RatingId); if (RatingList.Count > 0) { notificationDAL.InsertPostRatingNotification(aRating, aMember, aFriend, aPost); } } else { //MessageBox.Show("already rated by u"); } aPost.PostId = postID; int numberofPostLikes = newsFeedDAL.CountPostLikes(aPost); return numberofPostLikes; }
public int LikeAComment(int commentID) { NotificationDAL notificationDAL = new NotificationDAL(); //LIKE A COMMENT RateAndTagDAL dal = new RateAndTagDAL(); Comments aComment = new Comments(commentID); List<Member> MemberList = new List<Member>(); MemberList = notificationDAL.GetCommentOwner(aComment); Member aFriend = new Member(MemberList[0].MemberId); string memberId = Context.Session["memberID"].ToString(); Member aMember = new Member(memberId); //checking if u have already rated the comment if (dal.CommentRatingExists(aMember, aComment) == 0) { //proceed and rate if u havnt commented dal.RateComment(aMember, aComment); List<Rating> RatingList = new List<Rating>(); RatingList = notificationDAL.GetCommentRatingID(aComment, aMember); Rating aRating = new Rating(RatingList[0].RatingId); if (RatingList.Count > 0) { notificationDAL.InsertCommentRatingNotification(aRating, aMember, aFriend, aComment); } } else { //you have already rated the comment //MessageBox.Show("already rated by u"); } //like count int numberofCommentLikes = newsFeedDAL.CountCommentsLikes(aComment); return numberofCommentLikes; }
public string GetAllComments(int postID) { Post post = new Post(); Comments comment = new Comments(); MessagesDAL m = new MessagesDAL(); string date = ""; post.PostId = postID; StringBuilder comnt = new StringBuilder(); DataTable comments = m.GetAllComments(post); foreach (DataRow row in comments.Rows) { Reusable_Methods reusable_Methods = new Reusable_Methods(); date = reusable_Methods.FormatDateTime(Convert.ToDateTime(row["CreateDate"])); //Building single message view box comnt.Append("<div id='"); comnt.Append((row["CommentID"]).ToString()); comnt.Append("' class='aComment'><div class='deleteComment floatright'>"); comment.Commentid = int.Parse(row["CommentID"].ToString()); if ((row["MemberID"]).ToString() == Session["memberID"].ToString()) { comnt.Append("<a class='btnDleteComment ui-icon ui-icon-close tip floatLeft' title='Delete this comment' ></a>"); } else { //comnt.Append("<a class='btnOpenMenuComment ui-icon ui-icon-circle-triangle-s tip' title='More options..' ></a>"); comnt.Append("<a class='button left big floatLeft likeComment '"); RateAndTagDAL dal = new RateAndTagDAL(); string memberId = Context.Session["memberID"].ToString(); Member amember = new Member(memberId); //Check if member not liked if (dal.CommentRatingExists(amember, comment) ==0) { //if member not liked //concatinater.Append(" homeLikeBtn"); comnt.Append("' title='"); comnt.Append("Like this comment"); comnt.Append("' >"); comnt.Append("Like"); } else { //if member is liked // concatinater.Append(" homeUnlikeBtn"); comnt.Append("' title='"); comnt.Append("Unlike this comment"); comnt.Append("' >"); comnt.Append("Unlike"); } comnt.Append("</a>"); comnt.Append("<a class='button right big floatLeft reportComment' title='Report this comment'>Report </a>"); } comnt.Append("</div><h5><a style='font-weight:normal;' "); comnt.Append("id='" + (row["MemberID"]).ToString() + "'> "); comnt.Append(row["Friend"].ToString()); comnt.Append("</a><span class='DateWithTime ui-corner-all floatright'>"); comnt.Append(date); comnt.Append("</span></h5><p>"); comnt.Append((row["CommentText"]).ToString()); comnt.Append("</p></div>"); //End Building } return comnt.ToString(); //End Refresh }
private void CloseWrapper() { #region CLOSING WRAPPER int numberofPostLikes = bl.CountPostLikes(aPost); int numberofPostTags = bl.CountPostTags(aPost); //ContentArea Closing AND Wrapper oppening+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ concatinater.Append("<div class='clr' ></div> </div> </div><div class='commentWrapper'> "); //buttons Right concatinater.Append("<div class='btnHomePost width50% floatright '><a class='button left big floatLeft homeLikeBtn"); RateAndTagDAL dal = new RateAndTagDAL(); //aMember = new Member(memberId); //Check if member not liked if (dal.PostRatingExists(aMember, aPost) == 0) { //if member not liked //concatinater.Append(" homeLikeBtn"); concatinater.Append("' title='"); concatinater.Append("Like this post"); concatinater.Append("' >"); concatinater.Append("Like"); } else { //if member is liked concatinater.Append("' title='"); concatinater.Append("Unlike this post"); concatinater.Append("' >"); concatinater.Append("Unlike"); } //Post button concatinater.Append("</a><a class='button middle big floatLeft homeCommentBtn' title='Comment on this post' >Comment</a>"); //report Button concatinater.Append("<a class='button middle big floatLeft reportPost' title='Report this post' >Report</a>"); //tag button concatinater.Append("<a class='button right big floatLeft homeTagBtn open tag' title='Tag a friend' >Tag </a>"); concatinater.Append("</div>"); List<Member> AllLikedMembers = dal.GetPeopleLikedPost(aPost); //Details Left concatinater.Append("<div class='postinfo width50% floatLeft tip'> <a title='"); foreach (var Member in AllLikedMembers) { concatinater.Append(Member.DisplayName); concatinater.Append("<br />"); } concatinater.Append("' href='#'>Likes</a>: <span class='likesCount'> " + numberofPostLikes); concatinater.Append("</span>, <a href='#'>Tags</a>: <span class='tagsCount'>" + numberofPostTags); concatinater.Append("</span>, <a class='btnViewComments' title='View all comments'>Comments</a>: <span class='commentCount'>" + bl.CountComments(aPost) + "</span> </div>"); concatinater.Append("</div>" // Wrapper End //Buiding the Comments section + "<div class='allComments'><h4>All Comments</h4></div>" //Buiding the Comments section + "<div class='commentSection' style='display:none; padding: 7px;'><div>" + "<textarea title='Write a comment...' placeholder='Write a comment...' class=' commentBox floatLeft input BorberRad3'" + " style='width: 100%; height: 30px; font-size: 0.85em; margin: 5px 0pt 7px;' rows='2' cols='20'></textarea>" + " <a class='button big floatLeft btnSendComment floatright ' style='font-size: 0.9em; margin-right: -10px; ' >Comment</a></div></div></div>"); #endregion }
public void UnlikeAPost(string sessionMemberID, int postID) { RateAndTagDAL dal = new RateAndTagDAL(); string memberId = sessionMemberID; Member aMember = new Member(memberId); aPost.PostId = postID; dal.DeletePostLike(aMember, aPost); int numberofPostLikes = newsFeedDAL.CountPostLikes(aPost); //Updating all Clients Clients.updatePostLikeCount(numberofPostLikes, postID); }
public string GetPeopleLikedPost(int postID) { StringBuilder concatinater = new StringBuilder(); if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else { Member aMember = new Member(Context.Session["memberID"].ToString()); Post aPost = new Post(postID); aPost.PostId = postID; RateAndTagDAL rateAndTagDAL = new RateAndTagDAL(); List<Member> GetPeopleLikedPost = new List<Member>(); GetPeopleLikedPost = rateAndTagDAL.GetPeopleLikedPost(aPost); concatinater.Append("<div class='postinfo width50% floatLeft tip'> <a title='"); for (int i = 0; i < GetPeopleLikedPost.Count; ++i) { concatinater.Append(GetPeopleLikedPost[i].MemberId); concatinater.Append("<br />"); } } return concatinater.ToString(); //Details Left //foreach (var Member in AllLikedMembers) //{ // concatinater.Append(Member.DisplayName); // concatinater.Append("<br />"); //} }
public string GetAllComments(int postID) { Post post = new Post(); Comments comment = new Comments(); MessagesDAL m = new MessagesDAL(); string date = ""; post.PostId = postID; StringBuilder comnt = new StringBuilder(); DataTable comments = m.GetAllComments(post); foreach (DataRow row in comments.Rows) { Reusable_Methods reusable_Methods = new Reusable_Methods(); date = reusable_Methods.FormatDateTime(Convert.ToDateTime(row["CreateDate"])); //Building single message view box comnt.Append("<div id='"); comnt.Append((row["CommentID"]).ToString()); comnt.Append("' class='aComment'><div class='deleteComment floatright'>"); comment.Commentid = int.Parse(row["CommentID"].ToString()); if ((row["MemberID"]).ToString() == Session["memberID"].ToString()) { comnt.Append("<a class='btnDleteComment ui-icon ui-icon-close tip floatLeft' title='Delete this comment' ></a>"); } else { //comnt.Append("<a class='btnOpenMenuComment ui-icon ui-icon-circle-triangle-s tip' title='More options..' ></a>"); comnt.Append("<a class='button left big floatLeft likeComment '"); RateAndTagDAL dal = new RateAndTagDAL(); string memberId = Context.Session["memberID"].ToString(); Member amember = new Member(memberId); //Check if member not liked if (dal.CommentRatingExists(amember, comment) == 0) { //if member not liked //concatinater.Append(" homeLikeBtn"); comnt.Append("' title='"); comnt.Append("Like this comment"); comnt.Append("' >"); comnt.Append("Like"); } else { //if member is liked // concatinater.Append(" homeUnlikeBtn"); comnt.Append("' title='"); comnt.Append("Unlike this comment"); comnt.Append("' >"); comnt.Append("Unlike"); } comnt.Append("</a>"); comnt.Append("<a class='button right big floatLeft reportComment' title='Report this comment'>Report </a>"); } comnt.Append("</div><h5><a style='font-weight:normal;' "); comnt.Append("id='" + (row["MemberID"]).ToString() + "'> "); comnt.Append(row["Friend"].ToString()); comnt.Append("</a><span class='DateWithTime ui-corner-all floatright'>"); comnt.Append(date); comnt.Append("</span></h5><p>"); comnt.Append((row["CommentText"]).ToString()); comnt.Append("</p></div>"); //End Building } return(comnt.ToString()); //End Refresh }
private void CloseWrapper() { #region CLOSING WRAPPER int numberofPostLikes = bl.CountPostLikes(aPost); int numberofPostTags = bl.CountPostTags(aPost); //ContentArea Closing AND Wrapper oppening+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if (aPost.PostType != "Article") { concatinater.Append("<div class='clr' ></div> </div> </div><div class='commentWrapper'> "); //buttons Right concatinater.Append("<div class='btnHomePost width50% floatright '><a class='button left big floatLeft homeLikeBtn"); RateAndTagDAL dal = new RateAndTagDAL(); try { tempMemberID = Context.Session["memberID"].ToString(); } catch { tempMemberID = ClientUpdateMemberID; } aMember = new Member(tempMemberID); //Check if member not liked if (dal.PostRatingExists(aMember, aPost) == 0) { //if member not liked //concatinater.Append(" homeLikeBtn"); concatinater.Append("' title='"); concatinater.Append("Like this post"); concatinater.Append("' >"); concatinater.Append("Like"); } else { //if member is liked concatinater.Append("' title='"); concatinater.Append("Unlike this post"); concatinater.Append("' >"); concatinater.Append("Unlike"); } //Post button concatinater.Append("</a><a class='button middle big floatLeft homeCommentBtn' title='Comment on this post' >Comment</a>"); //report Button concatinater.Append("<a class='button middle big floatLeft reportPost' title='Report this post' >Report</a>"); //tag button concatinater.Append("<a class='button right big floatLeft homeTagBtn open tag' title='Tag a friend' >Tag </a>"); concatinater.Append("</div>"); List <Member> AllLikedMembers = dal.GetPeopleLikedPost(aPost); //Details Left concatinater.Append("<div class='postinfo width50% floatLeft tip'> <a title='"); foreach (var Member in AllLikedMembers) { concatinater.Append(Member.DisplayName); concatinater.Append("<br />"); } concatinater.Append("' href='#'>Likes</a>: <span class='likesCount'> " + numberofPostLikes); concatinater.Append("</span>, <a href='#'>Tags</a>: <span class='tagsCount'>" + numberofPostTags); concatinater.Append("</span>, <a class='btnViewComments' title='View all comments'>Comments</a>: <span class='commentCount'>" + bl.CountComments(aPost) + "</span> </div>"); concatinater.Append("</div>" // Wrapper End //Buiding the Comments section + "<div class='allComments'><h4>All Comments</h4></div>" //Buiding the Comments section + "<div class='commentSection' style='display:none; padding: 7px;'><div>" + "<textarea title='Write a comment...' placeholder='Write a comment...' class=' commentBox floatLeft input BorberRad3'" + " style='width: 100%; height: 30px; font-size: 0.85em; margin: 5px 0pt 7px;' rows='2' cols='20'></textarea>" + " <a class='button big floatLeft btnSendComment floatright ' style='font-size: 0.9em; margin-right: -10px; ' >Comment</a></div></div></div>"); #endregion } #endregion }