protected override async Task HandleCore(NotifyVolunteersCommand message)
        {
            // TODO: both SMS and email sent to the same email service?

            // push messages to azure
            foreach (var recipient in message.ViewModel.SmsRecipients)
            {
                var queuedSms = new QueuedSmsMessage
                {
                    Recipient = recipient,
                    Message   = message.ViewModel.SmsMessage
                };
                var sms = JsonConvert.SerializeObject(queuedSms);
                await _storageService.SendMessageAsync(QueueStorageService.Queues.SmsQueue, sms);
            }

            foreach (var recipient in message.ViewModel.EmailRecipients)
            {
                var queuedEmail = new QueuedEmailMessage
                {
                    Recipient   = recipient,
                    Message     = message.ViewModel.EmailMessage,
                    HtmlMessage = message.ViewModel.HtmlMessage,
                    Subject     = message.ViewModel.Subject
                };
                var email = JsonConvert.SerializeObject(queuedEmail);
                await _storageService.SendMessageAsync(QueueStorageService.Queues.EmailQueue, email);
            }
        }
Ejemplo n.º 2
0
 public async Task SendSmsAsync(string phoneNumber, string message)
 {
     var queuedSms = new QueuedSmsMessage
     {
         Recipient = phoneNumber,
         Message   = message
     };
     var sms = JsonConvert.SerializeObject(queuedSms);
     await _storageService.SendMessageAsync(QueueStorageService.Queues.SmsQueue, sms);
 }
Ejemplo n.º 3
0
        public async Task <JsonResult> AddWatermark(WatermarkQueueDto dto)
        {
            if (dto.Pictures.Count == 0)
            {
                return(Json(new { message = "Döküman seçimi yapılmadı!", success = false }));
            }
            else
            {
                var serielizeObject = JsonConvert.SerializeObject(dto);
                var base64          = Convert.ToBase64String(Encoding.UTF8.GetBytes(serielizeObject));
                await _queueStorageSevice.SendMessageAsync(base64);

                return(Json(new { message = "Yazı ekleme işlemi başarılı", success = true }));
            }
        }