public ActionResult QueuedEmailList(GridCommand command, QueuedEmailListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageQueue)) return AccessDeniedView(); DateTime? startDateValue = (model.SearchStartDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeHelper.CurrentTimeZone); DateTime? endDateValue = (model.SearchEndDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1); var queuedEmails = _queuedEmailService.SearchEmails(model.SearchFromEmail, model.SearchToEmail, startDateValue, endDateValue, model.SearchLoadNotSent, model.SearchMaxSentTries, true, command.Page - 1, command.PageSize, model.SearchSendManually); var gridModel = new GridModel<QueuedEmailModel> { Data = queuedEmails.Select(x => { var m = x.ToModel(); m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc); if (x.SentOnUtc.HasValue) m.SentOn = _dateTimeHelper.ConvertToUserTime(x.SentOnUtc.Value, DateTimeKind.Utc); return m; }), Total = queuedEmails.TotalCount }; return new JsonResult { Data = gridModel }; }
public ActionResult GoToEmailByNumber(QueuedEmailListModel model) { var queuedEmail = _queuedEmailService.GetQueuedEmailById(model.GoDirectlyToNumber); if (queuedEmail != null) return RedirectToAction("Edit", "QueuedEmail", new { id = queuedEmail.Id }); else return List(); }
public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageQueue)) return AccessDeniedView(); var model = new QueuedEmailListModel(); return View(model); }
public ActionResult QueuedEmailList(GridCommand command, QueuedEmailListModel model) { var gridModel = new GridModel<QueuedEmailModel>(); if (_permissionService.Authorize(StandardPermissionProvider.ManageMessageQueue)) { DateTime? startDateValue = (model.SearchStartDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeHelper.CurrentTimeZone); DateTime? endDateValue = (model.SearchEndDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1); var q = new SearchEmailsQuery { EndTime = endDateValue, From = model.SearchFromEmail, MaxSendTries = model.SearchMaxSentTries, OrderByLatest = true, PageIndex = command.Page - 1, PageSize = command.PageSize, SendManually = model.SearchSendManually, StartTime = startDateValue, To = model.SearchToEmail, UnsentOnly = model.SearchLoadNotSent }; var queuedEmails = _queuedEmailService.SearchEmails(q); gridModel.Data = queuedEmails.Select(x => { var m = x.ToModel(); m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc); if (x.SentOnUtc.HasValue) m.SentOn = _dateTimeHelper.ConvertToUserTime(x.SentOnUtc.Value, DateTimeKind.Utc); return m; }); gridModel.Total = queuedEmails.TotalCount; } else { gridModel.Data = Enumerable.Empty<QueuedEmailModel>(); NotifyAccessDenied(); } return new JsonResult { Data = gridModel }; }