Esempio n. 1
0
        public async Task SearchDevice_Call()
        {
            //--------------    Arrange     -------------

            CommonArrangements();
            var searchRequest = new DeviceSearchRequest();

            //--------------    Act     -------------

            var resp = await deviceService.SearchDeviceAsync(searchRequest);

            //--------------    Assert     -------------

            A.CallTo(() => deviceDataAccess.ListPagedAsync(null, 0, 0, null, null)).WithAnyArguments().MustHaveHappened();
        }
        public async Task <ResponseDTO <PagedList <DeviceDTO> > > SearchDeviceAsync(DeviceSearchRequest search)
        {
            var queryFilter = GetQueryFilter(search);

            var device = await _deviceDataAccess.ListPagedAsync(queryFilter, search.Page, search.PageSize);

            var pagedResult = new PagedList <DeviceDTO>()
            {
                Items    = device.Items,
                PageSize = device.PageSize,
                Page     = device.Page,
                Total    = device.Total
            };

            return(ResponseBuilder.Correct(pagedResult));
        }
Esempio n. 3
0
 public Entity.BaseResponse <Entity.SearchResult <List <Entity.AlertResponse> > > GetBySearchMobile(DeviceSearchRequest request)
 {
     Entity.BaseResponse <Entity.SearchResult <List <Entity.AlertResponse> > > response = new Entity.BaseResponse <Entity.SearchResult <List <Entity.AlertResponse> > >(true);
     try
     {
         response.Data = _ruleService.AlertList(new Entity.AlertRequest()
         {
             DeviceGuid = request.DeviceGuid,
             EntityGuid = request.EntityGuid,
             OrderBy    = request.OrderBy,
             PageNumber = request.PageNo,
             PageSize   = request.PageSize
         });
     }
     catch (Exception ex)
     {
         base.LogException(ex);
         return(new Entity.BaseResponse <Entity.SearchResult <List <Entity.AlertResponse> > >(false, ex.Message));
     }
     return(response);
 }
Esempio n. 4
0
        public async Task <ResponseDTO <PagedList <DeviceDTO> > > Search([FromUri] DeviceSearchRequest search)
        {
            var resp = await _deviceApplicationService.SearchDeviceAsync(search);

            return(resp);
        }
        private Expression <Func <DeviceDTO, bool> > GetQueryFilter(DeviceSearchRequest search)
        {
            Expression <Func <DeviceDTO, bool> > queryFilter = p => true;

            if (search.DeviceId != null)
            {
                queryFilter = queryFilter.And(p => p.DeviceId == search.DeviceId);
            }

            if (!string.IsNullOrEmpty(search.Identifier))
            {
                queryFilter = queryFilter.And(p => p.Identifier == search.Identifier);
            }

            if (!string.IsNullOrEmpty(search.WIFIMAC))
            {
                queryFilter = queryFilter.And(p => p.WIFIMAC == search.WIFIMAC);
            }

            if (!string.IsNullOrEmpty(search.CellphoneNumber))
            {
                queryFilter = queryFilter.And(p => p.CellphoneNumber == search.CellphoneNumber);
            }

            if (search.OSVersionId != null)
            {
                queryFilter = queryFilter.And(p => p.OSVersionId == search.OSVersionId);
            }

            if (search.PlatformId != null)
            {
                queryFilter = queryFilter.And(p => p.PlatformId == search.PlatformId);
            }

            if (search.AppVersionId != null)
            {
                queryFilter = queryFilter.And(p => p.AppVersionId == search.AppVersionId);
            }

            if (search.ModelId != null)
            {
                queryFilter = queryFilter.And(p => p.ModelId == search.ModelId);
            }

            if (search.BrandId != null)
            {
                queryFilter = queryFilter.And(p => p.BrandId == search.BrandId);
            }

            if (search.IsAutoDateTime != null)
            {
                queryFilter = queryFilter.And(p => p.IsAutoDateTime == search.IsAutoDateTime);
            }

            if (search.IsSpoofingGPS != null)
            {
                queryFilter = queryFilter.And(p => p.IsSpoofingGPS == search.IsSpoofingGPS);
            }

            if (search.IsRootedJailbreaked != null)
            {
                queryFilter = queryFilter.And(p => p.IsRootedJailbreaked == search.IsRootedJailbreaked);
            }

            if (search.AssignedAmigoTenantTUserId != null)
            {
                queryFilter = queryFilter.And(p => p.AssignedAmigoTenantTUserId == search.AssignedAmigoTenantTUserId);
            }

            if (search.RowStatus != null)
            {
                queryFilter = queryFilter.And(p => p.RowStatus == search.RowStatus);
            }

            return(queryFilter);
        }