public async Task <IActionResult> Get([FromQuery] PagingParameters pagingParameters)
        {
            string userId = Utilities.GetUserId(this.User);
            PagedList <Article> articles;

            if (User.IsInRole("administrator"))
            {
                articles = await _dataStore.GetNewestArticlesAsync(pagingParameters);
            }
            else
            {
                articles = await _dataStore.GetRelatedArticlesAsync(pagingParameters, userId);
            }

            Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(articles.MetaData));

            if (articles != null)
            {
                var json = new JsonResponse
                {
                    Json = articles
                };
                return(Ok(json));
            }
            return(BadRequest("error"));
        }
Beispiel #2
0
        public Task BindModelAsync(ModelBindingContext bindingContext)
        {
            var valueName = string.IsNullOrEmpty(bindingContext.ModelName)
                ? bindingContext.ModelMetadata.Name
                : bindingContext.ModelName;

            var limit  = PagingParameters.DefaultLimit;
            var cursor = PagingCursor.Start;

            if (bindingContext.TryGetValue <int>("limit", out var limitResult))
            {
                limit = limitResult.Value;
            }

            if (bindingContext.TryGetStringValue("cursor", out var cursorResult))
            {
                cursor = new PagingCursor(cursorResult.Value);
            }

            var pagingParameters = new PagingParameters(cursor, limit).Coerce();

            bindingContext.ModelState.MarkFieldValid(valueName);
            bindingContext.Result = ModelBindingResult.Success(pagingParameters);

            return(Task.CompletedTask);
        }
Beispiel #3
0
        public async Task <ViewResult> ProjectsListAsync(int page = 1)
        {
            var pagingParameters = new PagingParameters(page, 12);
            var vm = await GetProjectsViewModelAsync(pagingParameters);

            return(View("_ProjectsList", vm.Projects));
        }
Beispiel #4
0
 public async Task <PagedList <StudentCourse> > FindAll(PagingParameters pagingParameters)
 {
     using (var logger = _loggerManager.CreateLogger())
     {
         return(await _repository.FindAll(pagingParameters));
     }
 }
 public async Task <PagedList <Class> > Get(PagingParameters parameters)
 {
     return(await _context.Classes
            .Include(x => x.School)
            .OrderByDescending(x => x.CreatedDate)
            .PaginateAsync(parameters.Page, parameters.Limit));
 }
Beispiel #6
0
        public async Task <ActionResult <PagedResponse <PetsitterDTO[]> > > GetPettsittersWithPaging([FromQuery] PagingParameters parameters, [FromQuery] PetsittersSearchParameters petsittersSearchParameters)
        {
            try
            {
                var validParameter = new PagingParameters(parameters.PageNumber, parameters.PageSize);

                var petsittersFilteredByParameter = await _petsitterRepository
                                                    .GetAllPetsittersBySearchParametersAsync(petsittersSearchParameters);

                var listPetsittersToReturn = _mapper.Map <PetsitterDTO[]>(petsittersFilteredByParameter);

                var pagedData = listPetsittersToReturn
                                .Skip((validParameter.PageNumber - 1) * validParameter.PageSize)
                                .Take(validParameter.PageSize)
                                .ToArray();

                var totalRecords = petsittersFilteredByParameter.Count();


                return(Ok(new PagedResponse <PetsitterDTO[]>(pagedData, validParameter.PageNumber,
                                                             validParameter.PageSize)));
            }

            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }
Beispiel #7
0
        /// <summary>
        /// Gets vehicles.
        /// </summary>
        /// <param name="id">Id.</param>
        /// <param name="makerId">Maker id.</param>
        /// <param name="findVehicle">Find vehicle.</param>
        /// <param name="sortField">Sort field.</param>
        /// <param name="sortOrder">Sort order.</param>
        /// <param name="pageNumber">Page number.</param>
        /// <param name="pageSize">Page size.</param>
        /// <param name="sorting">Sorting.</param>
        /// <returns>Vehicles.</returns>
        public async Task <ActionResult> GetVehicles(Guid id, Guid?makerId, string findVehicle, string sortField, string sortOrder, int pageNumber = 1, int pageSize = 12, string sorting = "VehicleMaker.Name")
        {
            try
            {
                PagingParameters paging    = new PagingParameters(pageNumber, pageSize);
                VehicleFilter    filtering = new VehicleFilter(id, findVehicle, makerId);

                ViewBag.SortMaker = sorting == "VehicleMaker.Name" ? "VehicleMaker.Name desc" : "VehicleMaker.Name";

                if (sorting.Contains("desc"))
                {
                    string[] sorts = sorting.Split();
                    sortField = sorts[0];
                    sortOrder = sorts[1];
                }
                else
                {
                    sortField = sorting;
                    sortOrder = "";
                }

                SortingParameters sortingFilter = new SortingParameters(sortField, sortOrder);

                ViewBag.Makers        = new SelectList(await makerService.GetMakersAsync(), "Id", "Name");
                ViewBag.CurrentSort   = sorting;
                ViewBag.CurrentSearch = findVehicle;
                ViewBag.CurrentMaker  = makerId;

                return(View(await vehicleService.GetVehiclesAsync(paging, filtering, sortingFilter)));
            }
            catch
            {
                return(new HttpNotFoundResult("There are no vehicles"));
            }
        }
