Table of Contents

Method NewPagingRequest

Namespace
Skyline.DataMiner.Net.Ticketing
Assembly
SLNetTypes.dll

Requests tickets in a paged fashion. This method requests a new page.

public IEnumerable<Ticket> NewPagingRequest(int pagesize, out long pagingCookie, out int totalTickets, int pageNumber = 0, IEnumerable<TicketLink> links = null, FilterElement<Ticket> filter = null, bool CacheOnly = false)

Parameters

pagesize int

The number of tickets that should be retrieved on one page.

pagingCookie long

The paging cookie to use in the NextPagingRequest method to request the next page. If output is 0, no cookie could be created.

totalTickets int

The total number of tickets this request would result in if done as a regular request (GetTickets). If output is -1, no total number could be calculated.

pageNumber int

The page number you want to retrieve.

links IEnumerable<TicketLink>

The links to be used when searching the tickets.

filter FilterElement<Ticket>

The filter to use when searching the tickets.

CacheOnly bool

Indicates whether to only check the cache (true) or also the database (false).

Returns

IEnumerable<Ticket>

A collection of tickets with the indicated page size, matching the links and filter.

When you have a system with a lot of tickets, it can be more feasible to retrieve the tickets in a paged fashion, so the client application does not receive a large amount all at once, which it cannot all display anyway.

The following example demonstrates how to use paging.

private static long PagingCookie = -1;
private static int PageSize = 2;
private static int totalTickets = 10;

private IEnumerable<Ticket> RetrieveNextPage() { List<Ticket> result;

// The maximum number of tickets retrieved by this method is pageSize * number of DataMiner Agents in the DataMiner System.
if (PagingCookie == -1)
{
	result = Helper.NewPagingRequest(PageSize, out PagingCookie, out totalTickets, filter: TicketingExposers.DataMinerID.Equal(123)).ToList();
}

result = Helper.NextPagingRequest(PagingCookie).ToList();

if (result.Count < PageSize)
	PagingCookie = -1;

return result;

}

Instead of using the page number and calling a NewPagingRequest to retrieve the next page, we advise to use the NextPagingRequest(long) method instead.