public FeedPostComment SaveFeedPostComment(FeedPostComment comment) { comment.PostedDateTime = DateTime.Now; FeedPostComment newComment = new FeedPostCommentDA().Insert(comment); FeedClimbingPost post = new FeedClimbingPostDA().GetByID(comment.FeedPostID); //-- Send notification to the poster FeedSettings postersFeedSettings = GetUsersFeedViewSettings(post.UserID); if (postersFeedSettings.NotifyOnPostComment && comment.UserID != post.UserID) { MailMan.SendCommentOnMyFeedPostNotification(post.ID, comment.User, post.User, comment.Message); } List <Guid> uniqueCommentingUserIDs = (from c in post.Comments where c.UserID != post.UserID select c.UserID).Distinct().ToList(); //-- Send notifications to other commentors foreach (Guid userID in uniqueCommentingUserIDs) { FeedSettings commentorsFeedSettings = GetUsersFeedViewSettings(userID); if (commentorsFeedSettings.NotifyOnPostsICommentedOn && comment.UserID != userID) { MailMan.SendCommentOnAFeedPostICommentedOnNotification(post.ID, comment.User, post.User, CFDataCache.GetClimberFromCache(userID), comment.Message); } } return(newComment); }
public FeedClimbingPost SaveFeedIntroductionPost(FeedClimbingPost newPost) { //-- Add that place to user's profile List <int> placeIDs = (from c in GetPlacesUserClimbs(newPost.UserID) select c.ID).ToList(); if (!placeIDs.Contains(newPost.PlaceID)) { SavePlaceUserClimbsAt(newPost.UserID, newPost.PlaceID); } //-- Save the post newPost.PostedDateTime = DateTime.Now; newPost.ClimbingDateTime = DateTime.Now; newPost.TagID = 52; FeedClimbingPost post = new FeedClimbingPostDA().Insert(newPost); //-- Send off notifications List <ClimberProfile> usersSubscribedToPlace = new ClimberProfileDA().GetPartnerEmailSubscribedUsers(newPost.PlaceID); Place place = CFDataCache.GetPlace(newPost.PlaceID); ClimberProfile poster = CFDataCache.GetClimberFromCache(newPost.UserID); foreach (ClimberProfile cp in usersSubscribedToPlace) { MailMan.SendFeedPostIntroductionNotificationEmail(cp, poster, post, place.Name); } //-- Subscribe them to this place too SubscribeToPartnerCallsByEmail(newPost.UserID, place.ID); return(post); }
public FeedClimbingPost SaveFeedPost(FeedClimbingPost newPost) { newPost.PostedDateTime = DateTime.Now; FeedClimbingPost post = new FeedClimbingPostDA().Insert(newPost); List <ClimberProfile> usersSubscribedToPlace = new ClimberProfileDA().GetPartnerEmailSubscribedUsers(newPost.PlaceID); Place place = CFDataCache.GetPlace(newPost.PlaceID); ClimberProfile poster = CFDataCache.GetClimberFromCache(newPost.UserID); foreach (ClimberProfile cp in usersSubscribedToPlace) { MailMan.SendPartnerFeedPostNotificationEmail(cp, poster, post, place.Name); } return(post); }