public string PostRatingNotifications() { string notification = ""; NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetPostRatingNotificationsForAMember(aMember); ArrayList ArrayPosts; for (int i = 0; i < NotificationsList.Count; ++i) { #region PostRating List<Member> MemberList = new List<Member>(); Member aFriend = new Member(NotificationsList[i].MemberId); MemberList = notificationDAL.GetMemberDisplayName(aFriend); List<Post> PostList = new List<Post>(); Post aPost = new Post(NotificationsList[i].PostId); PostList = notificationDAL.GetPostType(aPost); if (PostList[0].PostType == "Event") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Event_Post aEvent_Post; aEvent_Post = (Event_Post)ArrayPosts[i]; PostList = new List<Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List<Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aEvent_Post.EventName.Length > 30) { postDisplayText = aEvent_Post.EventName.Substring(0, 30) + "..."; } else { postDisplayText = aEvent_Post.EventName; } notification += MemberList[0].DisplayName + " liked your event '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "Text") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Text_Post aText_Post; aText_Post = (Text_Post)ArrayPosts[0]; PostList = new List<Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List<Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aText_Post.PostText.Length > 30) { postDisplayText = aText_Post.PostText.Substring(0, 30) + "..."; } else { postDisplayText = aText_Post.PostText; } notification += MemberList[0].DisplayName + " liked your post '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "Photo") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Photo_Post aPhoto_Post; aPhoto_Post = (Photo_Post)ArrayPosts[0]; PostList = new List<Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List<Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aPhoto_Post.PhotoCaption.Length > 30) { postDisplayText = aPhoto_Post.PhotoCaption.Substring(0, 30) + "..."; } else { postDisplayText = aPhoto_Post.PhotoCaption; } notification += MemberList[0].DisplayName + " liked your photo '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "Article") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Article_Post aArticle_Post; aArticle_Post = (Article_Post)ArrayPosts[0]; PostList = new List<Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List<Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aArticle_Post.Title.Length > 30) { postDisplayText = aArticle_Post.Title.Substring(0, 30) + "..."; } else { postDisplayText = aArticle_Post.Title; } notification += MemberList[0].DisplayName + " liked your article '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "Video") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Video_Post aVideo_Post; aVideo_Post = (Video_Post)ArrayPosts[0]; PostList = new List<Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List<Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aVideo_Post.VideoCaption.Length > 30) { postDisplayText = aVideo_Post.VideoCaption.Substring(0, 30) + "..."; } else { postDisplayText = aVideo_Post.VideoCaption; } notification += MemberList[0].DisplayName + " liked your video '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "File") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); File_Post aFile_Post; aFile_Post = (File_Post)ArrayPosts[0]; PostList = new List<Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List<Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aFile_Post.FileCaption.Length > 30) { postDisplayText = aFile_Post.FileCaption.Substring(0, 30) + "..."; } else { postDisplayText = aFile_Post.FileCaption; } notification += MemberList[0].DisplayName + " liked your file post '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } #endregion } return notification; }
public string PostRatingNotifications() { string notification = ""; NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetPostRatingNotificationsForAMember(aMember); ArrayList ArrayPosts; for (int i = 0; i < NotificationsList.Count; ++i) { #region PostRating List <Member> MemberList = new List <Member>(); Member aFriend = new Member(NotificationsList[i].MemberId); MemberList = notificationDAL.GetMemberDisplayName(aFriend); List <Post> PostList = new List <Post>(); Post aPost = new Post(NotificationsList[i].PostId); PostList = notificationDAL.GetPostType(aPost); if (PostList[0].PostType == "Event") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Event_Post aEvent_Post; aEvent_Post = (Event_Post)ArrayPosts[i]; PostList = new List <Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List <Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aEvent_Post.EventName.Length > 30) { postDisplayText = aEvent_Post.EventName.Substring(0, 30) + "..."; } else { postDisplayText = aEvent_Post.EventName; } notification += MemberList[0].DisplayName + " liked your event '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "Text") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Text_Post aText_Post; aText_Post = (Text_Post)ArrayPosts[0]; PostList = new List <Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List <Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aText_Post.PostText.Length > 30) { postDisplayText = aText_Post.PostText.Substring(0, 30) + "..."; } else { postDisplayText = aText_Post.PostText; } notification += MemberList[0].DisplayName + " liked your post '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "Photo") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Photo_Post aPhoto_Post; aPhoto_Post = (Photo_Post)ArrayPosts[0]; PostList = new List <Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List <Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aPhoto_Post.PhotoCaption.Length > 30) { postDisplayText = aPhoto_Post.PhotoCaption.Substring(0, 30) + "..."; } else { postDisplayText = aPhoto_Post.PhotoCaption; } notification += MemberList[0].DisplayName + " liked your photo '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "Article") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Article_Post aArticle_Post; aArticle_Post = (Article_Post)ArrayPosts[0]; PostList = new List <Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List <Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aArticle_Post.Title.Length > 30) { postDisplayText = aArticle_Post.Title.Substring(0, 30) + "..."; } else { postDisplayText = aArticle_Post.Title; } notification += MemberList[0].DisplayName + " liked your article '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "Video") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); Video_Post aVideo_Post; aVideo_Post = (Video_Post)ArrayPosts[0]; PostList = new List <Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List <Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aVideo_Post.VideoCaption.Length > 30) { postDisplayText = aVideo_Post.VideoCaption.Substring(0, 30) + "..."; } else { postDisplayText = aVideo_Post.VideoCaption; } notification += MemberList[0].DisplayName + " liked your video '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } else if (PostList[0].PostType == "File") { aPost = new Post(NotificationsList[i].PostId, PostList[0].PostType); ArrayPosts = notificationDAL.GetPostCaption(aPost); File_Post aFile_Post; aFile_Post = (File_Post)ArrayPosts[0]; PostList = new List <Post>(); aPost = new Post(NotificationsList[i].PostId); PostList = new List <Post>(); PostList = notificationDAL.GetPostCreateDate(aPost); string postDisplayText = ""; if (aFile_Post.FileCaption.Length > 30) { postDisplayText = aFile_Post.FileCaption.Substring(0, 30) + "..."; } else { postDisplayText = aFile_Post.FileCaption; } notification += MemberList[0].DisplayName + " liked your file post '" + postDisplayText + "' which you posted " + FormatDateTime(PostList[0].CreateDate) + "\n\n"; } #endregion } return(notification); }