Exemplo n.º 1
0
        public IPagedList<QueuedMessage> GetMessages(MessageQueueQuery searchQuery)
        {
            var queryOver = _session.QueryOver<QueuedMessage>().Where(message => message.Site == _site);
            if (searchQuery.From.HasValue)
                queryOver = queryOver.Where(message => message.CreatedOn >= searchQuery.From);
            if (searchQuery.To.HasValue)
                queryOver = queryOver.Where(message => message.CreatedOn <= searchQuery.To);
            if (!string.IsNullOrWhiteSpace(searchQuery.FromQuery))
                queryOver =
                    queryOver.Where(message => message.FromAddress.IsInsensitiveLike(searchQuery.FromQuery, MatchMode.Anywhere) || message.FromName.IsInsensitiveLike(searchQuery.FromQuery, MatchMode.Anywhere));
            if (!string.IsNullOrWhiteSpace(searchQuery.ToQuery))
                queryOver =
                    queryOver.Where(message => message.ToAddress.IsInsensitiveLike(searchQuery.ToQuery, MatchMode.Anywhere) || message.ToName.IsInsensitiveLike(searchQuery.ToQuery, MatchMode.Anywhere));

            if (!string.IsNullOrWhiteSpace(searchQuery.Subject))
                queryOver = queryOver.Where(message => message.Subject.IsInsensitiveLike(searchQuery.Subject, MatchMode.Anywhere));

            return queryOver.OrderBy(message => message.CreatedOn).Desc.Paged(searchQuery.Page, _siteSettings.DefaultPageSize);
        }
Exemplo n.º 2
0
 public ViewResult Index(MessageQueueQuery searchQuery)
 {
     ViewData["data"] = _messageQueueAdminService.GetMessages(searchQuery);
     return View(searchQuery);
 }