Beispiel #8
0
 /// <summary>
 /// Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String" /> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     return(string.Format("{0}; {1}; {2}",
                          SortingParameters != null ? SortingParameters.ToString() : string.Empty,
                          PagingParameters != null ? PagingParameters.ToString() : string.Empty,
                          Filter != null ? Filter.ToString() : string.Empty));
 }
 /// <summary>Creates a pager with text and page numbers.</summary>
 /// <param name="helper">The helper.</param>
 /// <param name="pagingParameters">The paging parameters.</param>
 /// <param name="baseUrl">The base URL.</param>
 /// <returns>The paging html code.</returns>
 public static MvcHtmlString Pager(
     this HtmlHelper helper,
     PagingParameters pagingParameters,
     string baseUrl)
 {
     return(BuildPager(pagingParameters, baseUrl, false));
 }
Beispiel #10
0
        public async Task <IActionResult> Get([FromQuery] PagingParameters pagingParameters)
        {
            using (var logger = _loggerManager.CreateLogger())
            {
                try
                {
                    var courses = await _courseService.FindAll(pagingParameters);

                    logger.LogInformation("Course are retreived");
                    var metadata = new
                    {
                        courses.TotalCount,
                        courses.PageSize,
                        courses.CurrentPage,
                        courses.TotalPages,
                        courses.HasNext,
                        courses.HasPrevious
                    };
                    Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(metadata));

                    if (courses != null)
                    {
                        return(Ok(courses));
                    }

                    return(NoContent());
                }
                catch (Exception ex)
                {
                    logger.LogError("Something happend while getting courses", ex);
                    return(StatusCode(500));
                }
            }
        }
Beispiel #11
0
        public async Task WorkItemService_GetFailedAsync_FailedReturned()
        {
            // Arrange
            var diHelper        = new DITestHelper();
            var serviceProvider = diHelper.BuildDefault();

            var context = serviceProvider.GetRequiredService <TestDbContext>();
            var service = serviceProvider.GetRequiredService <IWorkItemService>();

            var workItems = this.GetWorkItems();

            workItems.First().Retries = 4;
            await context.WorkItems.AddRangeAsync(workItems);

            await context.SaveChangesAsync();

            var parameters = new PagingParameters();

            // Act
            var failed = await service.GetFailedAsync(parameters);

            // Assert
            Assert.NotNull(failed);
            Assert.Single(failed);
            Assert.Equal(1, failed.First().Id);
            Assert.Equal(4, failed.First().Retries);
        }
