Esempio n. 1
0
        /// <summary>
        /// Creating log record and saving it to DB
        /// </summary>
        private void NewAuditRecord(Item curentity, string fieldName, string newValue, string oldValue)
        {
            string   entityType = curentity.GetType().ToString();
            string   tableName  = entityType.Substring(entityType.LastIndexOf('.') + 1);
            AuditLog record     = new AuditLog()
            {
                AuditID   = Guid.NewGuid(),
                EntityID  = curentity.Id,
                AuditDate = DateTime.Now,
                User      = currentUser.GetFullName(),
                TableName = tableName,
                FieldName = fieldName,
                NewValue  = newValue,
                OldValue  = oldValue
            };

            LogRepo.BeginTransaction();
            LogRepo.Save(record);
            LogRepo.Commit();
            LogRepo.Evict(record);
        }