//--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// 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) }); }
/// <summary> /// Increments the reply counter for a partner call (to keep track of how well Climbfind/P.C's are going) /// </summary> /// <param name="pc"></param> /// <param name="pcr"></param> private void AddPartnerCallSubscriptionWorkItemReply(PartnerCall pc, PartnerCallReply pcr) { var item = pcWRepo.GetAll().Where(i => i.PartnerCallID == pc.ID).SingleOrDefault(); if (item != default(PartnerCallNotificationWorkItem)) { item.ReplyCount++; pcWRepo.Update(item); } var p = pcRepo.GetAll().Where(i => i.ID == pc.ID).SingleOrDefault(); p.PartnerCallReplys.Add(pcr); pcRepo.Update(p); }
/// <summary> /// Log when someone responds to a partner call by private message /// </summary> /// <param name="pc"></param> /// <param name="message"></param> public void LogPartnerCallMessageReply(PartnerCall pc, Message message) { if (pc.UserID == message.SenderID) { throw new ArgumentException("Cannot reply to your own partner call!!"); } var pcr = new PartnerCallReply() { ID = Guid.NewGuid(), Message = message.Content, PartnerCallID = pc.ID, TypeID = (byte)PartnerCallReplyType.Message, Utc = DateTime.UtcNow, UserID = message.SenderID }; AddPartnerCallSubscriptionWorkItemReply(pc, pcr); }
/// <summary> /// Log when someone responds to a partner call by public comment /// </summary> /// <param name="post"></param> /// <param name="postComment"></param> public void LogPartnerCallCommentReply(Post post, PostComment postComment) { //-- Can't reply to yourself. if (post.UserID != postComment.UserID) { var pc = pcRepo.GetByID(post.ID); var pcr = new PartnerCallReply() { ID = Guid.NewGuid(), Message = postComment.Message, PartnerCallID = post.ID, TypeID = (byte)PartnerCallReplyType.Comment, Utc = DateTime.UtcNow, UserID = postComment.UserID }; AddPartnerCallSubscriptionWorkItemReply(pc, pcr); } }