Example #1
0
        public async Task <PagedResultDto <AuditLog> > GetAll(EventFilterDto filter)
        {
            var query = Repository.AsQueryable();

            if (string.IsNullOrWhiteSpace(filter.Sorting))
            {
                filter.Sorting = nameof(AuditLog.ExecutionTime) + " desc";
            }
            if (CurrentUser.Id != filter.UserId && !await AuthorizationService.IsGrantedAsync("AbpIdentity.Users.Create"))
            {
                filter.UserId = CurrentUser.Id;
            }

            if (filter.UserId.HasValue)
            {
                query = query.Where(k => k.UserId == filter.UserId);
            }
            if (filter.StartDate.HasValue)
            {
                query = query.Where(k => k.ExecutionTime >= filter.StartDate);
            }
            if (filter.EndDate.HasValue)
            {
                query = query.Where(k => k.ExecutionTime <= filter.EndDate);
            }
            return(new PagedResultDto <AuditLog>(
                       await query.CountAsync(),
                       await query.OrderBy(d => d.ExecutionTime)
                       .Skip(filter.SkipCount)
                       .Take(filter.MaxResultCount).ToListAsync()
                       ));
        }
        public async Task <IEnumerable <EventDto> > GetEvents(EventFilterDto filter)
        {
            var eventResult = await _eventsRepository.GetEvents(filter.StartDate, filter.EndDate);

            return(eventResult.Select(x => new EventDto(x))
                   .ToList());
        }
        public async Task <PagedResultDto <OrganizationUnit> > All(EventFilterDto filter)
        {
            var query = Repository.GetDbSet().AsQueryable();

            if (CurrentUser.Id != filter.UserId && !await AuthorizationService.IsGrantedAsync("AbpIdentity.Users.Create"))
            {
                filter.UserId = CurrentUser.Id;
            }
            if (!string.IsNullOrWhiteSpace(filter.Filter))
            {
                query = query.Where(k => k.DisplayName.ToLower().Contains(filter.Filter.ToLower()));
            }

            if (filter.StartDate.HasValue)
            {
                query = query.Where(k => k.CreationTime >= filter.StartDate);
            }
            if (filter.EndDate.HasValue)
            {
                query = query.Where(k => k.CreationTime <= filter.EndDate);
            }
            var r = await query.ToListAsync();

            return(new PagedResultDto <OrganizationUnit>(r.Count, r));
        }
Example #4
0
 internal IPagedList <T> FindPaged <T, U>(EventFilterDto eventFilterDto) where T : BaseEventDto, new() where U : BaseEvent
 {
     return(_modelContext.Set <U>()
            .Where(ExpressionQueryBuilder.BuildWhere <U>(eventFilterDto))
            .OrderBy(x => x.Start)
            .Select(x => new T()
     {
         Id = x.Id, Theme = x.Theme, Start = x.Start, End = x.End, City = x.City, CountryId = x.CountryId
     })
            .ToPagedList(eventFilterDto.Page, eventFilterDto.PageSize));
 }
Example #5
0
        protected override IQuery <Event> ApplyWhereClause(IQuery <Event> query, EventFilterDto filter)
        {
            throw new NotImplementedException();

            /*
             * if (string.IsNullOrWhiteSpace(filter.Email))
             * {
             *     return query;
             * }
             * return query.Where(new SimplePredicate(nameof(AppUser.Email), ValueComparingOperator.Equal, filter.Email));
             */
        }
        public async Task <PagedResultDto <AbpDzNotificationInfo> > GetAll(EventFilterDto filter)
        {
            if (!CurrentUser.IsAuthenticated)
            {
                return(new PagedResultDto <AbpDzNotificationInfo>(0, Array.Empty <AbpDzNotificationInfo>()));
            }
            var repo = GetRepository();

            var Config      = this.ServiceProvider.GetService(typeof(AbpDzNotificationServiceConfig)) as AbpDzNotificationServiceConfig;
            var query       = repo.AsQueryable();
            var permissions = new List <string>();

            if (filter.Checked == true)
            {
                await this.Register();
            }


            if (CurrentUser.Id != filter.UserId && !await AuthorizationService.IsGrantedAsync("AbpIdentity.Users.Create"))
            {
                filter.UserId = CurrentUser.Id;
            }
            foreach (var item in Config.NotifyPermissions)
            {
                if (await this.AuthorizationService.IsGrantedAsync(item.Key))
                {
                    permissions.Add(item.Key);
                }
            }

            if (permissions.Count > 0)
            {
                query = query.Where(k => permissions.Contains(k.RecipientPermission));
            }
            if (filter.UserId.HasValue)
            {
                query = query.Where(k => k.RecipientId == filter.UserId);
            }
            if (filter.StartDate.HasValue)
            {
                query = query.Where(k => k.CreationTime >= filter.StartDate);
            }
            if (filter.EndDate.HasValue)
            {
                query = query.Where(k => k.CreationTime <= filter.EndDate);
            }
            return(new SummaryPagedResultDto <AbpDzNotificationInfo>(
                       await query.CountAsync(),
                       await query.OrderByDescending(k => k.CreationTime).Skip(filter.SkipCount).Take(filter.MaxResultCount).ToListAsync()
                       // await query.Where(k => k.State == AbpDzMessageState.Unread).CountAsync()

                       ));
        }
Example #7
0
 public ActionResult PagedList(EventFilterDto eventFilterDto)
 {
     ViewBag.FilterDto = eventFilterDto;
     return(PartialView(WebConstants.VIEW_PAGED_LIST, GetService().ReadAdministrationPaged(eventFilterDto)));
 }
Example #8
0
 public IPagedList <SeminarDto> ReadAdministrationPaged(EventFilterDto eventFilterDto)
 {
     return(_baseEventDao.FindPaged <SeminarDto, Seminar>(eventFilterDto));
 }