Beispiel #12
0
        public void EnsureValid(PagingParameters parameters)
        {
            if (parameters == null)
            {
                var validationMessage = this.validationStringResources.GetParameterIsNullString(nameof(parameters));

                throw new ValidationException(new List <string> {
                    validationMessage
                });
            }

            IList <string> validationMessages = new List <string>();

            if (parameters.PageNumber <= 0)
            {
                validationMessages.Add(this.validationStringResources.GetParameterMustBePositiveString(nameof(parameters.PageNumber)));
            }

            if (parameters.PageSize <= 0)
            {
                validationMessages.Add(this.validationStringResources.GetParameterMustBePositiveString(nameof(parameters.PageSize)));
            }

            if (validationMessages.Any())
            {
                throw new PagingValidationException(validationMessages);
            }
        }
        private void GetFilteredContent()
        {
            QueryExpression advancedFilterQuery = BuildTeamByFilterQuery();

            if (PagingParameters.IncludeTotalCount)
            {
                int count = _repository.GetRowCount(advancedFilterQuery, out double accuracy);
                WriteObject(PagingParameters.NewTotalCount(Convert.ToUInt64(count), accuracy));
            }

            var result = _repository.Get(advancedFilterQuery, PagingParameters.First, PagingParameters.Skip);

            if (!string.IsNullOrWhiteSpace(Name))
            {
                WildcardPattern includePattern = new WildcardPattern(Name, WildcardOptions.IgnoreCase);
                result = result.Where(a => includePattern.IsMatch(a.GetAttributeValue <string>("name")));
            }
            if (!string.IsNullOrWhiteSpace(Exclude))
            {
                WildcardPattern excludePattern = new WildcardPattern(Exclude, WildcardOptions.IgnoreCase);
                result = result.Where(a => !(excludePattern.IsMatch(a.GetAttributeValue <string>("name"))));
            }

            WriteObject(result, true);
        }
        public override PagedResponse <GetCandidatesResultDto> Execute(PagingParameters request)
        {
            if (request.PageSize < 0) //vuetify sends -1 when no limit is set
            {
                request.PageSize = 1_000_000;
            }

            var dataTask = Get(
                _dbContext.Users.Where(u => u.CandidateId != _businessConfiguration.AdminLogin),
                request)
                           .Skip((request.Page - 1) * request.PageSize)
                           .Take(request.PageSize)
                           .ToListAsync();
            var countTask = _dbContext.Users.Where(u => u.CandidateId != _businessConfiguration.AdminLogin).CountAsync();

            Task.WhenAll(dataTask, countTask).Wait();
            var count = countTask.Result;
            var data  = dataTask.Result;

            return(new PagedResponse <GetCandidatesResultDto>()
            {
                Page = request.Page,
                TotalCount = count,
                Data = data.Select(u => new GetCandidatesResultDto()
                {
                    Id = u.Id,
                    CandidateId = u.CandidateId,
                    Email = u.Email,
                    Name = u.Name,
                    Surname = u.Surname
                })
            });
        }
Beispiel #15
0
        private void GetFilteredContent()
        {
            QueryExpression advancedFilterQuery = new QueryExpression("serviceendpoint")
            {
                ColumnSet = new ColumnSet(true),
                Orders    =
                {
                    new OrderExpression("name", OrderType.Ascending)
                }
            };

            if (PagingParameters.IncludeTotalCount)
            {
                int count = _repository.GetRowCount(advancedFilterQuery, out double accuracy);
                WriteObject(PagingParameters.NewTotalCount(Convert.ToUInt64(count), accuracy));
            }

            var result = _repository.Get(advancedFilterQuery, PagingParameters.First, PagingParameters.Skip);

            if (!string.IsNullOrWhiteSpace(Name))
            {
                WildcardPattern includePattern = new WildcardPattern(Name, WildcardOptions.IgnoreCase);
                result = result.Where(a => includePattern.IsMatch(a.GetAttributeValue <string>("name")) || includePattern.IsMatch(a.GetAttributeValue <string>("solutionnamespace")));
            }
            if (!string.IsNullOrWhiteSpace(Exclude))
            {
                WildcardPattern excludePattern = new WildcardPattern(Exclude, WildcardOptions.IgnoreCase);
                result = result.Where(a => !(excludePattern.IsMatch(a.GetAttributeValue <string>("name")) || excludePattern.IsMatch(a.GetAttributeValue <string>("solutionnamespace"))));
            }

            WriteObject(result, true);
        }
        public IEnumerable <TournamentViewModel> Get([FromQuery] PagingParameters pagingParameters)
        {
            var mapper      = config.CreateMapper();
            var tournaments = tournamentService.Get(pagingParameters.PageSize, pagingParameters.PageNumber);

            return(mapper.Map <List <TournamentDTO>, List <TournamentViewModel> >(tournaments));
        }
Beispiel #17
0
        public async Task WorkItemService_GetUpCommingsAsync_UpCommingsReturned()
        {
            // Arrange
            var diHelper        = new DITestHelper();
            var serviceProvider = diHelper.BuildDefault();

            var context = serviceProvider.GetRequiredService <TestDbContext>();
            var service = serviceProvider.GetRequiredService <IWorkItemService>();

            var dueDate = SystemTime.Now().AddMinutes(2);

            var workItems = this.GetWorkItems(dueDate);
            await context.WorkItems.AddRangeAsync(workItems);

            await context.SaveChangesAsync();

            var parameters = new PagingParameters();

            // Act
            var upcommings = await service.GetUpCommingsAsync(parameters);

            // Assert
            Assert.NotNull(upcommings);
            Assert.Equal(2, upcommings.Count);
        }
