public void OnCurrentWorkUnitPropertyChange(CswNbtNodeProp Prop, bool Creating) { CswPrimaryKey UsersCurrentWorkUnitId = CurrentWorkUnitId; //Case 30817 //if( null != UsersWorkUnitId ) if (false == CswTools.IsPrimaryKey(UsersCurrentWorkUnitId)) { UsersCurrentWorkUnitId = GetFirstAvailableWorkUnitNodeId(); } if (false == AvailableWorkUnits.CheckValue(UsersCurrentWorkUnitId.ToString())) { if (false == _CswNbtResources.CurrentNbtUser is CswNbtSystemUser && _CswNbtResources.CurrentNbtUser.Username != ChemSWAdminUsername) { throw new CswDniException(CswEnumErrorType.Warning, CurrentWorkUnitProperty.CachedNodeName + " is not an available Work Unit for user " + Username, _CswNbtResources.CurrentNbtUser.Username + " attempted to assign User: "******" to Work Unit: " + UsersCurrentWorkUnitId + " when Users available Work Units are: " + AvailableWorkUnits.Value); } // We add the work unit to the list and then check it! AvailableWorkUnits.AddValue(UsersCurrentWorkUnitId.ToString()); CurrentWorkUnitProperty.RelatedNodeId = UsersCurrentWorkUnitId; CurrentWorkUnitProperty.SyncGestalt(); _updateAvailableWorkUnits(); } }