4.7.1. Filtering Data

Most secondary entities contain a field with the document creation date. To reduce the amount of retrieved data, the concept of a work period is usually introduced to filter the data sent to the client. A work period is a range of dates for which the records are required. Since the application can have more than one secondary entity, it makes sense to add variables containing the start and end dates of a work period to the global AppVariables data module (see Getting a Context that is used by all modules working with the database in one way or another. Once the application is started, the work period is usually defined by the dates when the current quarter starts and ends, although of course, other options are possible. While working with the application, the user can change the work period.

Since the most recent records are the most requested, it makes sense to sort them by date in reverse order. As with the primary modules, we will use LINQ to retrieve data.