Beispiel #1
0
        public string TagNotifications()
        {
            string notification = "";

            NewsfeedDAL newsFeedDAL = new NewsfeedDAL();

            NotificationDAL notificationDAL = new NotificationDAL();

            List <Notification> NotificationsList = new List <Notification>();

            NotificationsList = notificationDAL.GetTagNotificationsForAMember(aMember);


            for (int i = 0; i < NotificationsList.Count; ++i)
            {
                #region TagRating
                //memberlist
                List <Member> MemberList = new List <Member>();
                Member        aFriend    = new Member(NotificationsList[i].MemberId);
                MemberList = notificationDAL.GetMemberDisplayName(aFriend);

                string FriendDisplayName = MemberList[0].DisplayName;

                //memberslist
                List <Member> PostOwnerMemberList = new List <Member>();
                Post          aPost = new Post(NotificationsList[i].PostId);
                PostOwnerMemberList = notificationDAL.GetPostOwner(aPost);


                List <Post> PostList = new List <Post>();
                PostList = notificationDAL.GetPostCreateDate(aPost);

                string memberLoggedOn = aMember.MemberId;

                if (memberLoggedOn == PostOwnerMemberList[0].MemberId)
                {
                    notification += FriendDisplayName + " tagged you on your post which you posted " + FormatDateTime(PostList[0].CreateDate) + " \n\n";
                }
                else if (FriendDisplayName == PostOwnerMemberList[0].DisplayName)
                {
                    notification += "You were tagged on " + PostOwnerMemberList[0].DisplayName + "'s post by " + FriendDisplayName + " " + FormatDateTime(PostList[0].CreateDate) + "\n\n";
                }
                else
                {
                    notification += FriendDisplayName + " tagged you on " + PostOwnerMemberList[0].DisplayName + "'s post which was posted " + FormatDateTime(PostList[0].CreateDate) + " \n\n";
                }


                #endregion
            }
            return(notification);
        }
