Пример #1
0
        public void AuditDelete(HRPaidTimeOffDataContext db, ref ENTValidationErrors validationErrors,
                                int userAccountId)
        {
            var auditObject = new ENTAuditObjectEO();

            if (auditObject.Load(db, this.GetType().Name))
            {
                var audit = new ENTAuditEO();
                audit.ObjectName = this.GetType().Name;
                audit.RecordId   = ID;
                audit.AuditType  = ENTAuditEO.AuditTypeEnum.Delete;
                audit.Save(db, ref validationErrors, userAccountId);
            }
        }
Пример #2
0
        public void AuditUpdate(HRPaidTimeOffDataContext db, ref ENTValidationErrors validationErrors,
                                int userAccountId)
        {
            foreach (var property in _originalPropertyValues)
            {
                object value = this.GetType().GetProperty(property.Name).GetValue(this, null);

                if (((value != null) && (property.Value != null)) &&
                    (Convert.ToString(value) != Convert.ToString(property.Value)))
                {
                    var audit = new ENTAuditEO();
                    audit.ObjectName   = this.GetType().Name;
                    audit.RecordId     = ID;
                    audit.PropertyName = property.Name;
                    audit.OldValue     = (property.Value == null ? null : Convert.ToString(property.Value));
                    audit.NewValue     = (Convert.ToString(value));
                    audit.AuditType    = ENTAuditEO.AuditTypeEnum.Update;
                    audit.Save(db, ref validationErrors, userAccountId);
                }
            }
        }