public ActionResult Requeue(QueuedEmailModel queuedEmailModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageQueue)) return AccessDeniedView(); var queuedEmail = _queuedEmailService.GetQueuedEmailById(queuedEmailModel.Id); if (queuedEmail == null) return RedirectToAction("List"); var requeuedEmail = new QueuedEmail { Priority = queuedEmail.Priority, From = queuedEmail.From, FromName = queuedEmail.FromName, To = queuedEmail.To, ToName = queuedEmail.ToName, CC = queuedEmail.CC, Bcc = queuedEmail.Bcc, Subject = queuedEmail.Subject, Body = queuedEmail.Body, CreatedOnUtc = DateTime.UtcNow, EmailAccountId = queuedEmail.EmailAccountId, SendManually = queuedEmail.SendManually }; _queuedEmailService.InsertQueuedEmail(requeuedEmail); NotifySuccess(_localizationService.GetResource("Admin.System.QueuedEmails.Requeued")); return RedirectToAction("Edit", requeuedEmail.Id); }
public ActionResult SendNow(QueuedEmailModel queuedEmailModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageQueue)) return AccessDeniedView(); var queuedEmail = _queuedEmailService.GetQueuedEmailById(queuedEmailModel.Id); if (queuedEmail == null) return RedirectToAction("List"); var result = _queuedEmailService.SendEmail(queuedEmail); if (result) NotifySuccess(_localizationService.GetResource("Admin.Common.TaskSuccessfullyProcessed")); else NotifyError(_localizationService.GetResource("Common.Error.SendMail")); return RedirectToAction("Edit", queuedEmail.Id); }
public ActionResult Edit(QueuedEmailModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageQueue)) return AccessDeniedView(); var email = _queuedEmailService.GetQueuedEmailById(model.Id); if (email == null) return RedirectToAction("List"); if (ModelState.IsValid) { email = model.ToEntity(email); _queuedEmailService.UpdateQueuedEmail(email); NotifySuccess(_localizationService.GetResource("Admin.System.QueuedEmails.Updated")); return continueEditing ? RedirectToAction("Edit", new { id = email.Id }) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form model.CreatedOn = _dateTimeHelper.ConvertToUserTime(email.CreatedOnUtc, DateTimeKind.Utc); if (email.SentOnUtc.HasValue) model.SentOn = _dateTimeHelper.ConvertToUserTime(email.SentOnUtc.Value, DateTimeKind.Utc); return View(model); }