Пример #1
0
        public Tuple <bool, T> QueryTagsOfAppLog <T>(QueryParamDto dto)
        {
            Dictionary <string, object> paramDic = dto.ToDictionary();
            var action = "QueryTagsOfAppLog";

            return(DoPost <T>(SNAKE_WEBAPI_TRACKLOG_CONTROLLER, action, paramDic));
        }
Пример #2
0
        public async Task GetPagedProperties_StateUnderTest_ExpectedBehavior()
        {
            var propertyController = CreatePropertyController();
            var paginate           = new QueryParamDto {
                PageSize = 1, PageNumber = 3
            };
            var request = new PropertyRequestDto {
                Year = 2021
            };
            var propertyList = new List <PropertyListDto>
            {
                new()
                {
                    Name = "Propertie 1", Year = 2021, CodeInternal = "10212"
                }
            };

            var pagedList = PagedList <PropertyListDto> .Create(propertyList, propertyList.Count, paginate.PageNumber,
                                                                paginate.PageNumber);

            _mockPropertyService.Setup(s => s.GetPagedProperties(paginate, request)).ReturnsAsync(pagedList);

            var result = await propertyController.GetPagedProperties(paginate, request);

            var responseOkResult = result as OkObjectResult;

            Assert.AreEqual(200, responseOkResult?.StatusCode);
            _mockRepository.VerifyAll();
        }
    }
Пример #3
0
        public TransData <IList <string> > QueryTagsOfAppLog([FromBody] QueryParamDto dto)
        {
            var result = new TransData <IList <string> >();

            result.Data = null;

            if (dto == null)
            {
                return(Response <IList <string> >(null, "Parameter is null", (int)ServiceResultCode.ParameterError));
            }

            try
            {
                using (ICacheProvider cacheObj = CacheFactory.Instance.GetClient())
                {
                    var hs = cacheObj.GetAllItemsFromSet(CacheAppLogSet.Tags);
                    if (hs != null)
                    {
                        result.Data = hs.Where(x => x.Contains(dto.StrParam)).ToList();
                    }
                }
                result.Code = (int)ServiceResultCode.Succeeded;
            }
            catch (Exception e)
            {
                result.Data    = null;
                result.Message = "服务异常!";
                result.Code    = (int)ServiceResultCode.UndefinedError;
            }
            return(result);
        }
Пример #4
0
        /// <summary>
        /// Gets the paged properties.
        /// </summary>
        /// <param name="paginate">The paginate.</param>
        /// <param name="propertyRequest">The property request.</param>
        /// <returns>Task&lt;PagedList&lt;PropertyListDto&gt;&gt;.</returns>
        public async Task <PagedList <PropertyListDto> > GetPagedProperties(QueryParamDto paginate, PropertyRequestDto propertyRequest)
        {
            paginate.PageNumber = paginate.PageNumber == decimal.Zero ? _paginationOption.DefaultPageNumber : paginate.PageNumber;
            paginate.PageSize   = paginate.PageSize == decimal.Zero ? _paginationOption.DefaultPageSize : paginate.PageSize;
            var propertyExpression = BuildPropertyExpression(propertyRequest);
            var propertyList       = await _repository.GetAllAsync(propertyExpression, o => o.OrderBy(s => s.Name), include : BuildPropertyIncludes);

            return(PagedList <PropertyListDto> .Create(propertyList.Select <Property, PropertyListDto>(p => p).ToList(), propertyList.Count(), paginate.PageNumber, paginate.PageSize));
        }
Пример #5
0
        private async void OnTagIsDropDownOpenCommandExecute()
        {
            var dto = new QueryParamDto()
            {
                StrParam = ""
            };
            SnakeWebApiHttpProxy proxy = new SnakeWebApiHttpProxy();
            var result = await proxy.QueryTagsOfAppLogAsync <IList <string> >(dto);

            if (result.Item1 && result.Item2 != null)
            {
                Tags = new ObservableCollection <string>(result.Item2);
            }
        }
        public async Task <IActionResult> GetPagedProperties([FromQuery] QueryParamDto paginate, [FromQuery] PropertyRequestDto request)
        {
            var result = await _propertyService.GetPagedProperties(paginate, request);

            var response = new ApiResponse <List <PropertyListDto> >(result)
            {
                Meta = new Metadata
                {
                    PageSize        = result.PageSize,
                    CurrentPage     = result.CurrentPage,
                    HasNextPage     = result.HasNextPage,
                    HasPreviousPage = result.HasPreviousPage,
                    TotalCount      = result.TotalCount,
                    TotalPages      = result.TotalPages
                }
            };

            return(Ok(response));
        }
Пример #7
0
 public Task <Tuple <bool, T> > QueryTagsOfAppLogAsync <T>(QueryParamDto dto)
 {
     return(Task.Run(() => QueryTagsOfAppLog <T>(dto)));
 }