Esempio n. 1
0
        protected virtual void SaveAudits()
        {
            if (_auditable == null)
            {
                return;
            }

            if (AuditLog != null)
            {
                foreach (var msg in AuditLog.Values)
                {
                    var entry = Context.CreateCompoundObject <AuditEntry>();
                    entry.Identity      = "unbekannt";
                    entry.MessageFormat = "{0} geändert von '{1}' auf '{2}'";
                    entry.PropertyName  = msg.property;
                    entry.OldValue      = msg.oldValue == null ? String.Empty : msg.oldValue.ToString();
                    entry.NewValue      = msg.newValue == null ? String.Empty : msg.newValue.ToString();
                    _auditable.AuditJournal.Add(entry);
                }
                AuditLog.Clear();
            }
            else if (this.ObjectState == DataObjectState.New)
            {
                var entry = Context.CreateCompoundObject <AuditEntry>();
                entry.Identity      = "unbekannt";
                entry.MessageFormat = "object created";
                entry.PropertyName  = String.Empty;
                entry.OldValue      = String.Empty;
                entry.NewValue      = String.Empty;
                _auditable.AuditJournal.Add(entry);
            }
        }