Ejemplo n.º 1
0
        public static List <List <string> > SortData(List <List <string> > tableData, SortMetadata sortMetadata, List <string> headers)
        {
            _tableData    = tableData;
            _sortMetadata = sortMetadata;
            _headers      = headers;

            if (_sortMetadata == null)
            {
                return(_tableData);
            }
            List <List <string> > sortedData = new List <List <string> >();

            int headerIndex = _headers.IndexOf(_sortMetadata.ColumnHeader);

            if (_sortMetadata.SortOrder == "Ascending")
            {
                sortedData = _tableData.OrderBy(row => row[headerIndex]).ToList();
            }
            else
            {
                sortedData = _tableData.OrderByDescending(row => row[headerIndex]).ToList();
            }

            return(sortedData);
        }
Ejemplo n.º 2
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();
        }