Beispiel #18
0
        public void TestPFEmailMq()
        {
            var resMsg = "";

            var p = new PagingParameters();

            p["backupDatabase"] = "bonus";

            TestPFEmailMqConsumer tmpObj = new TestPFEmailMqConsumer();

            PFMqHelper.BuildConsumer(tmpObj);
            Thread.Sleep(2000);//不延迟的话,后面太快了,前面还没开始监听

            var st      = DateTime.Now;
            var message = JsonConvert.SerializeObject(p);
            var t       = PFMqHelper.BuildProducer(message,
                                                   new TestPFEmailMqProducer());

            t.Wait();
            var et = DateTime.Now;

            resMsg = t.Result.Body;

            var usedTime = PFDataHelper.GetTimeSpan(et - st);//平均6秒

            Assert.IsTrue(resMsg == JsonConvert.SerializeObject("接收到信息:" + message));
            //Assert.IsTrue(true);
        }
Beispiel #19
0
        /// <summary>
        /// Gets todo items by user id.
        /// Returns null if no user is found.
        /// </summary>
        /// <param name="userId">User id</param>
        /// <param name="pagingParams">Pagin params</param>
        /// <returns>Todo items entities</returns>
        public PagedResult <TodoItem> GetItems(int userId, PagingParameters pagingParams)
        {
            if (!dbContext.Users.Any(u => u.UserId == userId))
            {
                return(null);
            }

            var dbItems = dbContext.TodoItems
                          .Include(d => d.Labels).AsNoTracking()
                          .Where(t => t.Id == userId);

            // search by item name or labels
            if (!string.IsNullOrWhiteSpace(pagingParams?.Search))
            {
                var searchLower = pagingParams?.Search.ToLower();
                dbItems = dbItems.Where(d => d.Description.ToLower().Contains(searchLower) || d.Labels.Any(l => l.Name.ToLower().Contains(searchLower)));
            }

            var count = dbItems.Count();

            var result = dbItems
                         .Skip(pagingParams?.Skip ?? 0)
                         .Take(pagingParams?.Take ?? 50)
                         .ToList();

            return(new PagedResult <TodoItem>
            {
                PageContent = result,
                StartIndex = pagingParams?.Skip ?? 0,
                Total = count
            });
        }
Beispiel #20
0
        /// <summary>
        /// Get a list of <see cref="User"/>.
        /// </summary>
        /// <param name="lang">The language.</param>
        /// <param name="paging">The paging parameters.</param>
        /// <param name="sorting">The sorting parameters.</param>
        /// <param name="filtering">The filtering parameters.</param>
        /// <param name="fielding">The fielding parameters. (not used)</param>
        /// <returns>The pagined list of <see cref="User"/>.</returns>
        public PagedCollection <User> GetUsers(string lang,
                                               PagingParameters paging,
                                               SortingParameters sorting,
                                               FilteringParameters filtering,
                                               FieldingParameters fielding)
        {
            if (Session == null)
            {
                throw new Exception("Session is null");
            }

            var result = Session.Read("users",
                                      paging.ToMDBPagingParameters(),
                                      sorting.ToSortDefinition(),
                                      filtering.ToFilterDefinition());

            return(new PagedCollection <User>
            {
                Items = result.Items.ToUserList(),
                TotalNumberOfItems = result.TotalNumberOfItems,
                PageIndex = paging.Index,
                PageSize = paging.Size,
                TotalNumberOfPages = (long)Math.Ceiling(result.TotalNumberOfItems / (double)paging.Size)
            });
        }
Beispiel #21
0
        public async Task <ActionResult> List(PagingParameters paging)
        {
            await AuthenticateAdmin();

            PagedResponse <GetCandidatesResultDto> data = Get <GetCandidatesQuery>().Execute(paging);

            return(Json(data));
        }
Beispiel #22
0
        /// <summary>
        /// Gets the products paged asynchronous.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="sortingParameters">The sorting parameters.</param>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <returns></returns>
        public Task <IPagedCollection <Product> > GetProductsPagedAsync(Expression <Func <Product, bool> > filter, ISortingParameters sortingParameters, int pageNumber, int pageSize)
        {
            _logger.LogDebug("{Method} - {PageNumber}, {PageSize}", nameof(CatalogService.GetProductsPagedAsync), pageNumber, pageSize);

            var pagingParameters = new PagingParameters(pageNumber, pageSize);

            return(_productRepository.GetPagedAsync(filter, sortingParameters, pagingParameters, nameof(Product.ProductPrice)));
        }
 public static AdminService.PagingParameters GetPagingParametersDC(this PagingParameters pagingParameters)
 {
     return(new AdminService.PagingParameters()
     {
         PageIndex = pagingParameters.PageIndex,
         PageSize = pagingParameters.PageSize
     });
 }
        public void Construct_PageSizeEdgeCases_Should_InitializeWithCorrectData(int initPageSize, int expectedPageSize)
        {
            // Arrange
            var parameters = new PagingParameters(pageNumber: 1, initPageSize);

            // Assert
            parameters.PageSize.Should().Be(expectedPageSize);
        }
