Example #1
0
        private void FixupSalesTerritory(SalesTerritory previousValue)
        {
            if (previousValue != null &&
                previousValue.StateProvinces.Contains(this))
            {
                previousValue.StateProvinces.Remove(this);
            }

            if (SalesTerritory != null)
            {
                if (!SalesTerritory.StateProvinces.Contains(this))
                {
                    SalesTerritory.StateProvinces.Add(this);
                }
                if (TerritoryID != SalesTerritory.TerritoryID)
                {
                    TerritoryID = SalesTerritory.TerritoryID;
                }
            }
        }
Example #2
0
        private void FixupSalesTerritory(SalesTerritory previousValue)
        {
            if (previousValue != null &&
                previousValue.SalesPersons.Contains(this))
            {
                previousValue.SalesPersons.Remove(this);
            }

            if (SalesTerritory != null)
            {
                if (!SalesTerritory.SalesPersons.Contains(this))
                {
                    SalesTerritory.SalesPersons.Add(this);
                }
                if (TerritoryID != SalesTerritory.TerritoryID)
                {
                    TerritoryID = SalesTerritory.TerritoryID;
                }
            }
            else if (!_settingFK)
            {
                TerritoryID = null;
            }
        }
        private void FixupSalesTerritory(SalesTerritory previousValue)
        {
            if (previousValue != null
                && previousValue.SalesOrderHeaders.Contains(this))
            {
                previousValue.SalesOrderHeaders.Remove(this);
            }

            if (SalesTerritory != null)
            {
                if (!SalesTerritory.SalesOrderHeaders.Contains(this))
                {
                    SalesTerritory.SalesOrderHeaders.Add(this);
                }
                if (TerritoryID != SalesTerritory.TerritoryID)
                {
                    TerritoryID = SalesTerritory.TerritoryID;
                }
            }
            else if (!_settingFK)
            {
                TerritoryID = null;
            }
        }
        private void FixupSalesTerritory(SalesTerritory previousValue)
        {
            if (previousValue != null
                && previousValue.SalesTerritoryHistories.Contains(this))
            {
                previousValue.SalesTerritoryHistories.Remove(this);
            }

            if (SalesTerritory != null)
            {
                if (!SalesTerritory.SalesTerritoryHistories.Contains(this))
                {
                    SalesTerritory.SalesTerritoryHistories.Add(this);
                }
                if (TerritoryID != SalesTerritory.TerritoryID)
                {
                    TerritoryID = SalesTerritory.TerritoryID;
                }
            }
        }