示例#1
0
        public override void OnPut(string key, Newtonsoft.Json.Linq.JObject document, Newtonsoft.Json.Linq.JObject metadata, Raven.Http.TransactionInformation transactionInformation)
        {
            if (AuditContext.IsInAuditContext)
            {
                return;
            }

            using (AuditContext.Enter())
            {
                if (metadata.Value <string>("Raven-Entity-Name") == "People")
                {
                    if (metadata["CreatedByPersonId"] == null)
                    {
                        metadata["CreatedByPersonId"] = CurrentOperationContext.Headers.Value["CurrentUserPersonId"];
                        metadata["CreatedDate"]       = new DateTime(2011, 02, 19, 15, 00, 00);
                    }
                    else
                    {
                        metadata["LastUpdatedPersonId"] = CurrentOperationContext.Headers.Value["CurrentUserPersonId"];
                        metadata["LastUpdatedDate"]     = new DateTime(2011, 02, 19, 15, 00, 00);
                    }
                }
            }
        }
示例#2
0
        public override void OnPut(string key, RavenJObject document, RavenJObject metadata, TransactionInformation transactionInformation)
        {
            if (AuditContext.IsInAuditContext)
            {
                return;
            }

            using (AuditContext.Enter())
            {
                if (metadata.Value <string>("Raven-Entity-Name") == "People")
                {
                    if (metadata["CreatedByPersonId"] == null)
                    {
                        metadata["CreatedByPersonId"] = CurrentOperationContext.Headers.Value["CurrentUserPersonId"];
                        metadata["CreatedDate"]       = CreatedAtDateTime;
                    }
                    else
                    {
                        metadata["LastUpdatedPersonId"] = CurrentOperationContext.Headers.Value["CurrentUserPersonId"];
                        metadata["LastUpdatedDate"]     = CreatedAtDateTime;
                    }
                }
            }
        }