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 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; }