public string FriendRequestAcceptedNotifications() { string notification = ""; NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetFriendRequestAcceptedNotificationsForAMember(aMember); for (int i = 0; i < NotificationsList.Count; ++i) { #region FriendRequestAccepted //memberlist List <Member> MemberList = new List <Member>(); Member aFriend = new Member(NotificationsList[i].MemberId); MemberList = notificationDAL.GetMemberDisplayName(aFriend); string FriendDisplayName = MemberList[0].DisplayName; notification += FriendDisplayName + " accepted your friend request\n\n"; #endregion } return(notification); }
public string MessageNotifications() { string notification = ""; NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetMessageNotificationForAMember(aMember); for (int i = 0; i < NotificationsList.Count; ++i) { List <Member> MemberList = new List <Member>(); Member aFriend = new Member(NotificationsList[i].MemberId); MemberList = notificationDAL.GetMemberDisplayName(aFriend); Message aMessage = new Message(NotificationsList[i].MessageId); aMessage = notificationDAL.GetMessageDateTime(aMessage); notification += MemberList[0].DisplayName + " sent you a message at " + FormatDateTime(aMessage.DateTime) + "\n\n"; } return(notification); }
public void TagAPost(string sessionMemberID, int postID, string friendID) { NotificationDAL notificationDAL = new NotificationDAL(); //Tag method here Member m; Post p; bool isTagged = tagDAL.TagFriend(p = new Post(postID), m = new Member(friendID)); // INSERT NOTIFICATION string friendId = friendID; Member aFriend = new Member(friendId); string memberId = sessionMemberID; Member aMember = new Member(memberId); aPost.PostId = postID; notificationDAL.InsertTagNotification(aMember, aFriend, aPost); //return number of tags int numberoftags = newsFeedDAL.CountPostTags(aPost); Clients.updateTagCount(numberoftags, postID); }
public int CountEventNotifications() { NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetEventNotificationsForGroupMembers(); return(NotificationsList.Count); }
public int CountMessageNotifications() { NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetMessageNotificationForAMember(aMember); return(NotificationsList.Count); }
public string EventNotifications() { string notification = ""; NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetEventNotificationsForGroupMembers(); for (int i = 0; i < NotificationsList.Count; ++i) { int postId = NotificationsList[i].PostId; Post aPost = new Post(postId); List <Event_Post> EventNameList = new List <Event_Post>(); EventNameList = notificationDAL.GetEventName(aPost); string eventDisplayText = ""; if (EventNameList[0].EventName.Length > 30) { eventDisplayText = EventNameList[0].EventName.Substring(0, 30) + "..."; } else { eventDisplayText = EventNameList[0].EventName; } List <Member> GroupMembersList = new List <Member>(); Group aGroup = new Group(NotificationsList[i].GroupId); GroupMembersList = notificationDAL.GetGroupMembers(aGroup); for (int j = 0; j < GroupMembersList.Count; ++j) { string friendId = aMember.MemberId; //PERSON WHO IS LOGGED IN //CHECK TO SEE IF PE if (friendId == GroupMembersList[j].MemberId) { List <Member> MemberList = new List <Member>(); Member aFriend = new Member(NotificationsList[i].MemberId); MemberList = notificationDAL.GetMemberDisplayName(aFriend); List <Group> GroupList = new List <Group>(); Group Group = new Group(NotificationsList[i].GroupId); GroupList = notificationDAL.GetGroupDescription(Group); notification += MemberList[0].DisplayName + " created the event '" + eventDisplayText + "' in the group '" + GroupList[0].GroupDescription + "'\n\n"; } } } return(notification); }
public int CountCommentNotifications() { NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetCommentedOnPostNotification(aMember); return(NotificationsList.Count); }
public int CountFriendRequestAcceptedNotifications() { NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetFriendRequestAcceptedNotificationsForAMember(aMember); return(NotificationsList.Count); }
public int CountTagNotifications() { NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List <Notification> NotificationsList = new List <Notification>(); NotificationsList = notificationDAL.GetTagNotificationsForAMember(aMember); return(NotificationsList.Count); }
protected void Page_Load(object sender, EventArgs e) { Literal title = (Literal)Master.FindControl("pageTitle"); title.Text = "Messages Single View"; if (!IsPostBack) { string date = ""; if (!String.IsNullOrEmpty(Session["selectedMessageID"].ToString())) { int id = int.Parse(Session["selectedMessageID"].ToString()); // message.MessageId = id; StringBuilder concatinater = new StringBuilder(); Message message = new Message(id); DataTable aMessage = test.GetAMessage(message); NotificationDAL notificationDAL = new NotificationDAL(); notificationDAL.UpdateMessageNotificationIsRead(message); foreach (DataRow row in aMessage.Rows) { Reusable_Methods reusable_Methods = new Reusable_Methods(); date = reusable_Methods.FormatDateTime(DateTime.Parse((row["DateTime"]).ToString())); //date = Convert.ToDateTime(row["DateTime"]).ToString("M"); //Building single message view box concatinater.Append("<div class='SingleViewmsgeWrapper' id='"); concatinater.Append(row["messageID"].ToString()); //concatinater.Append("' ><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> <a class='btnMemberProfile' id='"); concatinater.Append("' ><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> <a href='#' class='btnMemberProfile replyMsge' style='font-weight:normal; font-size: 1.2em; ' id='"); concatinater.Append(row["FriendID"].ToString()); concatinater.Append("' >"); concatinater.Append(row["Friend"].ToString()); concatinater.Append("</a><span class='DateWithTime ui-corner-all floatright' style='font-size: 1.2em;' > "); concatinater.Append(date); concatinater.Append("</span></h2> </div>"); concatinater.Append("<p class=''>"); concatinater.Append(row["MessageText"].ToString()); concatinater.Append("</p></div>"); } MessageString = concatinater.ToString(); } } }
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); }
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); }
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); }
public int CountTagNotifications() { NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetTagNotificationsForAMember(aMember); return NotificationsList.Count; }
public int CountFriendRequestAcceptedNotifications() { NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetFriendRequestAcceptedNotificationsForAMember(aMember); return NotificationsList.Count; }
public int CountMessageNotifications() { NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetMessageNotificationForAMember(aMember); return NotificationsList.Count; }
public int CountCommentNotifications() { NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetCommentedOnPostNotification(aMember); return NotificationsList.Count; }
public int CountEventNotifications() { NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetEventNotificationsForGroupMembers(); return NotificationsList.Count; }
private void OpenWrapper(int i) { #region OPENING WRAPPER aPost = (Post)ArrayPosts[i]; ArrayMembers = bl.GetMemberDisplayName(aPost.MemberId); countMembers = ArrayMembers.Count; for (int a = 0; a < countMembers; ++a) { aMember = (Member)ArrayMembers[a]; NotificationDAL notificationDAL = new NotificationDAL(); Group group = new Group(aPost.GroupId); string groupDescription = notificationDAL.GetGroupDescription2(group); concatinater.Append("<div class='aPost typeOfText' id='"); concatinater.Append(aPost.PostId); concatinater.Append("'><div class='msgeHeading ui-corner-all' ><h2 class='ui-corner-all'> Posted by: <a href='#' id='"); concatinater.Append(aPost.MemberId); concatinater.Append("' class='btnMemberProfile' style='font-weight:normal; '>"); concatinater.Append(aMember.DisplayName); bool isForMember = false; string date = ""; date = reusable_Methods.FormatDateTime(aPost.CreateDate); if (aPost.MemberId == memberID) { isForMember = true; } if (GroupID == aPost.GroupId) { } else { concatinater.Append("</a> <span class='space'></span> in group: <a id='"); concatinater.Append(aPost.GroupId); concatinater.Append("' class='btnGoToGroupPage groupDesc'>"); concatinater.Append(groupDescription); } concatinater.Append("</a>"); if (isForMember) { concatinater.Append("<span class='ui-icon ui-icon-closethick floatright deletePost pointer ' title ='Delete this post' style='display:none;'></span>"); } concatinater.Append("<span class='DateWithTime ui-corner-all floatright'>"); concatinater.Append(date); //concatinater.Append(Convert.ToDateTime(aPost.CreateDate).ToString("D")); concatinater.Append("</span></h2></div> <div class='postContentArea'> <div> "); } #endregion }
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; }
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 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); }
public string EventNotifications() { string notification = ""; NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetEventNotificationsForGroupMembers(); for (int i = 0; i < NotificationsList.Count; ++i) { int postId = NotificationsList[i].PostId; Post aPost = new Post(postId); List<Event_Post> EventNameList = new List<Event_Post>(); EventNameList = notificationDAL.GetEventName(aPost); string eventDisplayText = ""; if (EventNameList[0].EventName.Length > 30) { eventDisplayText = EventNameList[0].EventName.Substring(0, 30) + "..."; } else { eventDisplayText = EventNameList[0].EventName; } List<Member> GroupMembersList = new List<Member>(); Group aGroup = new Group(NotificationsList[i].GroupId); GroupMembersList = notificationDAL.GetGroupMembers(aGroup); for (int j = 0; j < GroupMembersList.Count; ++j) { string friendId = aMember.MemberId; //PERSON WHO IS LOGGED IN //CHECK TO SEE IF PE if (friendId == GroupMembersList[j].MemberId) { List<Member> MemberList = new List<Member>(); Member aFriend = new Member(NotificationsList[i].MemberId); MemberList = notificationDAL.GetMemberDisplayName(aFriend); List<Group> GroupList = new List<Group>(); Group Group = new Group(NotificationsList[i].GroupId); GroupList = notificationDAL.GetGroupDescription(Group); notification += MemberList[0].DisplayName + " created the event '" + eventDisplayText + "' in the group '" + GroupList[0].GroupDescription + "'\n\n"; } } } 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; }
public string FriendRequestSentNotifications() { string notification = ""; NewsfeedDAL newsFeedDAL = new NewsfeedDAL(); NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetFriendRequestSentNotificationsForAMember(aMember); for (int i = 0; i < NotificationsList.Count; ++i) { #region FriendRequestSent //memberlist List<Member> MemberList = new List<Member>(); Member aFriend = new Member(NotificationsList[i].MemberId); MemberList = notificationDAL.GetMemberDisplayName(aFriend); string FriendDisplayName = MemberList[0].DisplayName; notification += FriendDisplayName + " sent you a friend request\n\n"; #endregion } return notification; }
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; }
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); }
public string MessageNotifications() { string notification = ""; NotificationDAL notificationDAL = new NotificationDAL(); List<Notification> NotificationsList = new List<Notification>(); NotificationsList = notificationDAL.GetMessageNotificationForAMember(aMember); for (int i = 0; i < NotificationsList.Count; ++i) { List<Member> MemberList = new List<Member>(); Member aFriend = new Member(NotificationsList[i].MemberId); MemberList = notificationDAL.GetMemberDisplayName(aFriend); Message aMessage = new Message(NotificationsList[i].MessageId); aMessage = notificationDAL.GetMessageDateTime(aMessage); notification += MemberList[0].DisplayName + " sent you a message at " + FormatDateTime(aMessage.DateTime) + "\n\n"; } return notification; }
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; }
private void GenerateProfile(Member aMember) { #region RIGHT COLUMN GET ALL JOINED GROUPS //JOINED GROUPS============================================================================== Reusable_Methods reusable_Methods = new Reusable_Methods(aMember); allgroups = reusable_Methods.RightColumnGetAllJoinedGroups(); //============================================================================================ #endregion #region RIGHT COLUMN MEMBER INFORMATION //MEMBER INFORMATION ON RIGHT COLUMN========================================================================== //MEMBER INFO AND PROFILE MemberInfoDAL dal = new MemberInfoDAL(); // Member member = new Member(); aMember = dal.GetAllMemberInfo(aMember); profilesMemnerID.Value = aMember.MemberId; //Set the ImageUrl to the path of the handler with the querystring value ProfileImage.ImageUrl = "ProfilePicHandler.ashx?id=" + SSTCryptographer.Decrypt(aMember.MemberId); //call the method to get the image information and display it in Label Control //======================================================================================================= #endregion #region MAIN COLUMN MEMBER INFORMATION //MEMBER INFORMATION ON MAIN DISPLAY========================================================================== StringBuilder memberData = new StringBuilder(); memberData.Append("<tr><td style='font-weight: bold;' > "); memberData.Append("First Name:</td><td>"); memberData.Append(aMember.FirstName); memberData.Append("</td></tr> <tr><td style='font-weight: bold;'>"); memberData.Append("Last Name:</td><td>"); memberData.Append(aMember.LastName); memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > "); memberData.Append("Display Name:</td><td>"); memberData.Append(aMember.DisplayName); memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > "); memberData.Append("Email:</td><td>"); memberData.Append(aMember.Email); memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > "); memberData.Append("Description:</td><td>"); memberData.Append(aMember.Description); memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > "); memberData.Append("Campus:</td><td>"); memberData.Append(aMember.Campus); memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > "); memberData.Append("Account Type:</td><td>"); memberData.Append(aMember.MemberType); memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > "); if (aMember.IsOnline == false) { memberData.Append("Online Status:</td><td style='color:red;'>"); memberData.Append("Offline"); memberData.Append("</td></tr>"); } else { memberData.Append("Online Status:</td><td style='color:green;'>"); memberData.Append("Online"); memberData.Append("</td></tr>"); } memberDataMain = memberData.ToString(); #endregion #region MAIN COLUMN MOST RECENT POST DATE //MOST RECENT POST DATE ON MAIN DISPLAY========================================================================== NotificationDAL notificationDAL = new NotificationDAL(); StringBuilder recentPostDate = new StringBuilder(); Post aPost = new Post(); aPost = notificationDAL.GetMostRecentPostDate(aMember); if (aPost.CreateDate == DateTime.Parse("1/1/0001 12:00:00 AM")) { reusable_Methods = new Reusable_Methods(); string date = reusable_Methods.FormatDateTime(aPost.CreateDate); recentPostDate.Append("<p style='font-size: 1.2em; color: #A3ADB5;'>Most recent post date<span style='color: #0e93be;'> - "); recentPostDate.Append("No posts"); recentPostDate.Append("</span></p>"); mostRecentPostDate = recentPostDate.ToString(); } else { reusable_Methods = new Reusable_Methods(); string date = reusable_Methods.FormatDateTime(aPost.CreateDate); recentPostDate.Append("<p style='font-size: 1.2em; color: #A3ADB5;'>Most recent post date<span style='color: #0e93be;'> - "); recentPostDate.Append(date); recentPostDate.Append("</span></p>"); mostRecentPostDate = recentPostDate.ToString(); } #endregion #region MAIN ACTUAL DISPLAY NAME MemberInfoDAL memberInfoDAL = new MemberInfoDAL(); Member actualMember = new Member(Context.Session["memberID"].ToString()); aMember = memberInfoDAL.GetActualDisplayName(actualMember); actualMemberDisplayName = aMember.DisplayName; #endregion }