private IEnumerable <MessageOutbound> generateMessages(Post post, Comment comment) { IEnumerable <PostSubscription> subscriptions = GetSubscriptions(post); List <MessageOutbound> messages = new List <MessageOutbound>(); //TODO: (erikpo) Once the plugin model is done, get this from the plugin int retryCount = 4; foreach (PostSubscription subscription in subscriptions) { string userName = subscription.User.GetDisplayName(); MessageOutbound message = new MessageOutbound { ID = Guid.NewGuid(), To = !string.IsNullOrEmpty(userName) ? string.Format("{0} <{1}>", userName, subscription.User.Email) : subscription.User.Email, Subject = string.Format(getPhrase("Messages.Formats.ReplySubject", site.LanguageDefault, "RE: {0}"), post.Title), Body = generateMessageBody(post, comment, site), RemainingRetryCount = retryCount }; messages.Add(message); } return(messages); }
private IEnumerable <MessageOutbound> generateMessages(IPluginContext pluginContext, Post post, Comment comment) { ILocalizationService localizationService = pluginContext.Container.Resolve <ILocalizationService>(); IPostService postService = pluginContext.Container.Resolve <IPostService>(); IEnumerable <PostSubscription> subscriptions = postService.GetSubscriptions(post); List <MessageOutbound> messages = new List <MessageOutbound>(); Site site = pluginContext.Container.Resolve <Site>(); AbsolutePathHelper absolutePathHelper = pluginContext.Container.Resolve <AbsolutePathHelper>(); int retryCount = int.Parse(pluginContext.Plugin.Settings["RetryCount"]); foreach (PostSubscription subscription in subscriptions) { MessageOutbound message = new MessageOutbound { ID = Guid.NewGuid(), To = string.Format("{0} <{1}>", subscription.User.DisplayName, subscription.User.Email), Subject = string.Format(getPhrase(localizationService, "Messages.Formats.ReplySubject", site.LanguageDefault, "RE: {0}"), post.Title), Body = generateMessageBody(post, comment, site, localizationService, absolutePathHelper), RemainingRetryCount = retryCount }; messages.Add(message); } return(messages); }
public void Save(MessageOutbound message) { using (TransactionScope transaction = new TransactionScope()) { oxite_MessageOutbound m = ( from mo in context.oxite_MessageOutbounds where mo.MessageOutboundID == message.ID select mo ).First(); m.SentDate = message.Sent; m.RemainingRetryCount = (byte)message.RemainingRetryCount; m.IsSending = false; m.LastAttemptDate = DateTime.Now.ToUniversalTime(); context.SubmitChanges(); transaction.Complete(); } }
private IEnumerable <MessageOutbound> generateMessages(Post post, Comment comment) { IEnumerable <PostSubscription> subscriptions = repository.GetSubscriptions(post); List <MessageOutbound> messages = new List <MessageOutbound>(); foreach (PostSubscription subscription in subscriptions) { MessageOutbound message = new MessageOutbound { ID = Guid.NewGuid(), To = string.Format("{0} <{1}>", subscription.User.DisplayName, subscription.User.Email), Subject = string.Format(getPhrase("ReplySubjectFormat", site.LanguageDefault, "RE: {0}"), post.Title), Body = generateMessageBody(post, comment), //TODO: (erikpo) Need to figure out the appropriate place to put this value so it doesn't need to be hardcoded RemainingRetryCount = 1 }; messages.Add(message); } return(messages); }
public void Save(MessageOutbound message) { repository.Save(message); }
private TeleComSystem TeleComSystem(MessageInbound messageInbound, AcmeProcessingWorkflow acmeProcessingWorkflow, MessageOutbound messageOutbound) { return(new TeleComSystem(messageInbound, messageOutbound, acmeProcessingWorkflow)); }
public static TeleComSystem Messages(MessageInbound messageInbound, AcmeProcessingWorkflow acmeProcessingWorkflow, MessageOutbound messageOutbound) { return(new TeleComSystem(messageInbound, messageOutbound, acmeProcessingWorkflow)); }