Exemplo n.º 1
0
        //FOR NOW - THERE's NO OPTION WITH changes AND entity (as a shortcut) because this is a very uncommon case - if you're sending the entity, it's either new or deleted, but it wouldn't have changes
        //if you really want that last combo - use the full method call


        public async Task Enqueue <T>(string entityType, object entityId, AuditActivityType type, object userId, string userName, string auditDescription, List <RelatedEntity> related, List <PropertyComparison> changes, T entity)
        {
            if (ServiceManager.IsEnabled)
            {
                //1 item is built and queued, the queue will handle the details
                var a = new AuditActivity(entityType, entityId)
                {
                    AuditType   = type.ToString(),
                    ById        = userId.ToString(),
                    ByName      = userName,
                    Description = auditDescription
                };

                if (changes != null && changes.Count > 0)
                {
                    a.Changes = System.Text.Json.JsonSerializer.Serialize(changes);
                }
                if (entity != null)
                {
                    a.Entity = System.Text.Json.JsonSerializer.Serialize(entity);
                }
                if (related != null && related.Count > 0)
                {
                    a.Related = System.Text.Json.JsonSerializer.Serialize(related);
                }

                await AuditQueue.SendMessageAsync(System.Text.Json.JsonSerializer.Serialize(a).ToBase64());
            }
        }
Exemplo n.º 2
0
        public AuditActivity(string entityType, object entityId, AuditActivityType type)
        {
            EntityType = entityType.ToLowerInvariant();
            EntityId   = entityId.ToString().ToLowerInvariant();

            PartitionKey = $"{EntityType}_{EntityId}";
            this.SetRowKeyToReverseTicks();
            AuditType = type.ToString();
        }
Exemplo n.º 3
0
 public async Task Enqueue <T>(string entityType, object entityId, AuditActivityType type, object userId, string userName, string auditDescription, List <RelatedEntity> related, T entity)
 {
     await Enqueue(entityType, entityId, type, userId, userName, auditDescription, related, null, entity);
 }
Exemplo n.º 4
0
 public async Task Enqueue <T>(string entityType, object entityId, AuditActivityType type, object userId, string userName, T entity)
 {
     await Enqueue(entityType, entityId, type, userId, userName, null, null, null, entity);
 }
Exemplo n.º 5
0
 public async Task Enqueue(string entityType, object entityId, AuditActivityType type, object userId, string userName, List <RelatedEntity> related, List <PropertyComparison> changes)
 {
     await Enqueue(entityType, entityId, type, userId, userName, null, related, changes, default(object));
 }
Exemplo n.º 6
0
 public async Task Enqueue(string entityType, object entityId, AuditActivityType type, object userId, string userName, List <RelatedEntity> related)
 {
     await Enqueue(entityType, entityId, type, userId, userName, null, related, null, default(object));
 }
Exemplo n.º 7
0
 public async Task Enqueue(string entityType, object entityId, AuditActivityType type, object userId, string userName, string auditDescription, List <PropertyComparison> changes)
 {
     await Enqueue(entityType, entityId, type, userId, userName, auditDescription, null, changes, default(object));
 }
Exemplo n.º 8
0
 public async Task Enqueue(string entityType, object entityId, AuditActivityType type, object userId, string userName, string auditDescription)
 {
     await Enqueue(entityType, entityId, type, userId, userName, auditDescription, null, null, default(object));
 }