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 void ReplyToPartnerCall(Guid partnerCallID, Guid replyingUserID, string message) { PartnerCall call = new PartnerCallDA().GetByID(partnerCallID); if (call.CreatorUserID == replyingUserID) { throw new Exception(string.Format("You cannot reply to your own partner call. call[{0}]", call.ID)); } PartnerCallReply reply = new PartnerCallReplyDA().Insert(new PartnerCallReply { ID = Guid.NewGuid(), ReplyDateTime = DateTime.Now, ReplyingUserID = replyingUserID, PartnerCallID = partnerCallID, Message = message }); ClimberProfile poster = CFDataCache.GetClimberFromCache(call.ClimberProfileID); ClimberProfile replyer = CFDataCache.GetClimberFromCache(replyingUserID); MailMan.SendReplyToPartnerCall(call, reply, replyer, replyer.Email, poster.Email); CFLogger.RecordPartnerCallReply(replyingUserID, partnerCallID); }
protected void Page_Init(Object s, EventArgs e) { mapPlace = CFDataCache.GetPlace(ViewData.Model.ID); FeedPosts = cfController.GetPlacesLatestFeedActivity(place.ID); if (!UserLoggedIn) { UserClimbsHere = false; } else { UserClimbsHere = cfController.UserClimbAtPlace(UserID, place.ID); } Crags = (from c in cfController.GetCragsAtPlace(place.ID) orderby c.Name select c).ToList(); AuthoritySites = cfController.GetOutdoorPlacesAuthoriySites(place.ID); //-- Get contributing users if (place.DescriptionByUserID != null) { descriptionLastUpdatedByUser = CFDataCache.GetClimberFromCache(place.DescriptionByUserID.Value); } if (place.DescriptionImageFileByUserID != null) { descriptionImageFile1ByUser = CFDataCache.GetClimberFromCache(place.DescriptionImageFileByUserID.Value); } if (place.DescriptionImageFile2 != null) { descriptionImageFile2ByUser = CFDataCache.GetClimberFromCache(place.DescriptionImageFile2ByUserID.Value); } if (place.DescriptionImageFile3 != null) { descriptionImageFile3ByUser = CFDataCache.GetClimberFromCache(place.DescriptionImageFile3ByUserID.Value); } }
public void SaveClimberProfilePartnerStatus(ClimberProfile profile, byte partnerStatusID) { profile.PartnerStatusID = partnerStatusID; ClimberProfileDA da = new ClimberProfileDA(); da.Update(profile); }
protected void Page_Init(object sender, EventArgs e) { climberProfile = cfController.GetClimberProfile(UserID); climberProfile.PlacesUserClimbs = cfController.GetPlacesUserClimbs(UserID); messageBoard = cfController.GetMessageBoard(climberProfile.MessageBoardID); }
protected void Page_Init(object sender, EventArgs e) { climberProfile = cfController.GetClimberProfile(UserID); climberProfile.PlacesUserClimbs = cfController.GetPlacesUserClimbs(UserID); allPlaces = CFDataCache.AllPlaces; placesUserClimbsIDs = climberProfile.PlacesUserClimbs.Select(c => c.ID).ToList(); }
public PartnerCallReplyViewData(Guid id) { Current = new CFController().GetPartnerCall(id); if (Current != null) { PartnerCallPoster = new CFController().GetClimberProfile(Current.ClimberProfileID); } }
public PartnerCallShowReplyViewData(Guid id) { CFController cf = new CFController(); CurrentReply = cf.GetPartnerCallReply(id); CurrentCall = cf.GetPartnerCall(CurrentReply.PartnerCallID); Replier = cf.GetClimberProfile(CurrentReply.ReplyingUserID); }
protected void CreatePartnerCall_Click(object sender, EventArgs e) { //-- catch UserPartnerCallWithSamePlacesExistsException if (PeterBlum.VAM.Globals.Page.IsValid) { List <int> selectedPlaceIDs = GetSelectedPlaces(); if (selectedPlaceIDs.Count == 0) { PlacesErrorDIV.Visible = true; } else { try { PlacesErrorDIV.Visible = false; short countryID = (from c in CFDataCache.AllAreaTags where c.ID == int.Parse(AreaID.Text) select c.CountryID).SingleOrDefault(); cfController.CreatePartnerCall( new PartnerCall { ClimberProfileID = UserID, PlaceIDs = selectedPlaceIDs, CountryID = countryID, Message = NewCallMessageTxB.Text, IsIndoor = IndoorRB.Checked, ToBoulder = ToBoulderCB.Checked, ToLeadClimb = ToLeadCB.Checked, ToTopRope = ToTopRopeCB.Checked, ToAlpine = ToAlpineCB.Checked, ToTrad = ToTradCB.Checked }); // ContributeHTML = new SpecialPagesHTMLDA().GetByID(5).PageHtml; //-- If the email isn't verified we don't know if they will receive the replies ClimberProfile cp = cfController.GetClimberProfileByEmail(User.Identity.Name); List <PartnerCallSubscription> subscriptions = cfController.GetUsersPartnerCallSubscriptions(cp.ID); if (!cp.EmailVerified) { RedirectTo <ClimberProfilesController>(c => c.VerifyEmailAddress(Guid.Empty)); } else if (subscriptions.Count == 0) { NewPartnerCallMV.SetActiveView(VIEWPartnerCallPostedNowSubscribe); } else { NewPartnerCallMV.SetActiveView(VIEWPartnerCallPosted); } } catch (UserPartnerCallWithSamePlacesExistsException ex) { NewPartnerCallMV.SetActiveView(VIEWCantPostSamePlacesTwice); } } } }
protected void Page_Init(object sender, EventArgs e) { climberProfile = cfController.GetClimberProfile(UserID); climberProfile.PlacesUserClimbs = cfController.GetPlacesUserClimbs(climberProfile.ID); //messageBoard = cfController.GetMessageBoard(climberProfile.MessageBoardID); extendedProfile = cfController.GetExtendedClimberProfile(climberProfile.ID); clubs = cfController.GetClubsUserBelongsTo(climberProfile.ID); //UsersMovies = cfController.GetUsersYouTubeMovies(UserID, 3); UsersActivity = cfController.GetUsersActivity(climberProfile.ID); }
public static void SendVerifyEmailAddressEmail(ClimberProfile to) { SMTP.PostSingleMail( new CFEmail { Subject = "Verify your email on Climbfind", From = CFSettings.MailMan, To = new MailAddress(to.Email, to.FullName), Body = CFEmailBodyGenerator.GenerateEmailVerificationBody(to.MessageBoardID, to.Email) }); }
public static void SendPartnerCallNotificationEmail(ClimberProfile userReceivingNotification, PartnerCall partnerCall, string placeName, string allPlaces, string postersEmail) { SMTP.PostSingleMail(new CFEmail { Body = CFEmailBodyGenerator.GeneratePartnerCallNotificationBody(placeName, allPlaces, partnerCall.CreatorFullName, userReceivingNotification.Email, partnerCall.Message, partnerCall.ID), From = CFSettings.MailMan, Subject = string.Format("{0}'s partner call for {1}", partnerCall.CreatorFullName, placeName), To = new MailAddress(userReceivingNotification.Email, userReceivingNotification.FullName) }); }
//--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// public static void SendReplyToPartnerCall(PartnerCall partnerCall, PartnerCallReply reply, ClimberProfile replyer, string replyersEmail, string postersEmail) { SMTP.PostSingleMail(new CFEmail { Body = CFEmailBodyGenerator.GenerateReplyToPartnerCallBody(reply.ReplyingUserID, replyer.FullName, replyersEmail, partnerCall.CreatorFullName, postersEmail, reply.Message), From = new MailAddress(replyersEmail, reply.ReplyingName), Subject = "Climbfind: Reply to your partner call from " + reply.ReplyingName, To = new MailAddress(postersEmail, partnerCall.CreatorFullName) }); }
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 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) }); }
public static void SendCommentOnMyFeedPostNotification(int postID, ClimberProfile userCommenting, ClimberProfile userWhoMadePost, string comment) { SMTP.PostSingleMail(new CFEmail { Body = CFEmailBodyGenerator.GenerateCommentOnMyFeedPostNotificationBody(userCommenting.FullName, userWhoMadePost.Email, postID, comment), From = CFSettings.MailMan, Subject = string.Format("{0} commented on your post", userCommenting.FullName), To = new MailAddress(userWhoMadePost.Email, userWhoMadePost.FullName) }); }
public ActionResult UpdatePartnerStatus() { CFController cf = new CFController(); byte statusID = byte.Parse(Request.Form["PartnerStatus"].ToString()); ClimberProfile profile = cf.GetClimberProfile(UserID); cf.SaveClimberProfilePartnerStatus(profile, (byte)statusID); return(RedirectToAction("Me")); }
public void SendMessageBoardNotification(Guid recievingUserID, string message) { if (CurrentClimber.ID != recievingUserID) { ClimberProfile receiver = GetClimberProfile(recievingUserID); MailMan.SendMessageboardNotificationEmail(CurrentClimber, receiver, message); } //CFLogger.re //-- ToDO: consider logging message post. }
public void SaveClimberProfilePicture(ClimberProfile profile, string imageFileName, byte[] imageBytes) { ClimberProfileDA da = new ClimberProfileDA(); string newImageName = ImageManager.SaveRawTypeImage(imageFileName, imageBytes, profile.ID, ImageType.CP); profile.ProfilePictureFile = newImageName; da.Update(profile); CFDataCache.FlushClimberFromCache(profile.ID); }
public static void SendWatchRequestEmail(int watchClimberEntryID, ClimberProfile userSendingRequest, ClimberProfile userBeingWatched) { SMTP.PostSingleMail(new CFEmail { Body = CFEmailBodyGenerator.GenerateWatchRequestBody(userSendingRequest.ID, userSendingRequest.FullName, userBeingWatched.Email, userSendingRequest.HisHerString, watchClimberEntryID), From = CFSettings.MailMan, Subject = string.Format("{0} wants to know where you climb", userSendingRequest.FullName), To = new MailAddress(userBeingWatched.Email, userBeingWatched.FullName) }); }
public void UploadImage_Click(Object Src, EventArgs E) { if (ProfileImageUploadUC.HasFile) { ClimberProfile profile = cfController.GetClimberProfile(UserID); //-- save the image: cfController.SaveClimberProfilePicture(profile, ProfileImageUploadUC.FileName, ProfileImageUploadUC.FileBytes); RedirectTo <ClimberProfilesController>(c => c.Me()); } }
public void Page_Load(Object o, EventArgs e) { cp = cfController.GetClimberProfile(UserID); if (cp.EmailVerified) { VerifyEmailMV.SetActiveView(VIEWVerifySuccess); } else { VerifyEmailMV.SetActiveView(VIEWWhyVerify); } }
public static void SendMessageboardNotificationEmail(ClimberProfile from, ClimberProfile to, string message) { string toEmail = to.Email; SMTP.PostSingleMail( new CFEmail { Subject = string.Format("{0} posted a message on your message board", from.FullName), From = CFSettings.MailMan, To = new MailAddress(toEmail, to.FullName), Body = CFEmailBodyGenerator.GetUserMessageboardNotificationBody(from.ID, from.FullName, to.Email, message) }); }
public static void SendMessageBoardNotification(ClimberProfile userWrittenOnBoard, ClimberProfile messageBoardOwner) { string toEmail = messageBoardOwner.Email; SMTP.PostSingleMail( new CFEmail { Subject = string.Format("{0} posted a message on your message board", userWrittenOnBoard.FullName), From = CFSettings.MailMan, To = new MailAddress(toEmail, messageBoardOwner.FullName), Body = CFEmailBodyGenerator.GetMessageBoardNotificationBody(userWrittenOnBoard.FullName, messageBoardOwner.Email) }); }
public static ClimberProfile GetClimberFromCache(Guid id) { string key = "climber-" + id.ToString(); ClimberProfile cachedObject = (ClimberProfile)cache.Get(key); if (cachedObject == null) { //read the object from the db ClimberProfileDA da = new ClimberProfileDA(); cachedObject = da.GetByID(id); cache.Insert(key, cachedObject, null, Cache.NoAbsoluteExpiration, _20_Min_Span_ForClimberInCahce, CacheItemPriority.NotRemovable, null); } return(cachedObject); }
public bool UserBelongsToClub(string email, int clubID) { ClimberProfile profile = GetClimberProfileByEmail(email); if (profile == null) { return(false); } //-- No worries, person is not registered on climbfind else { //-- check if the user is already a member of the group. return(new ClubDA().UserBelongsToClub(profile.ID, clubID)); } }
protected void SubscribeToEmail_Click(Object s, EventArgs e) { ClimberProfile cp = cfController.GetClimberProfile(UserID); if (!cp.EmailVerified) { RedirectTo <ClimberProfilesController>(c => c.VerifyEmailAddress(Guid.Empty)); } else { cfController.SubscribeToPartnerCallsByEmail(UserID, place.ID); SubcsribeEmailMV.SetActiveView(VIEWSubscribedToEmail); } }
public static void SendUserMessageEmail(ClimberProfile from, ClimberProfile to, string subject, string message, Guid msgID) { string toEmail = to.Email; SMTP.PostSingleMail( new CFEmail { Subject = string.Format("{0} sent you a message on Climbfind", from.FullName), From = CFSettings.MailMan, To = new MailAddress(toEmail, to.FullName), Body = CFEmailBodyGenerator.GetUserMessageBody(from.ID, from.FullName, to.Email, subject, message, msgID) }); }
public void SendMessage(ClimberProfile receiver, string subject, string message) { UserMessage msg = new UserMessageDA().Insert( new UserMessage { ID = Guid.NewGuid(), ReceivingUserID = receiver.ID, SendingUserID = CurrentClimber.ID, Subject = subject, SentDateTime = DateTime.Now, Message = message }); MailMan.SendUserMessageEmail(CurrentClimber, receiver, subject, message, msg.ID); }
protected string GetPhotoHtml(string descriptionImageUrl, ClimberProfile cp, string altTextFormaterString) { if (descriptionImageUrl == "/images/places/outdoor-rock-climbing/main/default.jpg" || cp == null) { return(string.Format(@"<a href=""/Media/EditOutdoorLocationPictures/{0}""><img src=""/images/places/outdoor-rock-climbing/main/default.jpg"" class=""float-left"" alt=""click to change picture"" style=""margin-top:0px"" /></a>", place.ID)); } else { string imageHtml = string.Format(@"<img src=""{0}"" class=""float-left"" alt=""", descriptionImageUrl); imageHtml += string.Format(altTextFormaterString, place.Name.RemoveSpecialChars()); return(imageHtml + string.Format(@""" style=""margin-top:0px"" /> <div class=""byUser"">Photo submitted by {0}</div>", CFControls.ClimberProfileLink(this, cp))); } }