Esempio n. 1
0
        public override void update()
        {
            HashSet<string> barcodesInSystem = new HashSet<string>();

            CswNbtMetaDataNodeType containerNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Container" );
            if( null != containerNT )
            {
                //check for any duplicate barcodes and make them unique
                foreach( CswNbtNode curContainer in containerNT.getNodes( false, true ) )
                {
                    CswNbtNodePropBarcode barCode = curContainer.Properties[CswNbtMetaDataFieldType.NbtFieldType.Barcode].AsBarcode;
                    while( barcodesInSystem.Contains( barCode.Barcode ) )
                    {
                        barCode.setBarcodeValueOverride( "", false ); //clear the barcode
                        barCode.setBarcodeValue(); //then let it go to the next sequence so it's %100 unique
                    }
                    barcodesInSystem.Add( barCode.Barcode );
                    curContainer.postChanges( false );
                }

                //make the barcode prop unique
                CswNbtMetaDataNodeTypeProp barcodeNTP = containerNT.getNodeTypeProp( CswNbtObjClassContainer.BarcodePropertyName );
                if( null != barcodeNTP )
                {
                    barcodeNTP.setIsUnique( true );
                }
            }
        }//Update()
 public override void update()
 {
     // Set Material Tradename to be unique for Constituents
     CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
     foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes() )
     {
         CswNbtMetaDataNodeTypeProp IsConstituentNTP = ChemicalNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent );
         if( CswEnumTristate.True == IsConstituentNTP.DefaultValue.AsLogical.Checked )
         {
             CswNbtMetaDataNodeTypeProp TradenameNTP = ChemicalNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.TradeName );
             TradenameNTP.setIsUnique( true );
         }
     }
 }