12.2. Design

Before getting into the design of the audit trail for the Paid Time Off solution, let's review the requirements defined by Mary:

  • Anytime a record is added to the system, the user and date/time must be tracked by the system.

  • Anytime a record is deleted from the system, the user, date/time, and ID of the record being deleted must be tracked by the system.

  • Anytime a record is updated in the system, the before and after values for each field must be tracked by the system, as well as the user and date/time when the update occurred.

  • To avoid excess data in the database, the system must enable users to turn off auditing of specific data.

  • The system must enable users to run a report and filter by date, user, record, or type of change.

This is a fairly straightforward list of requirements for an audit trail in most enterprise-level applications. Three main areas need to be developed: The first is the capability to customize the audit trail by enabling users to select what is audited. Second, the audit trail needs to be implemented in the existing business objects. Third, the report that enables users to see the audit trail needs to be created. "The Design" section of this chapter will review the setup of the audit trail and "The Solution" section covers implementation and reporting of the audit trail.

12.2.1. Customizing the Audit Trail

Figure 12-1 shows how users will be able to turn on the audit trail to track changes of an object.

Figure 12.1. Figure 12-1

Notice that for ...

Get ASP.NET 3.5 Enterprise Application Development with Visual Studio® 2008: Problem - Design - Solution now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.