Exemple #1
0
        public void LikeAPost(string sessionMemberID, 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 = sessionMemberID;
            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);

            //Updating all Clients
            Clients.updatePostLikeCount(numberofPostLikes, postID);
        }
Exemple #2
0
        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
        }