Class AuditService
Inheritance
System.Object
Assembly: cs.temp.dll.dll
Syntax
public sealed class AuditService : RepositoryService
Constructors
AuditService(IScopeProvider, ILoggerFactory, IEventMessagesFactory, IAuditRepository, IAuditEntryRepository)
Declaration
public AuditService(IScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IAuditRepository auditRepository, IAuditEntryRepository auditEntryRepository)
Parameters
| Type |
Name |
Description |
| IScopeProvider |
provider |
|
| ILoggerFactory |
loggerFactory |
|
| IEventMessagesFactory |
eventMessagesFactory |
|
| IAuditRepository |
auditRepository |
|
| IAuditEntryRepository |
auditEntryRepository |
|
Methods
Add(AuditType, Int32, Int32, String, String, String)
Declaration
public void Add(AuditType type, int userId, int objectId, string entityType, string comment, string parameters = null)
Parameters
| Type |
Name |
Description |
| AuditType |
type |
|
| System.Int32 |
userId |
|
| System.Int32 |
objectId |
|
| System.String |
entityType |
|
| System.String |
comment |
|
| System.String |
parameters |
|
CleanLogs(Int32)
Declaration
public void CleanLogs(int maximumAgeOfLogsInMinutes)
Parameters
| Type |
Name |
Description |
| System.Int32 |
maximumAgeOfLogsInMinutes |
|
GetLogs(AuditType, Nullable<DateTime>)
Declaration
public IEnumerable<IAuditItem> GetLogs(AuditType type, DateTime? sinceDate = null)
Parameters
| Type |
Name |
Description |
| AuditType |
type |
|
| System.Nullable<System.DateTime> |
sinceDate |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<IAuditItem> |
|
GetLogs(Int32)
Declaration
public IEnumerable<IAuditItem> GetLogs(int objectId)
Parameters
| Type |
Name |
Description |
| System.Int32 |
objectId |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<IAuditItem> |
|
GetPagedItemsByEntity(Int32, Int64, Int32, out Int64, Direction, AuditType[], IQuery<IAuditItem>)
Returns paged items in the audit trail for a given entity
Declaration
public IEnumerable<IAuditItem> GetPagedItemsByEntity(int entityId, long pageIndex, int pageSize, out long totalRecords, Direction orderDirection = null, AuditType[] auditTypeFilter = null, IQuery<IAuditItem> customFilter = null)
Parameters
| Type |
Name |
Description |
| System.Int32 |
entityId |
|
| System.Int64 |
pageIndex |
|
| System.Int32 |
pageSize |
|
| System.Int64 |
totalRecords |
|
| Direction |
orderDirection |
By default this will always be ordered descending (newest first)
|
| AuditType[] |
auditTypeFilter |
Since we currently do not have enum support with our expression parser, we cannot query on AuditType in the query or the custom filter
so we need to do that here
|
| IQuery<IAuditItem> |
customFilter |
Optional filter to be applied
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<IAuditItem> |
|
GetPagedItemsByUser(Int32, Int64, Int32, out Int64, Direction, AuditType[], IQuery<IAuditItem>)
Returns paged items in the audit trail for a given user
Declaration
public IEnumerable<IAuditItem> GetPagedItemsByUser(int userId, long pageIndex, int pageSize, out long totalRecords, Direction orderDirection = null, AuditType[] auditTypeFilter = null, IQuery<IAuditItem> customFilter = null)
Parameters
| Type |
Name |
Description |
| System.Int32 |
userId |
|
| System.Int64 |
pageIndex |
|
| System.Int32 |
pageSize |
|
| System.Int64 |
totalRecords |
|
| Direction |
orderDirection |
By default this will always be ordered descending (newest first)
|
| AuditType[] |
auditTypeFilter |
Since we currently do not have enum support with our expression parser, we cannot query on AuditType in the query or the custom filter
so we need to do that here
|
| IQuery<IAuditItem> |
customFilter |
Optional filter to be applied
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<IAuditItem> |
|
GetUserLogs(Int32, AuditType, Nullable<DateTime>)
Declaration
public IEnumerable<IAuditItem> GetUserLogs(int userId, AuditType type, DateTime? sinceDate = null)
Parameters
| Type |
Name |
Description |
| System.Int32 |
userId |
|
| AuditType |
type |
|
| System.Nullable<System.DateTime> |
sinceDate |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<IAuditItem> |
|
Write(Int32, String, String, DateTime, Int32, String, String, String)
Declaration
public IAuditEntry Write(int performingUserId, string perfomingDetails, string performingIp, DateTime eventDateUtc, int affectedUserId, string affectedDetails, string eventType, string eventDetails)
Parameters
| Type |
Name |
Description |
| System.Int32 |
performingUserId |
|
| System.String |
perfomingDetails |
|
| System.String |
performingIp |
|
| System.DateTime |
eventDateUtc |
|
| System.Int32 |
affectedUserId |
|
| System.String |
affectedDetails |
|
| System.String |
eventType |
|
| System.String |
eventDetails |
|
Returns
| Type |
Description |
| IAuditEntry |
|