private static AuditEntity CreateAuditEntity()
 {
     var entity = new AuditEntity();
     entity.AuditEntityAction = AuditEntityAction.Add;
     entity.EntityIdentifier = Guid.NewGuid().ToString();
     entity.EntityType = Guid.NewGuid().ToString();
     entity.AuditEntityProperties = new Collection<AuditEntityProperty>();
     for (var i = 0; i >= 3; i++)
     {
         var property = new AuditEntityProperty();
         property.PropertyName = Guid.NewGuid().ToString();
         property.NewValue = Guid.NewGuid().ToString();
         entity.AuditEntityProperties.Add(property);
     }
     return entity;
 }
Example #2
0
        public void Run()
        {
            int counter = 0;
            Output("Press Enter to publish an audit event");
            while (Console.ReadLine() != null)
            {
                String subscriptionId = Guid.Empty.ToString();
                if (++counter % 2 == 0)
                {
                    subscriptionId = "7FD0769B-59C2-40EA-AA4A-F29ABA02DB6D";
                }
                Output("subscription " + subscriptionId);

                var auditEvent = new AuditEvent
                {
                    ClientIP = "127.0.0.1",
                    Url = "http://localhost",
                    UserName = "******",
                    DateOccurred = DateTime.UtcNow,
                    SiteSubscriptionId = subscriptionId,
                    AuditEntities = new Collection<AuditEntity>()
                };

                var entity = new AuditEntity { AuditEntityProperties = new Collection<AuditEntityProperty>() };
                entity.EntityIdentifier = "123";
                entity.AuditEntityAction = AuditEntityAction.Update;
                entity.EntityType = "MEDSEEK.eHealth.Framework.DAL.Common.Profile";
                entity.AuditEntityProperties.Add(new AuditEntityProperty { NewValue = "Jack", OriginalValue = "John", PropertyName = "FirstName" });
                entity.AuditEntityProperties.Add(new AuditEntityProperty { NewValue = null, OriginalValue = DateTime.Now.ToString(), PropertyName = "DateOfBirth" });
                auditEvent.AuditEntities.Add(entity);

                var message = Bus.CreateInstance<IAuditMessage>();
                message.AuditEvent = auditEvent;

                Bus.Publish(message);
                Output("Published message");
            }

            Console.ReadLine();
        }
 private static AuditEntity CreateAuditEntity()
 {
     var entity = new AuditEntity();
     entity.AuditEntityAction = AuditEntityAction.Read;
     entity.EntityIdentifier = "1";
     entity.EntityType = typeof(string).Name;
     return entity;
 }