Beispiel #25
0
        public async Task <IActionResult> GetProductsAsync([FromQuery] PagingParameters parameters, [FromServices] IProductToListProductResponseMapper mapper)
        {
            var list = await _service.GetProductsAsync(parameters.Page, parameters.RecordsPerPage);

            var result = mapper.Map(list);

            return(Ok(result));
        }
Beispiel #26
0
        public async Task <IEnumerable <ShowResource> > GetAllAsync([FromQuery] PagingParameters pagingParameters)
        {
            var shows = await _showService.ListAsync(pagingParameters);

            var resources = shows.Select(ShowMapper.ToShowResource).ToList();

            return(resources);
        }
Beispiel #27
0
        public async Task <TR> GetPageAsync <T, TR>(string uri, PagingParameters pagingParameters, string userId = null)
        {
            try
            {
                string errorMessage     = string.Empty;
                var    queryStringParam = new Dictionary <string, string>
                {
                    ["pageNumber"] = pagingParameters.PageNumber.ToString(),
                    ["pageSize"]   = pagingParameters.PageSize.ToString(),
                    ["searchTerm"] = pagingParameters.SearchTerm,
                    ["cat"]        = pagingParameters.Cat.ToString()
                };
                if (!string.IsNullOrEmpty(userId))
                {
                    queryStringParam.Add("userId", userId);
                }
                var url = QueryHelpers.AddQueryString(uri, queryStringParam);
                var req = new HttpRequestMessage(HttpMethod.Get, url);

                req.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                if (!string.IsNullOrEmpty(_token))
                {
                    req.Headers.Add("Authorization", $"Bearer {_token}");
                }
                var response = await _httpClient.SendAsync(req);

                var content = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    var options = new JsonSerializerOptions
                    {
                        PropertyNameCaseInsensitive = true,
                    };
                    var jsonResponse = JsonSerializer.Deserialize <JsonResponse>(content, options);

                    var pagingResponse = new
                    {
                        Items    = jsonResponse.Json,
                        MetaData = JsonSerializer.Deserialize <MetaData>(response.Headers.GetValues("X-Pagination").First(), options)
                    };
                    return(JsonSerializer.Deserialize <TR>(JsonSerializer.Serialize(pagingResponse), options));
                }
                if (response.StatusCode.ToString() == "BadRequest" || response.StatusCode.ToString() == "NotFound")
                {
                    errorMessage = await response.Content.ReadAsStringAsync();

                    errorMessage = JsonSerializer.Deserialize <string>(errorMessage);
                    ShowNotification(HttpMethod.Get, "error", errorMessage);
                }
                throw new HttpRequestExceptionEx(response.StatusCode, errorMessage);
            }
            catch (Exception e)
            {
                Debug.WriteLine($"{e.GetType().Name} : {e.Message}");
                throw;
            }
        }
Beispiel #28
0
        public async Task <List <Idea> > GetAll(PagingParameters pagingParameters)
        {
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("PageNumber", pagingParameters.PageNumber);
            parameters.Add("PageSize", pagingParameters.PageSize);

            return(await QueryAsync <Idea>(StoredProcedures.Idea.GetAll, parameters));
        }
Beispiel #29
0
        public async Task <PagedList <Article> > GetRelatedCategoryAsync(PagingParameters pg)
        {
            var model = await _context.Articles.AsNoTracking().Where(a => pg.Cat == 0 || a.Category.Id == pg.Cat && a.Validated == true)
                        .OrderByDescending(a => a.Updated).Include(a => a.Pictures).ToListAsync();

            var articles = PagedList <Article> .ToPagedList(model, pg.PageNumber, pg.PageSize);

            return(articles);
        }