Beispiel #2
0
        public string CommentRatingNotifications()
        {
            string notification = "";

            NewsfeedDAL newsFeedDAL = new NewsfeedDAL();

            NotificationDAL notificationDAL = new NotificationDAL();

            List <Notification> NotificationsList = new List <Notification>();

            NotificationsList = notificationDAL.GetCommentRatingNotificationsForAMember(aMember);


            for (int i = 0; i < NotificationsList.Count; ++i)
            {
                #region CommentRating
                //memberlist
                List <Member> MemberList = new List <Member>();
                Member        aFriend    = new Member(NotificationsList[i].MemberId);
                MemberList = notificationDAL.GetMemberDisplayName(aFriend);

                string FriendDisplayName = MemberList[0].DisplayName;

                List <Comments> CommentList = new List <Comments>();
                Comments        aComment    = new Comments(NotificationsList[i].CommentId);
                CommentList = notificationDAL.GetCommentTextAndCreateDate(aComment);

                //memberslist
                MemberList = new List <Member>();
                Post aPost = new Post(CommentList[0].PostId);
                MemberList = notificationDAL.GetPostOwner(aPost);

                string postDisplayText = "";
                if (CommentList[0].CommentText.Length > 30)
                {
                    postDisplayText = CommentList[0].CommentText.Substring(0, 30) + "...";
                }
                else
                {
                    postDisplayText = CommentList[0].CommentText;
                }

                notification += FriendDisplayName + " liked your comment '" + postDisplayText + "' which you posted " + FormatDateTime(CommentList[0].CreateDate) + " on " + MemberList[0].DisplayName + " post\n\n";
                #endregion
            }
            return(notification);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public string TagNotifications()
        {
            string notification = "";

            NewsfeedDAL newsFeedDAL = new NewsfeedDAL();

            NotificationDAL notificationDAL = new NotificationDAL();

            List<Notification> NotificationsList = new List<Notification>();
            NotificationsList = notificationDAL.GetTagNotificationsForAMember(aMember);

            for (int i = 0; i < NotificationsList.Count; ++i)
            {
                #region TagRating
                //memberlist
                List<Member> MemberList = new List<Member>();
                Member aFriend = new Member(NotificationsList[i].MemberId);
                MemberList = notificationDAL.GetMemberDisplayName(aFriend);

                string FriendDisplayName = MemberList[0].DisplayName;

                //memberslist
                List<Member> PostOwnerMemberList = new List<Member>();
                Post aPost = new Post(NotificationsList[i].PostId);
                PostOwnerMemberList = notificationDAL.GetPostOwner(aPost);

                List<Post> PostList = new List<Post>();
                PostList = notificationDAL.GetPostCreateDate(aPost);

                string memberLoggedOn = aMember.MemberId;

                if (memberLoggedOn == PostOwnerMemberList[0].MemberId)
                {
                    notification += FriendDisplayName + " tagged you on your post which you posted " + FormatDateTime(PostList[0].CreateDate) + " \n\n";
                }
                else if (FriendDisplayName == PostOwnerMemberList[0].DisplayName)
                {
                    notification += "You were tagged on " + PostOwnerMemberList[0].DisplayName + "'s post by " + FriendDisplayName + " " + FormatDateTime(PostList[0].CreateDate) + "\n\n";
                }
                else
                {
                    notification += FriendDisplayName + " tagged you on " + PostOwnerMemberList[0].DisplayName + "'s post which was posted " + FormatDateTime(PostList[0].CreateDate) + " \n\n";
                }

                #endregion
            }
            return notification;
        }
Beispiel #5
0
        public string CommentNotifications()
        {
            string notification = "";

            NewsfeedDAL newsFeedDAL = new NewsfeedDAL();

            NotificationDAL notificationDAL = new NotificationDAL();

            List<Notification> NotificationsList = new List<Notification>();
            NotificationsList = notificationDAL.GetCommentedOnPostNotification(aMember);

            for (int i = 0; i < NotificationsList.Count; ++i)
            {
                #region Comment notification
                //memberlist
                List<Member> MemberList = new List<Member>();
                Member aFriend = new Member(NotificationsList[i].MemberId);
                MemberList = notificationDAL.GetMemberDisplayName(aFriend);

                string FriendDisplayName = MemberList[0].DisplayName;

                //memberslist
                MemberList = new List<Member>();
                Post aPost = new Post(NotificationsList[i].PostId);
                MemberList = notificationDAL.GetPostOwner(aPost);

                List<Post> PostList = new List<Post>();
                PostList = notificationDAL.GetPostCreateDate(aPost);

                List<Post> PostTypeList = new List<Post>();
                PostTypeList = notificationDAL.GetPostType(aPost);

                string postType = "";
                if (PostTypeList[0].PostType == "Event")
                {
                    postType = "event";
                }
                else if (PostTypeList[0].PostType == "Text")
                {
                    postType = "post";
                }
                else if (PostTypeList[0].PostType == "Photo")
                {
                    postType = "photo";
                }
                else if (PostTypeList[0].PostType == "Article")
                {
                    postType = "article";
                }
                else if (PostTypeList[0].PostType == "Video")
                {
                    postType = "video";
                }
                else if (PostTypeList[0].PostType == "File")
                {
                    postType = "file post";
                }
                notification += FriendDisplayName + " commented on your " + postType + " which you posted " + FormatDateTime(PostList[0].CreateDate) + " \n\n";
                #endregion
            }
            return notification;
        }
Beispiel #6
0
        public string CommentRatingNotifications()
        {
            string notification = "";

            NewsfeedDAL newsFeedDAL = new NewsfeedDAL();

            NotificationDAL notificationDAL = new NotificationDAL();

            List<Notification> NotificationsList = new List<Notification>();
            NotificationsList = notificationDAL.GetCommentRatingNotificationsForAMember(aMember);

            for (int i = 0; i < NotificationsList.Count; ++i)
            {
                #region CommentRating
                //memberlist
                List<Member> MemberList = new List<Member>();
                Member aFriend = new Member(NotificationsList[i].MemberId);
                MemberList = notificationDAL.GetMemberDisplayName(aFriend);

                string FriendDisplayName = MemberList[0].DisplayName;

                List<Comments> CommentList = new List<Comments>();
                Comments aComment = new Comments(NotificationsList[i].CommentId);
                CommentList = notificationDAL.GetCommentTextAndCreateDate(aComment);

                //memberslist
                MemberList = new List<Member>();
                Post aPost = new Post(CommentList[0].PostId);
                MemberList = notificationDAL.GetPostOwner(aPost);

                string postDisplayText = "";
                if (CommentList[0].CommentText.Length > 30)
                {
                    postDisplayText = CommentList[0].CommentText.Substring(0, 30) + "...";
                }
                else
                {
                    postDisplayText = CommentList[0].CommentText;
                }

                notification += FriendDisplayName + " liked your comment '" + postDisplayText + "' which you posted " + FormatDateTime(CommentList[0].CreateDate) + " on " + MemberList[0].DisplayName + " post\n\n";
                #endregion
            }
            return notification;
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public string CommentNotifications()
        {
            string notification = "";

            NewsfeedDAL newsFeedDAL = new NewsfeedDAL();

            NotificationDAL notificationDAL = new NotificationDAL();

            List <Notification> NotificationsList = new List <Notification>();

            NotificationsList = notificationDAL.GetCommentedOnPostNotification(aMember);


            for (int i = 0; i < NotificationsList.Count; ++i)
            {
                #region Comment notification
                //memberlist
                List <Member> MemberList = new List <Member>();
                Member        aFriend    = new Member(NotificationsList[i].MemberId);
                MemberList = notificationDAL.GetMemberDisplayName(aFriend);

                string FriendDisplayName = MemberList[0].DisplayName;

                //memberslist
                MemberList = new List <Member>();
                Post aPost = new Post(NotificationsList[i].PostId);
                MemberList = notificationDAL.GetPostOwner(aPost);

                List <Post> PostList = new List <Post>();
                PostList = notificationDAL.GetPostCreateDate(aPost);

                List <Post> PostTypeList = new List <Post>();
                PostTypeList = notificationDAL.GetPostType(aPost);

                string postType = "";
                if (PostTypeList[0].PostType == "Event")
                {
                    postType = "event";
                }
                else if (PostTypeList[0].PostType == "Text")
                {
                    postType = "post";
                }
                else if (PostTypeList[0].PostType == "Photo")
                {
                    postType = "photo";
                }
                else if (PostTypeList[0].PostType == "Article")
                {
                    postType = "article";
                }
                else if (PostTypeList[0].PostType == "Video")
                {
                    postType = "video";
                }
                else if (PostTypeList[0].PostType == "File")
                {
                    postType = "file post";
                }
                notification += FriendDisplayName + " commented on your " + postType + " which you posted " + FormatDateTime(PostList[0].CreateDate) + " \n\n";
                #endregion
            }
            return(notification);
        }