2022-02-03 11:16:34 +00:00
|
|
|
namespace ASC.AuditTrail.Models;
|
|
|
|
|
|
|
|
public class BaseEvent
|
2020-10-06 07:06:05 +00:00
|
|
|
{
|
2022-02-03 11:16:34 +00:00
|
|
|
public int Id { get; set; }
|
|
|
|
public int TenantId { get; set; }
|
|
|
|
public Guid UserId { get; set; }
|
|
|
|
public bool Mobile { get; set; }
|
|
|
|
public IList<string> Description { get; set; }
|
2020-10-06 07:06:05 +00:00
|
|
|
|
2022-02-03 11:16:34 +00:00
|
|
|
[Event("IpCol")]
|
|
|
|
public string Ip { get; set; }
|
2020-10-06 07:06:05 +00:00
|
|
|
|
2022-02-03 11:16:34 +00:00
|
|
|
[Event("BrowserCol")]
|
|
|
|
public string Browser { get; set; }
|
2020-10-06 07:06:05 +00:00
|
|
|
|
2022-02-03 11:16:34 +00:00
|
|
|
[Event("PlatformCol")]
|
|
|
|
public string Platform { get; set; }
|
2020-10-06 07:06:05 +00:00
|
|
|
|
2022-02-03 11:16:34 +00:00
|
|
|
[Event("DateCol")]
|
|
|
|
public DateTime Date { get; set; }
|
2020-10-06 07:06:05 +00:00
|
|
|
|
2022-02-03 11:16:34 +00:00
|
|
|
[Event("UserCol")]
|
|
|
|
public string UserName { get; set; }
|
2020-10-06 07:06:05 +00:00
|
|
|
|
2022-02-03 11:16:34 +00:00
|
|
|
[Event("PageCol")]
|
|
|
|
public string Page { get; set; }
|
2020-10-06 07:06:05 +00:00
|
|
|
|
2022-02-03 11:16:34 +00:00
|
|
|
[Event("ActionCol")]
|
|
|
|
public string ActionText { get; set; }
|
|
|
|
}
|
2020-10-06 07:06:05 +00:00
|
|
|
|
2022-02-03 11:16:34 +00:00
|
|
|
internal class BaseEventMap<T> : ClassMap<T> where T : BaseEvent
|
|
|
|
{
|
|
|
|
public BaseEventMap()
|
2020-10-06 07:06:05 +00:00
|
|
|
{
|
2022-02-03 11:16:34 +00:00
|
|
|
var eventType = typeof(T);
|
|
|
|
var eventProps = eventType
|
|
|
|
.GetProperties()
|
|
|
|
.Where(r => r.GetCustomAttribute<EventAttribute>() != null)
|
|
|
|
.OrderBy(r => r.GetCustomAttribute<EventAttribute>().Order);
|
|
|
|
|
|
|
|
foreach (var prop in eventProps)
|
2020-10-06 07:06:05 +00:00
|
|
|
{
|
2022-02-03 11:16:34 +00:00
|
|
|
var attr = prop.GetCustomAttribute<EventAttribute>().Resource;
|
|
|
|
Map(eventType, prop).Name(AuditReportResource.ResourceManager.GetString(attr));
|
2020-10-06 07:06:05 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-03 11:16:34 +00:00
|
|
|
}
|