Exemplo n.º 1
0
        /// <summary>
        ///     PagedResult from repository
        /// </summary>
        private PagedResult <Meet> GetPaged(
            int pageIndex, int pageSize, string keywords, string ownerId, DateTime?activateDate, MeetState?state)
        {
            var searchCriteria = new SearchCriteria <Meet>();

            searchCriteria.AddFilterCriteria(t => t.OwnerId == ownerId);
            if (state != null)
            {
                searchCriteria.AddFilterCriteria(t => t.State == (int)state);
            }
            if (activateDate != null)
            {
                var activateDateVal = activateDate.Value.Date;
                searchCriteria.AddFilterCriteria(t =>
                                                 (t.MeetActivate == null && t.StartTime.Date == activateDateVal) ||
                                                 (t.MeetActivate != null && t.MeetActivate.StartTime.Date == activateDateVal));
            }
            if (!string.IsNullOrEmpty(keywords))
            {
                searchCriteria.AddFilterCriteria(
                    t => t.Subject.Contains(keywords) ||
                    t.Body.Contains(keywords) ||
                    (t.MeetActivate == null && t.Place.Contains(keywords)) ||
                    (t.MeetActivate != null && t.MeetActivate.Place.Contains(keywords)));
            }
            searchCriteria.AddSortCriteria(
                new ExpressionSortCriteria <Meet, DateTime>(s => s.StartTime, SortDirection.Descending));
            searchCriteria.PagingCriteria = new PagingCriteria(pageIndex, pageSize);
            var pagedResult = _repository.FindPaged(searchCriteria);

            return(pagedResult);
        }
Exemplo n.º 2
0
        public PagedResult <OrgUserPagedDto> GetPaged(int pageIndex, int pageSize, int?state, string keywords)
        {
            var searchCriteria = new SearchCriteria <OrgUser>();

            if (state != null)
            {
                searchCriteria.AddFilterCriteria(t => t.State == state);
            }
            if (!string.IsNullOrEmpty(keywords))
            {
                searchCriteria.AddFilterCriteria(t => t.Name.Contains(keywords) ||
                                                 t.Account.Contains(keywords) ||
                                                 t.Code.Contains(keywords) ||
                                                 t.Mobile.Contains(keywords));
            }
            //排除admin
            searchCriteria.AddFilterCriteria(t => t.Code != "adminitrator");
            searchCriteria.AddSortCriteria(
                new ExpressionSortCriteria <OrgUser, string>(s => s.Name, SortDirection.Ascending));
            searchCriteria.AddSortCriteria(
                new ExpressionSortCriteria <OrgUser, DateTime>(s => s.CreateTime, SortDirection.Descending));
            searchCriteria.PagingCriteria = new PagingCriteria(pageIndex, pageSize);
            var pagedResult = _repository.FindPaged(searchCriteria);
            var resultList  = pagedResult.Entities.Select(i => Mapper.Map <OrgUserPagedDto>(i)).ToList();

            return(new PagedResult <OrgUserPagedDto>(pagedResult.Count, resultList));
        }
Exemplo n.º 3
0
        public IList <MeetSignforDto> GetMeetSubSignfors(string meetId, string keywords)
        {
            var searchCriteria = new SearchCriteria <MeetSignfor>();

            searchCriteria.AddFilterCriteria(t => t.MeetId == meetId);
            if (!string.IsNullOrEmpty(keywords))
            {
                searchCriteria.AddFilterCriteria(
                    t => t.Feedback.Contains(keywords) ||
                    t.Meet.Subject.Contains(keywords) ||
                    t.Meet.Body.Contains(keywords) ||
                    (t.OrgUser != null && t.OrgUser.Name.Contains(keywords)) ||
                    (t.Meet.MeetActivate == null && t.Meet.Place.Contains(keywords)) ||
                    (t.Meet.MeetActivate != null && t.Meet.MeetActivate.Place.Contains(keywords)));
            }
            var pagedResult = _repository.FindPaged(searchCriteria);

            return(pagedResult.Entities.Select(i => Mapper.Map <MeetSignforDto>(i)).ToList());
        }