Beispiel #1
0
        public PageDTO <TEntity> BaseGetFiltering(PageRequestDto pageRequestDto)
        {
            Expression <Func <TEntity, bool> > predicate = x => true;

            if (pageRequestDto.MinPrice == null && pageRequestDto.MaxPrice != null)
            {
                predicate = x => x.Price <= pageRequestDto.MaxPrice;
            }
            if (pageRequestDto.MaxPrice == null && pageRequestDto.MinPrice != null)
            {
                predicate = x => x.Price <= pageRequestDto.MinPrice;
            }
            if (pageRequestDto.MaxPrice != null && pageRequestDto.MinPrice != null)
            {
                predicate = x => x.Price >= pageRequestDto.MinPrice && x.Price <= pageRequestDto.MaxPrice;
            }

            var sorter = GetSorter(pageRequestDto.SortingColumnName);
            PageDTO <TEntity> pageDTO = new PageDTO <TEntity>();

            pageDTO.WebEntity = _baseCrudRepository.GetModelsSorting(predicate, pageRequestDto.PageNumber,
                                                                     pageRequestDto.PageSize, sorter, pageRequestDto.AscendingOrDescending)
                                .ToList();
            pageDTO.Count = _baseCrudRepository.Count(predicate);

            return(pageDTO);
        }
        GetUserSharedPropertyAsync([FromQuery] int userId, [FromQuery] PageRequestDto requestDto, CancellationToken cancellationToken)
        {
            var query = await new PageResultDto <SharedProperty>(
                ModelService.Queryable
                .Include(r => r.Property)
                .Include(r => r.Property.PropertyType)
                .Include(r => r.Property.PropertyPrice)
                .Include(r => r.Property.PropertyImage)
                .Include(r => r.SocialNetwork)
                .Where(r => r.UserAccountId == userId), requestDto)
                        .GetPage(cancellationToken);

            var list = query.Items
                       .GroupBy(r => new { r.PropertyId, r.SocialNetworkId })
                       .Select(p => new UserSharedPropertyDto
            {
                PropertyId    = p.First().PropertyId,
                PropertyType  = p.First().Property.PropertyType.Name,
                PropertyTitle = p.First().Property.Title,
                PropertyPrice = p.First().Property.PropertyPrice.Price,
                PropertyImage = p.First().Property.PropertyImage.OrderBy(r => r.Priority).Select(r => new PropertyWebAppImageDto {
                    Id = r.Id, ImagePath = r.ImagePath, TumbPath = r.TumbPath
                }).FirstOrDefault(),
                UserAccountId      = p.First().UserAccountId,
                SocialNetworkId    = p.First().SocialNetworkId,
                SocialNetworkTitle = p.First().SocialNetwork?.Name,
                SocialNetworkIcon  = p.First().SocialNetwork?.Icon,
                RefererUrl         = p.First().RefererUrl,
                ClickCount         = p.Sum(r => r.ClickCount),
            }).ToList();

            return(list);
        }
        public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
        {
            var values = JsonHelper.Deserialize <MappingDto>(Mappings);

            foreach (var mapping in values.Mappings)
            {
                switch (mapping.Alias)
                {
                case MappingAliases.JustGiving.EventId:
                    break;
                }
            }

            const string Username = "******";
            const string Password = "******";
            var          page     = new PageRequestDto();

            if (!JustGivingService.ValidateCredentials(Username, Password))
            {
                return(WorkflowExecutionStatus.Failed);
            }

            var pageUrl = CreatePage(Username, Password, page);

            return(string.IsNullOrEmpty(pageUrl) ? WorkflowExecutionStatus.Failed : WorkflowExecutionStatus.Completed);
        }
Beispiel #4
0
        public IActionResult GetMyTopicList([FromBody] PageRequestDto pageRequest)
        {
            var topicBiz  = new TopicBiz();
            var topisList = topicBiz.GetListByUserId(UserID, pageRequest);

            if (topisList.Count < 1)
            {
                return(Failed(ErrorCode.Empty, "暂无数据!"));
            }
            var response = topisList.Select(a => a.ToDto <GetMyTopicListItemDto>()).ToList();

            return(Success(response));
        }
        private string CreatePage(string username, string password, PageRequestDto page)
        {
            try
            {
                if (JustGivingService.ValidateCredentials(username, password))
                {
                    return(JustGivingService.CreatePage(page));
                }
            }
            catch (Exception ex)
            {
                _loggingService.Log(string.Format("Failure creating JustGiving fundraising page: {0}", ex.Message), LogLevel.Error);
            }

            return(string.Empty);
        }
Beispiel #6
0
        public IActionResult GetPage([FromQuery] PageRequestDto pageRequestDto)
        {
            var result = _plumbingService.BaseGetFiltering(pageRequestDto);

            return(Ok(result));
        }
 protected async Task <ActionResult <PageResultDto <TPaginationDto> > > GetPageResultAsync <TPageFilter>(IQueryable <TEntity> itemsQuery, PageRequestDto requestDto, TPageFilter pageFilter, CancellationToken cancellationToken)
     where TPageFilter :
 class, IPageFilter <TEntity>, new() =>
 await new PageResultDto <TPaginationDto>(PagingConverter(pageFilter.Filter(itemsQuery)), requestDto
                                          ).GetPage(cancellationToken);
 public IActionResult GetPage([FromQuery] PageRequestDto pageRequestDto)
 {
     Page(pageRequestDto);
 }