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 static SyndicationItem GetSyndicationItem(this FeedClimbingPost p)
        {
            Place  place     = CFDataCache.GetPlace(p.PlaceID);
            string placeLink = string.Format("{0}{1}", CFSettings.WebAddress, place.ClimbfindUrl);

            return(new SyndicationItem(
                       string.Format("{0} wants to climb {1} @ {2}, {3}", p.User.FullName, p.ClimbingDateTime.ToString("dd MMM"),
                                     place.ShortName, FlagList.GetCountryName((Nation)place.CountryID), placeLink),
                       string.Format("{0}", p.Message),
                       new Uri(placeLink),
                       string.Format("ClimbingPost[{0}]", p.ID),
                       p.PostedDateTime)
            {
                PublishDate = p.PostedDateTime
            });
        }
        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);
        }
Example #4
0
 public static void SendFeedPostIntroductionNotificationEmail(ClimberProfile userReceivingNotification,
                                                              ClimberProfile userPosting, FeedClimbingPost post, string placeName)
 {
     SMTP.PostSingleMail(new CFEmail
     {
         Body = CFEmailBodyGenerator.GenerateFeedIntroductionPostNotificationBody(placeName,
                                                                                  userPosting.FullName, userPosting.ID, userReceivingNotification.Email, post.Message, post.ID),
         From    = CFSettings.MailMan,
         Subject = string.Format("New climber @ {0}", placeName),
         To      = new MailAddress(userReceivingNotification.Email, userReceivingNotification.FullName)
     });
 }
Example #5
0
 public static void SendPartnerFeedPostNotificationEmail(ClimberProfile userReceivingNotification,
                                                         ClimberProfile userPosting, FeedClimbingPost post, string placeName)
 {
     SMTP.PostSingleMail(new CFEmail
     {
         Body = CFEmailBodyGenerator.GenerateFeedPartnerPostNotificationBody(placeName, post.ClimbingDateTime,
                                                                             userPosting.FullName, userReceivingNotification.Email, post.Message, post.ID),
         From    = CFSettings.MailMan,
         Subject = string.Format("{0}'s post for {1} @ {2}", userPosting.FullName, post.ClimbingDateTime.ToCFDateString(), placeName),
         To      = new MailAddress(userReceivingNotification.Email, userReceivingNotification.FullName)
     });
 }
 public void DeleteFeedClimbingPost(FeedClimbingPost post)
 {
     new FeedClimbingPostDA().Delete(post.ID);
 }