コード例 #1
0
        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);
        }
コード例 #2
0
		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);
		}
コード例 #3
0
        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);
		}