public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e) { base.CommandPreparing(sender, e); if (e.Row == null) { return; } bool insert = (e.Operation & PXDBOperation.Command) == PXDBOperation.Insert; bool update = (e.Operation & PXDBOperation.Command) == PXDBOperation.Update; if (insert || update) { object currentValue = sender.GetValue(e.Row, _valueField.Name); if (Equals(currentValue, _expectedValue)) { if (e.Value == null) { e.DataType = PXDbType.UniqueIdentifier; e.DataValue = PXAccess.GetTrueUserID(); } else { e.ExcludeFromInsertUpdate(); } } else { e.DataValue = null; } } }
protected void LogOperation(Type tableName, string combinedKey) { PXDatabase.Insert <SMPersonalDataLog>( new PXDataFieldAssign <SMPersonalDataLog.tableName>(tableName.FullName), new PXDataFieldAssign <SMPersonalDataLog.combinedKey>(combinedKey), new PXDataFieldAssign <SMPersonalDataLog.pseudonymizationStatus>(SetPseudonymizationStatus), new PXDataFieldAssign <SMPersonalDataLog.createdByID>(PXAccess.GetTrueUserID()), new PXDataFieldAssign <SMPersonalDataLog.createdDateTime>(PXTimeZoneInfo.UtcNow) ); }
public virtual void RowPersisted(PXCache sender, PXRowPersistedEventArgs e) { bool insert = (e.Operation & PXDBOperation.Command) == PXDBOperation.Insert; bool update = (e.Operation & PXDBOperation.Command) == PXDBOperation.Update; if ((insert || update) && e.TranStatus == PXTranStatus.Completed) { object currentValue = sender.GetValue(e.Row, _valueField.Name); if (Equals(currentValue, _expectedValue)) { if (sender.GetValue(e.Row, _FieldOrdinal) == null) { sender.SetValue(e.Row, _FieldOrdinal, PXAccess.GetTrueUserID()); } } else { sender.SetValue(e.Row, _FieldOrdinal, null); } } }