public virtual NotificationEmailRecipientEntity FromModel(string emailAddress, NotificationRecipientType recipientType)
        {
            EmailAddress  = emailAddress;
            RecipientType = recipientType;

            return(this);
        }
Esempio n. 2
0
 public void SendVideoBattleCompleteNotification(User user, VideoBattle videoBattle, NotificationRecipientType recipientTypeUser)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 3
0
        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);
        }