public ActionResult SendMessageToVolunteersByDisaster(SendMessageToAllVolunteersByDisasterViewModel model) { if (!ModelState.IsValid) { PopulateSendMessageViewModel(model); return View("CreateMessage", model); } var recipientCriterion = new RecipientCriterion(model.DisasterId, model.ClusterId); var message = new Message(model.Subject, model.Message); _messageSvc.SendMessageToDisasterVolunteers(recipientCriterion, message); return View(model); }
public ActionResult SendMessageToVolunteersByDisaster(SendMessageToAllVolunteersByDisasterViewModel model) { if (!ModelState.IsValid) { PopulateSendMessageViewModel(model); return View("CreateMessage", model); } var sender = model.DisasterName + " - Coordinator"; var recipientCriterion = new RecipientCriterion(model.DisasterId, model.ClusterId, model.ClusterCoordinatorsOnly, model.CheckedInOnly); var message = new Message(model.Subject, model.Message); _messageSvc.SendMessageToDisasterVolunteers(message, recipientCriterion, sender); return View(model); }
public void SendMessageToDisasterVolunteers(Message message, RecipientCriterion recipientCriterion, string senderDisplayName = null) { var volunteers = _adminSvc.GetVolunteersForDate(recipientCriterion.DisasterId, DateTime.Today, recipientCriterion.ClusterCoordinatorsOnly, recipientCriterion.CheckedInOnly); var messageRecipients = new List<MessageRecipient>(); foreach (var volunteer in volunteers) { messageRecipients.Add(new MessageRecipient { EmailAddress = volunteer.Email, Name = string.Format("{0} {1}", volunteer.FirstName, volunteer.LastName) }); } _msgCoordinatorSvc.SendMessage(message, messageRecipients, senderDisplayName); }
public void SendMessageToDisasterVolunteers(RecipientCriterion recipientCriterion, Message message) { var volunteers = _adminSvc.GetVolunteersForDate(recipientCriterion.DisasterId, DateTime.Today); var messageRecipients = new List<MessageRecipient>(); foreach (var volunteer in volunteers) { messageRecipients.Add(new MessageRecipient { EmailAddress = volunteer.Email, Name = string.Format("{0} {1}", volunteer.FirstName, volunteer.LastName) }); } _msgCoordinatorSvc.SendMessage(message, messageRecipients); }
public void SendMessageToDisasterVolunteers(Message message, RecipientCriterion recipientCriterion, string senderDisplayName = null) { var volunteers = _adminSvc.GetVolunteersForDate(recipientCriterion.DisasterId, DateTime.Today, recipientCriterion.ClusterCoordinatorsOnly, recipientCriterion.CheckedInOnly); var messageRecipients = new List <MessageRecipient>(); foreach (var volunteer in volunteers) { messageRecipients.Add(new MessageRecipient { EmailAddress = volunteer.Email, Name = string.Format("{0} {1}", volunteer.FirstName, volunteer.LastName) }); } _msgCoordinatorSvc.SendMessage(message, messageRecipients, senderDisplayName); }
public void SendMessageToDisasterVolunteers(RecipientCriterion recipientCriterion, Message message) { var volunteers = _adminSvc.GetVolunteersForDate(recipientCriterion.DisasterId, DateTime.Today); var messageRecipients = new List <MessageRecipient>(); foreach (var volunteer in volunteers) { messageRecipients.Add(new MessageRecipient { EmailAddress = volunteer.Email, Name = string.Format("{0} {1}", volunteer.FirstName, volunteer.LastName) }); } _msgCoordinatorSvc.SendMessage(message, messageRecipients); }
public ActionResult SendMessageToVolunteersByDisaster(SendMessageToAllVolunteersByDisasterViewModel model) { if (!ModelState.IsValid) { PopulateSendMessageViewModel(model); return View("CreateMessage", model); } else if (model.IsSMSMessage && model.Message.Length > Constants.TwilioMessageLength) { PopulateSendMessageViewModel(model); ModelState["Message"].Errors.Add(string.Format("The message cannot have more than {0} characters when submiting as a SMS.", Constants.TwilioMessageLength)); return View("CreateMessage", model); } var sender = model.DisasterName + " - Coordinator"; var recipientCriterion = new RecipientCriterion(model.DisasterId, model.SelectedClusterIds, model.ClusterCoordinatorsOnly, model.CheckedInOnly); var message = new Message(model.Subject, model.Message) { IsSMSMessage = model.IsSMSMessage }; _messageSvc.SendMessageToDisasterVolunteers(message, recipientCriterion, sender); return View(model); }
public void SendMessageToDisasterVolunteers(RecipientCriterion recipientCriterion, Message message) { // Get volunteers for disaster where DateTime.Today between person.StartDate and person.EndDate // var volunteers = _adminSvc.GetVolunteersForDate(recipientCriterion.DisasterId, DateTime.Today); }