public virtual NotificationEmailRecipientEntity FromModel(string emailAddress, NotificationRecipientType recipientType) { EmailAddress = emailAddress; RecipientType = recipientType; return(this); }
public void SendVideoBattleCompleteNotification(User user, VideoBattle videoBattle, NotificationRecipientType recipientTypeUser) { throw new System.NotImplementedException(); }
public int SendVideoBattleCompleteNotification(User customer, VideoBattle videoBattle, NotificationRecipientType recipientType, int languageId, int storeId) { var store = _storeService.GetStoreById(storeId) ?? _storeContext.CurrentStore; languageId = EnsureLanguageIsActive(languageId, store.Id); var messageTemplate = GetLocalizedActiveMessageTemplate(recipientType == NotificationRecipientType.Participant ? "MobSocial.VideoBattleCompleteNotificationToParticipants" : "MobSocial.VideoBattleCompleteNotificationToVoters", store.Id); if (messageTemplate == null) { return(0); } var emailAccount = GetEmailAccountOfMessageTemplate(messageTemplate, languageId); //tokens var tokens = new List <Token> { new Token("VideoBattle.Title", videoBattle.Name, true), new Token("VideoBattle.Url", string.Format("{0}/VideoBattles/VideoBattle/{1}", store.Url, videoBattle.Id), true), }; _messageTokenProvider.AddStoreTokens(tokens, store, emailAccount); _messageTokenProvider.AddUserTokens(tokens, customer); //event notification _eventPublisher.MessageTokensAdded(messageTemplate, tokens); var toEmail = customer.Email; var toName = customer.GetFullName().ToTitleCase(); return(SendNotification(messageTemplate, emailAccount, languageId, tokens, toEmail, toName)); }
public int SendVideoBattleCompleteNotification(User customer, VideoBattle videoBattle, NotificationRecipientType recipientType, int languageId, int storeId) { var store = _storeService.GetStoreById(storeId) ?? _storeContext.CurrentStore; languageId = EnsureLanguageIsActive(languageId, store.Id); var messageTemplate = GetLocalizedActiveMessageTemplate(recipientType == NotificationRecipientType.Participant ? "MobSocial.VideoBattleCompleteNotificationToParticipants" : "MobSocial.VideoBattleCompleteNotificationToVoters", store.Id); if (messageTemplate == null) return 0; var emailAccount = GetEmailAccountOfMessageTemplate(messageTemplate, languageId); //tokens var tokens = new List<Token> { new Token("VideoBattle.Title", videoBattle.Name, true), new Token("VideoBattle.Url", string.Format("{0}/VideoBattles/VideoBattle/{1}", store.Url, videoBattle.Id) , true), }; _messageTokenProvider.AddStoreTokens(tokens, store, emailAccount); _messageTokenProvider.AddUserTokens(tokens, customer); //event notification _eventPublisher.MessageTokensAdded(messageTemplate, tokens); var toEmail = customer.Email; var toName = customer.GetFullName().ToTitleCase(); return SendNotification(messageTemplate, emailAccount, languageId, tokens, toEmail, toName); }