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); } }
protected void StorePropertyValues() { //Check if this object is being audited. var auditObject = new ENTAuditObjectEO(); if (auditObject.Load(this.GetType().Name)) { _originalPropertyValues = new ENTPropertyList(); //Store the property values to an internal list //Create an instance of the type. var properties = this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); foreach (var auditObjectProperty in auditObject.Properties) { //Name of property _originalPropertyValues.Add(new ENTProperty { Name = auditObjectProperty.PropertyName, Value = this.GetType().GetProperty(auditObjectProperty.PropertyName).GetValue(this, null) }); } } }