Beispiel #1
0
 public SmsMessage(string body, IEnumerable <string>?recipients)
 {
     Body = body;
     if (recipients != null)
     {
         Recipients.AddRange(recipients.Where(x => !string.IsNullOrWhiteSpace(x)));
     }
 }
 public void AddRecipients(List <RecipientDto> recipientDtos)
 {
     if (!_subscriptions.Any())
     {
         Recipients.AddRange(recipientDtos);
         return;
     }
     foreach (RecipientDto recipient in recipientDtos)
     {
         if (_subscriptions.Any(x => x.Customer.Contact.Email == recipient.EmailAddress))
         {
             Recipients.Add(recipient);
         }
     }
 }
Beispiel #3
0
        public override NotificationEntity FromModel(Notification notification, PrimaryKeyResolvingMap pkMap)
        {
            var emailNotification = notification as EmailNotification;

            if (emailNotification != null)
            {
                From = emailNotification.From;
                To   = emailNotification.To;

                if (emailNotification.CC != null && emailNotification.CC.Any())
                {
                    if (Recipients.IsNullCollection())
                    {
                        Recipients = new ObservableCollection <NotificationEmailRecipientEntity>();
                    }
                    Recipients.AddRange(emailNotification.CC.Select(cc => AbstractTypeFactory <NotificationEmailRecipientEntity> .TryCreateInstance()
                                                                    .FromModel(cc, NotificationRecipientType.Cc)));
                }

                if (emailNotification.BCC != null && emailNotification.BCC.Any())
                {
                    if (Recipients.IsNullCollection())
                    {
                        Recipients = new ObservableCollection <NotificationEmailRecipientEntity>();
                    }
                    Recipients.AddRange(emailNotification.BCC.Select(bcc => AbstractTypeFactory <NotificationEmailRecipientEntity> .TryCreateInstance()
                                                                     .FromModel(bcc, NotificationRecipientType.Bcc)));
                }

                if (emailNotification.Attachments != null && emailNotification.Attachments.Any())
                {
                    Attachments = new ObservableCollection <EmailAttachmentEntity>(emailNotification.Attachments.Select(a =>
                                                                                                                        AbstractTypeFactory <EmailAttachmentEntity> .TryCreateInstance().FromModel(a)));
                }
            }

            return(base.FromModel(notification, pkMap));
        }
Beispiel #4
0
 public void SetRecipients(List <string> toEmails)
 {
     Recipients.AddRange(toEmails.Select(a => RockEmailMessageRecipient.CreateAnonymous(a, null)));
 }
Beispiel #5
0
 public void SetRecipients(string toEmails)
 {
     Recipients.AddRange(toEmails.SplitDelimitedValues().ToList().Select(a => RockEmailMessageRecipient.CreateAnonymous(a, null)));
 }
Beispiel #6
0
 public void AddRecipients(List <string> recipients)
 {
     Recipients.AddRange(recipients);
 }