Beispiel #30
0
        public async Task <PagedList <Article> > AutocompleteAsync(PagingParameters pg)
        {
            var model = await _context.Articles.Where(a => (pg.SearchTerm == null || a.Title.Contains(pg.SearchTerm) || a.Description.Contains(pg.SearchTerm)) && a.Validated == true)
                        .OrderByDescending(a => a.Title).Include(a => a.Pictures).ToListAsync();

            var articles = PagedList <Article> .ToPagedList(model, pg.PageNumber, pg.PageSize);

            return(articles);
        }
        public static IPagingParameters FillPagingParameters(this IPagingParameters destination, IPagingResults parameters)
        {
            if (destination == null)
            {
                destination = new PagingParameters();
            }
            
            destination.PageNumber = parameters.PageNumber;
            destination.PageSize = parameters.PageSize;
            destination.TotalItems = parameters.TotalItems;
            destination.TotalPages = parameters.TotalPages;

            return destination;
        }
        public List<FamilyDetail> QueryTransactionFamilies(string sessionToken, QueryTransactionsParameters queryTransactionsParameters, PagingParameters pagingParameters)
        {
            if (_msgFormat == MessageFormat.SOAP.ToString())
            {
                using (var client = new TMSOperationsClient(ConfigurationManager.AppSettings["Bindings.MgmtSoap"]))
                {
                    try
                    {
                        return client.QueryTransactionFamilies(sessionToken, queryTransactionsParameters, pagingParameters).ToList();
                    }
                    catch (FaultException ex)
                    {
                        SoapFaultHandler.HandleFaultException(ex);
                    }
                }
            }
            else // REST JSON or XML
            {
                var isJson = string.Equals(_msgFormat, MessageFormat.JSON.ToString());
                var requestString = RestBaseUri + "/transactionsFamily";
                var restQtf = new QueryTransactionsFamilies();

                // Convert the namespace from service reference to the generated proxies used by rest.
                restQtf.QueryTransactionsParameters = Utilities.SwapObjectsNamespace<schemas.ipcommerce.com.CWS.v2._0.DataServices.TMS.QueryTransactionsParameters>(queryTransactionsParameters);
                restQtf.PagingParameters = Utilities.SwapObjectsNamespace<schemas.ipcommerce.com.CWS.v2._0.DataServices.PagingParameters>(pagingParameters);

                var request = RestHelper.CreateRestRequest<QueryTransactionsFamilies>(restQtf, requestString, HttpMethod.POST, sessionToken, isJson);
                try
                {
                    var responseStr = RestHelper.GetResponse(request, isJson, false);
                    if (isJson)
                    {
                        var list = RestHelper.GetCWSObjectListFromJson<schemas.ipcommerce.com.CWS.v2._0.DataServices.TMS.FamilyDetail>(responseStr);
                        return list.Select(familyDetail => Utilities.SwapObjectsNamespace<TMS.FamilyDetail>(familyDetail)).ToList();
                    }
                    else
                    {
                        return RestHelper.GetCWSObjectListFromXml<TMS.FamilyDetail>(responseStr);
                    }
                }
                catch (Exception ex)
                {
                    RestFaultHandler.HandleFaultException(ex, isJson);
                }
            }
            return null;
        }
    public virtual void ProcessRequest(HttpContext context)
    {
        var parameters = new PagingParameters
                                        {
                                            // 接收PageIndex参数
                                            PageIndex = int.Parse(context.Request["PageIndex"]),
                                            // 接收PageSize参数
                                            PageSize = int.Parse(context.Request["PageSize"]),
                                            // 接收OrderBy参数
                                            OrderBy = context.Request["OrderBy"],
                                            // 接收Sort参数
                                            Sort = context.Request["Sort"],
                                            // 存储过程名称
                                            ProcedureName = ProcName,
                                            // Where条件
                                            Where = string.Empty
                                        };
            this.PagingParameters = parameters;

            context.Response.ContentType = "application/json";
            context.Response.Write(GetJsonResult());
    }
        private PagingParameters PP()
        {
            //Specify Paging Parameters
            PagingParameters PP = new PagingParameters();

            if (_lastSearch == LastSearchType.QueryTransactionsSummary)
            {
                PP.Page = _intCurrentPage;
                PP.PageSize = _intResultsPerPage;
            }

            if (_lastSearch == LastSearchType.QueryTransactionFamilies 
                | _lastSearch == LastSearchType.QueryTransactionsDetail 
                | _lastSearch == LastSearchType.QueryBatch) 
            {
                PP.Page = _intCurrentPageResults;
                PP.PageSize = _intResultsPerPageResults;
            }

            return PP;
        }