Ejemplo n.º 1
0
        private void FixupSalesOrderHeader(SalesOrderHeader previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.SalesOrderDetails.Contains(this))
            {
                previousValue.SalesOrderDetails.Remove(this);
            }

            if (SalesOrderHeader != null)
            {
                if (!SalesOrderHeader.SalesOrderDetails.Contains(this))
                {
                    SalesOrderHeader.SalesOrderDetails.Add(this);
                }

                SalesOrderID = SalesOrderHeader.SalesOrderID;
            }
            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("SalesOrderHeader") &&
                    (ChangeTracker.OriginalValues["SalesOrderHeader"] == SalesOrderHeader))
                {
                    ChangeTracker.OriginalValues.Remove("SalesOrderHeader");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("SalesOrderHeader", previousValue);
                }
                if (SalesOrderHeader != null && !SalesOrderHeader.ChangeTracker.ChangeTrackingEnabled)
                {
                    SalesOrderHeader.StartTracking();
                }
            }
        }
Ejemplo n.º 2
0
        private void FixupSalesOrderHeader(SalesOrderHeader previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.SalesOrderDetails.Contains(this))
            {
                previousValue.SalesOrderDetails.Remove(this);
            }

            if (SalesOrderHeader != null)
            {
                if (!SalesOrderHeader.SalesOrderDetails.Contains(this))
                {
                    SalesOrderHeader.SalesOrderDetails.Add(this);
                }

                SalesOrderID = SalesOrderHeader.SalesOrderID;
            }
            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("SalesOrderHeader")
                    && (ChangeTracker.OriginalValues["SalesOrderHeader"] == SalesOrderHeader))
                {
                    ChangeTracker.OriginalValues.Remove("SalesOrderHeader");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("SalesOrderHeader", previousValue);
                }
                if (SalesOrderHeader != null && !SalesOrderHeader.ChangeTracker.ChangeTrackingEnabled)
                {
                    SalesOrderHeader.StartTracking();
                }
            }
        }