Esempio n. 1
0
        // This method is called by the front end when it wants to display a page of horse data.

        public static PaginatedTable FilterSortPaginateTable(
            List <string> headers,
            List <List <string> > tableData,
            List <FilterMetadata> filters,
            SortMetadata sortMetadata,
            PaginationMetadata paginationMetadata)
        {
            var filterData                 = Filter.FilterData(filters, tableData, headers);
            var sortedandFiltered          = Sort.SortData(filterData, sortMetadata, headers);
            var paginatedSortedAndFiltered = Paginate.PaginateData(sortedandFiltered, paginationMetadata);

            return(new PaginatedTable(headers, paginatedSortedAndFiltered, paginatedSortedAndFiltered.Count));
        }
        // This method is called by the front end when it wants to display a page of horse data.
        public static PaginatedTable FilterSortPaginateTable(
            List <string> headers,
            List <List <object> > tableData,
            List <FilterMetadata> filters,
            SortMetadata sortMetadata,
            PaginationMetadata paginationMetadata)
        {
            // TODO: filter horse table using filters

            // TODO: sort horse table using sortMetadata

            // TODO: paginate horse table using paginationMetadata

            throw new NotImplementedException();
        }
Esempio n. 3
0
        public static List <List <string> > PaginateData(List <List <string> > tableData, PaginationMetadata paginationMetadata)
        {
            _tableData          = tableData;
            _paginationMetadata = paginationMetadata;

            if (_paginationMetadata == null)
            {
                return(_tableData);
            }

            var paginateData = new List <List <string> >();
            var pageSize     = _paginationMetadata.PageSize + _paginationMetadata.FirstRecordInPage;

            for (var i = _paginationMetadata.FirstRecordInPage; i < pageSize; i++)
            {
                paginateData.Add(_tableData[i]);
            }
            return(paginateData);
        }