예제 #1
0
        public IPagedList <Webpage> Search(WebpageSearchQuery searchQuery)
        {
            IQueryOver <Webpage, Webpage> query = _session.QueryOver <Webpage>().Where(x => x.Parent.Id == searchQuery.ParentId);

            if (!string.IsNullOrWhiteSpace(searchQuery.Query))
            {
                query = query.Where(x => x.Name.IsInsensitiveLike(searchQuery.Query, MatchMode.Anywhere));
            }

            return(query.Paged(searchQuery.Page));
        }
예제 #2
0
        public IPagedList <MediaFile> GetFilesForFolder(MediaCategorySearchModel searchModel)
        {
            IQueryOver <MediaFile, MediaFile> query = _session.QueryOver <MediaFile>();

            query = searchModel.Id.HasValue
                ? query.Where(file => file.MediaCategory.Id == searchModel.Id)
                : query.Where(file => file.MediaCategory == null);
            if (!string.IsNullOrWhiteSpace(searchModel.SearchText))
            {
                query = query.Where(file =>
                                    file.FileName.IsInsensitiveLike(searchModel.SearchText, MatchMode.Anywhere)
                                    ||
                                    file.Title.IsInsensitiveLike(searchModel.SearchText, MatchMode.Anywhere)
                                    ||
                                    file.Description.IsInsensitiveLike(searchModel.SearchText, MatchMode.Anywhere)
                                    );
            }
            query = query.OrderBy(searchModel.SortBy);

            return(query.Paged(searchModel.Page, _mediaSettings.MediaPageSize));
        }
예제 #3
0
        public IPagedList <Log> GetEntriesPaged(LogSearchQuery searchQuery)
        {
            using (new SiteFilterDisabler(_session))
            {
                IQueryOver <Log, Log> query = BaseQuery();
                if (searchQuery.Type.HasValue)
                {
                    query = query.Where(log => log.Type == searchQuery.Type);
                }

                if (!string.IsNullOrWhiteSpace(searchQuery.Message))
                {
                    query =
                        query.Where(
                            log =>
                            log.Message.IsInsensitiveLike(searchQuery.Message, MatchMode.Anywhere));
                }

                if (!string.IsNullOrWhiteSpace(searchQuery.Detail))
                {
                    query = query.Where(log => log.Detail.IsInsensitiveLike(searchQuery.Detail, MatchMode.Anywhere));
                }

                if (searchQuery.SiteId.HasValue)
                {
                    query = query.Where(log => log.Site.Id == searchQuery.SiteId);
                }

                if (searchQuery.From.HasValue)
                {
                    query = query.Where(log => log.CreatedOn >= searchQuery.From);
                }
                if (searchQuery.To.HasValue)
                {
                    query = query.Where(log => log.CreatedOn <= searchQuery.To);
                }

                return(query.Paged(searchQuery.Page));
            }
        }
예제 #4
0
        public IPagedList <User> GetUsersPaged(UserSearchQuery searchQuery)
        {
            IQueryOver <User, User> query = _session.QueryOver <User>();

            if (!string.IsNullOrWhiteSpace(searchQuery.Email))
            {
                query =
                    query.Where(
                        user =>
                        user.Email.IsInsensitiveLike(searchQuery.Email, MatchMode.Anywhere));
            }

            if (!string.IsNullOrWhiteSpace(searchQuery.FirstName))
            {
                query =
                    query.Where(
                        user =>
                        user.FirstName.IsInsensitiveLike(searchQuery.FirstName, MatchMode.Anywhere));
            }

            if (!string.IsNullOrWhiteSpace(searchQuery.LastName))
            {
                query =
                    query.Where(
                        user =>
                        user.LastName.IsInsensitiveLike(searchQuery.LastName, MatchMode.Anywhere));
            }


            if (searchQuery.UserRoleId != null)
            {
                UserRole role = null;
                query = query.JoinAlias(user => user.Roles, () => role).Where(() => role.Id == searchQuery.UserRoleId);
            }

            return(query.Paged(searchQuery.Page));
        }
예제 #5
0
        public IPagedList <PageTemplate> Search(PageTemplateSearchQuery query)
        {
            IQueryOver <PageTemplate, PageTemplate> queryOver = _session.QueryOver <PageTemplate>();

            return(queryOver.Paged(query.Page));
        }
예제 #6
0
        public IPagedList <Warehouse> Search(WarehouseSearchModel searchModel)
        {
            IQueryOver <Warehouse, Warehouse> queryOver = _session.QueryOver <Warehouse>();

            return(queryOver.Paged(searchModel.Page));
        }