private void FixupAddress(Address previousValue) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.VendorAddresses.Contains(this)) { previousValue.VendorAddresses.Remove(this); } if (Address != null) { if (!Address.VendorAddresses.Contains(this)) { Address.VendorAddresses.Add(this); } AddressID = Address.AddressID; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("Address") && (ChangeTracker.OriginalValues["Address"] == Address)) { ChangeTracker.OriginalValues.Remove("Address"); } else { ChangeTracker.RecordOriginalValue("Address", previousValue); } if (Address != null && !Address.ChangeTracker.ChangeTrackingEnabled) { Address.StartTracking(); } } }
private void FixupAddress1(Address previousValue) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.SalesOrderHeaders1.Contains(this)) { previousValue.SalesOrderHeaders1.Remove(this); } if (Address1 != null) { if (!Address1.SalesOrderHeaders1.Contains(this)) { Address1.SalesOrderHeaders1.Add(this); } ShipToAddressID = Address1.AddressID; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("Address1") && (ChangeTracker.OriginalValues["Address1"] == Address1)) { ChangeTracker.OriginalValues.Remove("Address1"); } else { ChangeTracker.RecordOriginalValue("Address1", previousValue); } if (Address1 != null && !Address1.ChangeTracker.ChangeTrackingEnabled) { Address1.StartTracking(); } } }