Beispiel #1
0
 public override void update()
 {
     CswNbtMetaDataObjectClass DocumentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.DocumentClass );
     CswNbtMetaDataNodeType SDSNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( DocumentOC )
     {
         NodeTypeName = "SDS Document",
         Category = "Materials"
     } );
     CswNbtMetaDataNodeTypeProp TradeNameNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner );
     CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
     if( null != ChemicalNT )
     {
         TradeNameNTP.SetFK( NbtViewRelatedIdType.NodeTypeId.ToString(), ChemicalNT.NodeTypeId );
     }
     TradeNameNTP.PropName = "Tradename";
     CswNbtMetaDataNodeTypeProp RevisionDateNTP =
         _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp(
             SDSNT,
             _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.DateTime ),
             "Revision Date" )
         );
     CswNbtMetaDataNodeTypeProp LanguageNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Language );
     LanguageNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, SDSNT.getFirstNodeTypeTab().TabId );
     CswNbtMetaDataNodeTypeProp FormatNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Format );
     FormatNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, SDSNT.getFirstNodeTypeTab().TabId );
     SDSNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassDocument.PropertyName.Title ) );
     
     foreach( CswNbtMetaDataNodeType DocNT in DocumentOC.getNodeTypes() )
     {
         CswNbtMetaDataNodeTypeProp DocClassNTP = DocNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.DocumentClass );
         DocClassNTP.removeFromAllLayouts();
     }
 } //Update()
        public override void update()
        {
            //Create Time Unit view and apply it to every Expiration Interval ObjectClassprop

            //Create the new view
            CswNbtMetaDataNodeType TimeNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Time Unit" );

            //Set ExpirationInterval ObjectClassProp default FKValue to Time Unit NodeType (so that new material NodeTypes will start with this Unit NodeType restriction)
            CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass );
            CswNbtMetaDataObjectClassProp ExpirationInterval = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProp( MaterialOC.ObjectClassId, CswNbtObjClassMaterial.ExpirationIntervalPropertyName );

            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ExpirationInterval, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isfk, true );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ExpirationInterval, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.fktype, NbtViewRelatedIdType.NodeTypeId.ToString() );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ExpirationInterval, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.fkvalue, TimeNT.NodeTypeId );

            //Update existing ExpirationInterval NodeTypeProps to use new Time view
            foreach( CswNbtMetaDataNodeType NodeType in MaterialOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp ExpInt = NodeType.getNodeTypeProp( "Expiration Interval" );
                CswNbtView TimeView = _CswNbtSchemaModTrnsctn.restoreView( ExpInt.ViewId );
                TimeView.Root.ChildRelationships.Clear();
                TimeView.ViewName = "CswNbtNodeTypePropExpirationInterval_" + ExpInt.PropId.ToString();
                TimeView.AddViewRelationship( TimeNT, true );
                TimeView.save();
                ExpInt.SetFK( NbtViewRelatedIdType.NodeTypeId.ToString(), TimeNT.NodeTypeId );
            }

        }//Update()
Beispiel #3
0
        public override void update()
        {

            //add supplier and catalog number to size name template
            CswNbtMetaDataNodeType sizeNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Size" );
            if( null != sizeNT )
            {
                CswNbtMetaDataNodeTypeProp materialNTP = sizeNT.getNodeTypeProp( CswNbtObjClassSize.MaterialPropertyName );
                CswNbtMetaDataObjectClass materialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( materialNTP.FKValue );
                CswNbtMetaDataObjectClassProp supplierOCP = materialOC.getObjectClassProp( CswNbtObjClassMaterial.SupplierPropertyName );

                CswNbtMetaDataObjectClass sizeOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.SizeClass );
                CswNbtMetaDataObjectClassProp materialOCP = sizeOC.getObjectClassProp( CswNbtObjClassSize.MaterialPropertyName );

                CswNbtMetaDataNodeTypeTab sizeTab = _getTab( sizeNT, "Size", 1 );

                CswNbtMetaDataNodeTypeProp sizeSupplierNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( sizeNT, CswNbtMetaDataFieldType.NbtFieldType.PropertyReference, "Supplier", sizeTab.TabId );
                sizeSupplierNTP.SetFK( NbtViewPropIdType.ObjectClassPropId.ToString(), materialOCP.PropId, NbtViewPropIdType.ObjectClassPropId.ToString(), supplierOCP.PropId );

                string templateText = sizeNT.NameTemplateValue;
                templateText += CswNbtMetaData.MakeTemplateEntry( sizeSupplierNTP.PropName ); //add supplier (NTP) name to template
                templateText += " " + CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassSize.CatalogNoPropertyName ); //add catalog number to name template
                sizeNT.setNameTemplateText( templateText );

            }

        }//Update()
 public override void update()
 {
     //New Document NT
     CswNbtMetaDataObjectClass ReceiptLotOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ReceiptLotClass );
     CswNbtMetaDataObjectClass CofADocOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.CofADocumentClass );
     CswNbtMetaDataNodeType CofANT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "C of A Document" ) ??
          _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeTypeDeprecated( CofADocOC.ObjectClassId, "C of A Document", "Materials" );
     _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswEnumNbtModuleName.CofA, CofANT.NodeTypeId );
     //Default Title
     CswNbtMetaDataNodeTypeProp TitleNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Title );
     TitleNTP.DefaultValue.AsText.Text = "Certificate of Analysis";
     TitleNTP.removeFromLayout( CswEnumNbtLayoutType.Add );
     //Set Owner FK to ReceiptLot OC (This needs to be done explicitly for the NTP - see Case 26605)
     CswNbtMetaDataNodeTypeProp OwnerNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner );
     OwnerNTP.PropName = "Receipt Lot";
     OwnerNTP.SetFK( CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), ReceiptLotOC.ObjectClassId );
     //Set Prop Filters (This needs to be done explicitly for the NTP - see Case 26605)
     CswNbtMetaDataNodeTypeProp FileTypeNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.FileType );
     CswNbtMetaDataNodeTypeProp FileNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.File );
     FileNTP.setFilter( FileTypeNTP, FileTypeNTP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswNbtPropertySetDocument.CswEnumDocumentFileTypes.File );
     CswNbtMetaDataNodeTypeProp LinkNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Link );
     LinkNTP.setFilter( FileTypeNTP, FileTypeNTP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswNbtPropertySetDocument.CswEnumDocumentFileTypes.Link );
     //NT Permission
     CswNbtObjClassRole RoleNode = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Admin" );
     if( null != RoleNode )
     {
         _CswNbtSchemaModTrnsctn.Permit.set( NTPermissions, CofANT, RoleNode, true );
     }
 } // update()
        private void _createNewSDSDocNT()
        {
            CswEnumNbtNodeTypePermission[] NTPermissions = 
            { 
                CswEnumNbtNodeTypePermission.View, 
                CswEnumNbtNodeTypePermission.Create, 
                CswEnumNbtNodeTypePermission.Edit, 
                CswEnumNbtNodeTypePermission.Delete 
            };

            //New Document NT
            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            CswNbtMetaDataObjectClass DocumentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.SDSDocumentClass );
            CswNbtMetaDataNodeType SDSNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( DocumentOC.ObjectClassId, "SDS Document", "Materials" );
            _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswEnumNbtModuleName.SDS, SDSNT.NodeTypeId );
            //Default Title
            CswNbtMetaDataNodeTypeProp TitleNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Title );
            TitleNTP.DefaultValue.AsText.Text = "Safety Data Sheet";
            TitleNTP.removeFromLayout( CswEnumNbtLayoutType.Add );
            //Set Owner FK to Material OC (This needs to be done explicitly for the NTP - see Case 26605)
            CswNbtMetaDataNodeTypeProp OwnerNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner );
            OwnerNTP.PropName = "Material";
            OwnerNTP.SetFK( CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), ChemicalOC.ObjectClassId );
            //NT Permission
            CswNbtObjClassRole RoleNode = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Admin" );
            if( null != RoleNode )
            {
                _CswNbtSchemaModTrnsctn.Permit.set( NTPermissions, SDSNT, RoleNode, true );
            }
        }
Beispiel #6
0
        } // update()

        private void setPropFK( String RelatedClassName, String RelatedPropName, String RelatedNodeTypeName, bool isChemicalOnly = false )
        {
            String RelatedIdType = isChemicalOnly ? CswEnumNbtViewRelatedIdType.ObjectClassId.ToString() : CswEnumNbtViewRelatedIdType.PropertySetId.ToString();
            Int32 RelatedId = isChemicalOnly ? ChemicalOC.ObjectClassId : MaterialPS.PropertySetId;

            CswNbtMetaDataObjectClass RelatedOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( RelatedClassName );
            CswNbtMetaDataObjectClassProp MaterialOCP = RelatedOC.getObjectClassProp( RelatedPropName );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( MaterialOCP, CswEnumNbtObjectClassPropAttributes.fktype, RelatedIdType );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( MaterialOCP, CswEnumNbtObjectClassPropAttributes.fkvalue, RelatedId );
            CswNbtMetaDataNodeType RelatedNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( RelatedNodeTypeName );
            if( null != RelatedNT )
            {
                CswNbtMetaDataNodeTypeProp MaterialNTP = RelatedNT.getNodeTypePropByObjectClassProp( RelatedPropName );
                MaterialNTP.SetFK( RelatedIdType, RelatedId );
            }
        }
        /// <summary>
        /// The actual update call
        /// </summary>
        public override void update()
        {
            CswNbtMetaDataObjectClass UoMOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.UnitOfMeasureClass);
            CswNbtView UoMView = UoMOC.CreateDefaultView();
            CswNbtMetaDataObjectClass     RegListCasNoOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.RegulatoryListCasNoClass);
            CswNbtMetaDataObjectClassProp TPQOCP         = RegListCasNoOC.getObjectClassProp(CswNbtObjClassRegulatoryListCasNo.PropertyName.TPQ);

            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(TPQOCP, CswEnumNbtObjectClassPropAttributes.isfk, true);
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(TPQOCP, CswEnumNbtObjectClassPropAttributes.fktype, CswEnumNbtViewRelatedIdType.ObjectClassId.ToString());
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(TPQOCP, CswEnumNbtObjectClassPropAttributes.fkvalue, UoMOC.ObjectClassId);
            foreach (CswNbtMetaDataNodeType RegListCasNoNT in RegListCasNoOC.getNodeTypes())
            {
                CswNbtMetaDataNodeTypeProp TPQNTP = RegListCasNoNT.getNodeTypePropByObjectClassProp(TPQOCP);
                TPQNTP.ViewId = UoMView.ViewId;
                TPQNTP.SetFK(CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), UoMOC.ObjectClassId);
            }
        }
        public override void update()
        {
            CswPrimaryKey HMISTotalsReportId = null;
            CswPrimaryKey HMISMaterialsReportId = null;

            CswNbtMetaDataObjectClass ReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ReportClass );

            CswNbtSearch FindReport = _CswNbtSchemaModTrnsctn.CswNbtSearch;
            FindReport.addFilter( ReportOC, false );
            FindReport.SearchType = CswEnumSqlLikeMode.Begins;
            FindReport.SearchTerm = "HMIS";
            ICswNbtTree SearchResults = FindReport.Results();
            for( Int32 r = 0; r < SearchResults.getChildNodeCount(); r++ )
            {
                SearchResults.goToNthChild( r );
                string ReportName = SearchResults.getNodeNameForCurrentPosition();
                if( ReportName == "HMIS Totals" )
                {
                    HMISTotalsReportId = SearchResults.getNodeIdForCurrentPosition();
                }
                if( ReportName == "HMIS Materials" )
                {
                    HMISMaterialsReportId = SearchResults.getNodeIdForCurrentPosition();
                }
                SearchResults.goToParentNode();
            } // for( Int32 r = 0; r < SearchResults.getChildNodeCount(); r++ )

            CswNbtMetaDataObjectClass ControlZoneOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ControlZoneClass );
            foreach( CswNbtMetaDataNodeType ControlZoneNT in ControlZoneOC.getNodeTypes() )
            {
                if( CswTools.IsPrimaryKey( HMISTotalsReportId ) )
                {
                    CswNbtMetaDataNodeTypeProp HMISTotalsNTP = ControlZoneNT.getNodeTypePropByObjectClassProp( CswNbtObjClassControlZone.PropertyName.HMISTotals );
                    HMISTotalsNTP.SetFK( "nodeid", HMISTotalsReportId.PrimaryKey );
                    HMISTotalsNTP.removeFromLayout( CswEnumNbtLayoutType.Add );
                }
                if( CswTools.IsPrimaryKey( HMISMaterialsReportId ) )
                {
                    CswNbtMetaDataNodeTypeProp HMISMaterialsNTP = ControlZoneNT.getNodeTypePropByObjectClassProp( CswNbtObjClassControlZone.PropertyName.HMISMaterials );
                    HMISMaterialsNTP.SetFK( "nodeid", HMISMaterialsReportId.PrimaryKey );
                    HMISMaterialsNTP.removeFromLayout( CswEnumNbtLayoutType.Add );
                }
            } // foreach( CswNbtMetaDataNodeType ControlZoneNT in ControlZoneOC.getNodeTypes() )

        } // update()
Beispiel #9
0
        public override void update()
        {
            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );

            CswNbtMetaDataNodeType ConstituentNT = null;
            Collection<CswNbtMetaDataNodeType> ChemicalNTs = new Collection<CswNbtMetaDataNodeType>();
            foreach( CswNbtMetaDataNodeType NodeType in _CswNbtSchemaModTrnsctn.MetaData.getNodeTypes( CswEnumNbtObjectClass.ChemicalClass ) )
            {
                if( NodeType.NodeTypeName == "Constituent" )
                {
                    ConstituentNT = NodeType;
                }
                else
                {
                    ChemicalNTs.Add( NodeType );
                }
            }

            if( null != ConstituentNT && ChemicalNTs.Count > 0 )
            {
                //4. Change Components Consituent property to point to the Constituent NT
                CswNbtMetaDataObjectClass ComponentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.MaterialComponentClass );

                // Only Constituents for 'Constituent' property
                CswNbtMetaDataObjectClassProp ComponentConstituentOCP = ComponentOC.getObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Constituent );
                {
                    CswNbtView ocConstituentView = _CswNbtSchemaModTrnsctn.makeView();
                    ocConstituentView.ViewName = "Constituent View";
                    CswNbtViewRelationship rel1 = ocConstituentView.AddViewRelationship( ChemicalOC, false );
                    ocConstituentView.AddViewPropertyAndFilter( rel1,
                                                                ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ),
                                                                FilterMode: CswEnumNbtFilterMode.Equals,
                                                                Value: CswEnumTristate.True.ToString() );
                    _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ComponentConstituentOCP, CswEnumNbtObjectClassPropAttributes.viewxml, ocConstituentView.ToString() );
                }
                // Exclude Constituents from 'Mixture' property
                CswNbtMetaDataObjectClassProp ComponentMixtureOCP = ComponentOC.getObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Mixture );
                {
                    CswNbtView ocMixtureView = _CswNbtSchemaModTrnsctn.makeView();
                    ocMixtureView.ViewName = "Mixture View";
                    CswNbtViewRelationship rel2 = ocMixtureView.AddViewRelationship( ChemicalOC, false );
                    ocMixtureView.AddViewPropertyAndFilter( rel2,
                                                            ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ),
                                                            FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                            Value: CswEnumTristate.True.ToString() );
                    _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ComponentMixtureOCP, CswEnumNbtObjectClassPropAttributes.viewxml, ocMixtureView.ToString() );
                }
                // Fix views on existing nodetypes
                foreach( CswNbtMetaDataNodeType ComponentNT in ComponentOC.getNodeTypes() )
                {
                    // Only Constituents for 'Constituent' property
                    {
                        CswNbtMetaDataNodeTypeProp ComponentConstituentNTP = ComponentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Constituent );
                        ComponentConstituentNTP.SetFK( CswEnumNbtViewRelatedIdType.NodeTypeId.ToString(), ConstituentNT.NodeTypeId );

                        CswNbtView ntConstituentView = _CswNbtSchemaModTrnsctn.restoreView( ComponentConstituentNTP.ViewId );
                        ntConstituentView.Root.ChildRelationships.Clear();
                        CswNbtViewRelationship rel3 = ntConstituentView.AddViewRelationship( ConstituentNT, false );
                        //ntConstituentView.AddViewPropertyAndFilter( rel3,
                        //                                            ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ),
                        //                                            FilterMode: CswEnumNbtFilterMode.Equals,
                        //                                            Value: CswEnumTristate.True.ToString() );
                        ntConstituentView.save();
                    }
                    // Exclude Constituents from 'Mixture' property
                    {
                        CswNbtMetaDataNodeTypeProp ComponentMixtureNTP = ComponentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Mixture );
                        CswNbtView ntMixtureView = _CswNbtSchemaModTrnsctn.restoreView( ComponentMixtureNTP.ViewId );
                        ntMixtureView.Root.ChildRelationships.Clear();
                        CswNbtViewRelationship rel4 = ntMixtureView.AddViewRelationship( ChemicalOC, false );
                        ntMixtureView.AddViewPropertyAndFilter( rel4,
                                                                ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ),
                                                                FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                                Value: CswEnumTristate.True.ToString() );
                        ntMixtureView.save();
                    }
                } // foreach( CswNbtMetaDataNodeType ComponentNT in ComponentOC.getNodeTypes() )

                //// Fix Chemical Components Grid
                //foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalNTs )
                //{
                //    CswNbtMetaDataNodeTypeProp ComponentsGridNTP = ChemicalNT.getNodeTypeProp( "Components" );
                //    if( null != ComponentsGridNTP )
                //    {
                //        CswNbtMetaDataObjectClassProp ComponentPercentOCP = ComponentOC.getObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Percentage );

                //        CswNbtView ComponentsGridView = _CswNbtSchemaModTrnsctn.restoreView( ComponentsGridNTP.ViewId );
                //        ComponentsGridView.Root.ChildRelationships.Clear();
                //        CswNbtViewRelationship ChemRel = ComponentsGridView.AddViewRelationship( ChemicalNT, false );
                //        CswNbtViewRelationship MixRel = ComponentsGridView.AddViewRelationship( ChemRel, CswEnumNbtViewPropOwnerType.Second, ComponentMixtureOCP, false );
                //        ComponentsGridView.AddViewProperty( MixRel, ComponentConstituentOCP, 1 );
                //        ComponentsGridView.AddViewProperty( MixRel, ComponentPercentOCP, 2 );
                //        ComponentsGridView.save();
                //    }
                //} // foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalNTs )


                // 6. Update any views or props that point to the Chemical ObjClass to point to the Chemical NT. 
                // We don't want Constituent Chemicals to show as the target for things like Requests Material or Size Owner.

                string Sql = @"select ocp.propname, oc.objectclass, t.nodetypename, p.propname, p.nodetypepropid, p.fktype, p.fkvalue
                                 from nodetype_props p
                                 join nodetypes t on p.nodetypeid = t.nodetypeid
                                 join object_class oc on t.objectclassid = oc.objectclassid
                                 left outer join object_class_props ocp on p.objectclasspropid = ocp.objectclasspropid
                                 join field_types f on p.fieldtypeid = f.fieldtypeid
                                where (    ( p.fktype = 'PropertySetId' and p.fkvalue = (select propertysetid from property_set where name = 'MaterialSet' ) )
                                        or ( p.fktype = 'ObjectClassId' and p.fkvalue = (select objectclassid from object_class where objectclass = 'ChemicalClass' ) )
                                        or ( p.fktype = 'NodeTypeId' and p.fkvalue = (select nodetypeid from nodetypes where nodetypename = 'Chemical' ) ) 
                                      )
                                  and f.fieldtype = 'Relationship'
                                  and ( p.objectclasspropid is null 
                                        or not (    ( oc.objectclass = 'GHSClass' and ocp.propname = 'Material' )
                                                 or ( oc.objectclass = 'MaterialComponentClass' and ocp.propname = 'Mixture' ) 
                                                 or ( oc.objectclass = 'MaterialComponentClass' and ocp.propname = 'Constituent' ) 
                                                 or ( oc.objectclass = 'DocumentClass' and ocp.propname = 'Owner' ) 
                                               )
                                      )";
                CswArbitrarySelect Select = _CswNbtSchemaModTrnsctn.makeCswArbitrarySelect( "29680_relationship_select", Sql );
                DataTable Table = Select.getTable();

                /*    
                    MaterialSynonymClass                Material	
                    SizeClass                           Material	
                    ContainerClass                      Material	
                    InventoryLevelClass                 Material	
                    CofAMethodTemplateClass             Material	
                    ManufacturerEquivalentPartClass     Material	
                    ReceiptLotClass                     Material	
                    RequestContainerDispenseClass       Material	
                    RequestContainerUpdateClass         Material	
                    RequestMaterialCreateClass          Material	
                    RequestMaterialDispenseClass        Material	
                */

                foreach( DataRow Row in Table.Rows )
                {

                    CswNbtMetaDataNodeTypeProp Prop = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( CswConvert.ToInt32( Row["nodetypepropid"] ) );
                    CswNbtView View = _CswNbtSchemaModTrnsctn.restoreView( Prop.ViewId );
                    if( View.Root.ChildRelationships.Count == 0 )
                    {
                        // The 'Default Filter' will filter out constituents for us
                        if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.NodeTypeId.ToString() )
                        {
                            View.AddViewRelationship( _CswNbtSchemaModTrnsctn.MetaData.getNodeType( CswConvert.ToInt32( Row["fkvalue"] ) ), true );
                        }
                        else if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.ObjectClassId.ToString() )
                        {
                            View.AddViewRelationship( _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswConvert.ToInt32( Row["fkvalue"] ) ), true );
                        }
                        else if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.PropertySetId.ToString() )
                        {
                            View.AddViewRelationship( _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswConvert.ToInt32( Row["fkvalue"] ) ), true );
                        }
                    }
                    else
                    {
                        foreach( CswNbtViewRelationship viewRel in View.Root.GetAllChildrenOfType( CswEnumNbtViewNodeType.CswNbtViewRelationship ) )
                        {
                            if( CswConvert.ToInt32( Row["fkvalue"] ) == viewRel.SecondId )
                            {
                                if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.NodeTypeId.ToString() )
                                {
                                    CswNbtMetaDataNodeType MaterialNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( viewRel.SecondId );
                                    CswNbtViewProperty viewProp = View.AddViewProperty( viewRel, MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.IsConstituent ) );
                                    viewProp.ShowInGrid = false;
                                    View.AddViewPropertyFilter( viewProp,
                                                                FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                                Value: CswEnumTristate.True.ToString() );
                                }
                                else if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.ObjectClassId.ToString() )
                                {
                                    CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( viewRel.SecondId );
                                    CswNbtViewProperty viewProp = View.AddViewProperty( viewRel, MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.IsConstituent ) );
                                    viewProp.ShowInGrid = false;
                                    View.AddViewPropertyFilter( viewProp,
                                                                FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                                Value: CswEnumTristate.True.ToString() );
                                }
                                else if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.PropertySetId.ToString() )
                                {
                                    CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( viewRel.SecondId );
                                    CswNbtViewProperty viewProp = View.AddViewProperty( viewRel, MaterialPS.getObjectClasses().First().getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.IsConstituent ) );
                                    viewProp.ShowInGrid = false;
                                    View.AddViewPropertyFilter( viewProp,
                                                                FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                                Value: CswEnumTristate.True.ToString() );
                                }
                            }
                        } // foreach( CswNbtViewRelationship viewRel in View.Root.GetAllChildrenOfType( CswEnumNbtViewNodeType.CswNbtViewRelationship ) )
                    }
                    View.save();
                } // foreach( DataRow relRow in relTable.Rows )

            } // if( null != ConstituentNT && ChemicalNTs.Count > 0 )
        } // update()
        public override void update()
        {

            #region NodeTypes

            CswNbtMetaDataObjectClass RequestOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestClass );
            string RequestNodeTypeName = "Request";
            CswNbtMetaDataNodeType RequestNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( RequestNodeTypeName );

            if( null != RequestNt && RequestNt.ObjectClassId != RequestOc.ObjectClassId )
            {
                RequestNodeTypeName = "CISPro Request";
                RequestNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( RequestNodeTypeName );
            }
            if( null != RequestNt && RequestNt.ObjectClassId != RequestOc.ObjectClassId )
            {
                throw new CswDniException( ErrorType.Error, "Could not create a unique Request NodeType", "Request nodetypes named 'Request' and 'CISPro Request' already exist." );
            }
            if( null == RequestNt )
            {
                RequestNt = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( RequestOc )
                                                                     {
                                                                         Category = "Requests",
                                                                         NodeTypeName = RequestNodeTypeName
                                                                     } );

            }
            CswNbtMetaDataNodeTypeProp NameNtp = RequestNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequest.PropertyName.Name.ToString() );
            CswNbtMetaDataNodeTypeProp UserNtp = RequestNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequest.PropertyName.Requestor.ToString() );
            CswNbtMetaDataNodeTypeProp DateNtp = RequestNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequest.PropertyName.SubmittedDate.ToString() );
            RequestNt.NameTemplateValue = "";
            RequestNt.addNameTemplateText( NameNtp.PropName );
            RequestNt.addNameTemplateText( UserNtp.PropName );
            RequestNt.addNameTemplateText( DateNtp.PropName );

            CswNbtMetaDataObjectClass RequestItemOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestItemClass );
            string RequestItemNodeTypeName = "Request Item";
            CswNbtMetaDataNodeType RequestItemNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( RequestItemNodeTypeName );

            if( null != RequestItemNt && RequestItemNt.ObjectClassId != RequestItemOc.ObjectClassId )
            {
                RequestItemNodeTypeName = "CISPro Request Item";
                RequestNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( RequestItemNodeTypeName );
            }
            if( null != RequestItemNt && RequestItemNt.ObjectClassId != RequestItemOc.ObjectClassId )
            {
                throw new CswDniException( ErrorType.Error, "Could not create a unique Request Item NodeType", "Request nodetypes named 'Request Item' and 'CISPro Request Item' already exist." );
            }
            if( null == RequestItemNt )
            {
                RequestItemNt = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType(new CswNbtWcfMetaDataModel.NodeType(RequestItemOc)
                    {
                        Category = "Requests",
                        NodeTypeName = RequestItemNodeTypeName
                    });
            }
            CswNbtMetaDataNodeTypeProp RequestItemRequestNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Request );
            RequestItemRequestNtp.SetFK( NbtViewRelatedIdType.NodeTypeId.ToString(), RequestNt.NodeTypeId );

            CswNbtMetaDataNodeTypeProp TypeNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Type );
            CswNbtMetaDataNodeTypeProp StatusNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Status );
            CswNbtMetaDataNodeTypeProp ExternalOrderNoNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.ExternalOrderNumber );
            CswNbtMetaDataNodeTypeProp QuantityNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Quantity );
            CswNbtMetaDataNodeTypeProp CountNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Count );
            CswNbtMetaDataNodeTypeProp SizeNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Size );
            CswNbtMetaDataNodeTypeProp MaterialNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Material );
            CswNbtMetaDataNodeTypeProp ContainerNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Container );
            CswNbtMetaDataNodeTypeProp LocationNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Location );
            CswNbtMetaDataNodeTypeProp NumberNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Number );

            Int32 SequenceId = _CswNbtSchemaModTrnsctn.makeSequence( new CswSequenceName( "Request Items" ), "R", "", 6, 1 );
            NumberNtp.setSequence( SequenceId );

            RequestItemNt.addNameTemplateText( RequestItemRequestNtp.PropName );
            RequestItemNt.addNameTemplateText( NumberNtp.PropName );
            RequestItemNt.addNameTemplateText( TypeNtp.PropName );

            #endregion NodeTypes

            #region Tabs

            CswNbtMetaDataNodeTypeTab RequestItemsNtt = RequestNt.getNodeTypeTab( "Request Items" );
            if( null == RequestItemsNtt )
            {
                RequestItemsNtt = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( RequestNt, "Request Items",
                                                                              RequestNt.getNodeTypeTabIds().Count );
            }
            CswNbtMetaDataFieldType GridFt =
                _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Grid );
            CswNbtMetaDataNodeTypeProp RequestItemsGridNtp =
                _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( RequestNt,
                                                                                                     GridFt,
                                                                                                     "Request Items" )
                                                                 {
                                                                     TabId = RequestItemsNtt.TabId
                                                                 } );
            CswNbtView GridView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( RequestItemsGridNtp.ViewId );
            GridView.ViewName = "Requested Items";
            GridView.Visibility = NbtViewVisibility.Property;
            GridView.ViewMode = NbtViewRenderingMode.Grid;
            GridView.Category = "Requests";
            GridView.Root.ChildRelationships.Clear();
            CswNbtViewRelationship RequestRel = GridView.AddViewRelationship( RequestNt, false );
            CswNbtViewRelationship RequestItemRel = GridView.AddViewRelationship( RequestRel,
                                                                                 NbtViewPropOwnerType.Second,
                                                                                 RequestItemRequestNtp, false );
            GridView.AddViewProperty( RequestItemRel, NumberNtp );
            GridView.AddViewProperty( RequestItemRel, TypeNtp );
            GridView.AddViewProperty( RequestItemRel, ExternalOrderNoNtp );
            GridView.AddViewProperty( RequestItemRel, StatusNtp );
            GridView.AddViewProperty( RequestItemRel, QuantityNtp );
            GridView.AddViewProperty( RequestItemRel, CountNtp );
            GridView.AddViewProperty( RequestItemRel, SizeNtp );
            GridView.AddViewProperty( RequestItemRel, MaterialNtp );
            GridView.AddViewProperty( RequestItemRel, ContainerNtp );
            GridView.AddViewProperty( RequestItemRel, LocationNtp );
            GridView.save();


            #endregion Tabs

            #region Views

            string MyRequestViewName = "My Request History";
            bool UniqueView = _CswNbtSchemaModTrnsctn.restoreViews( MyRequestViewName ).Count == 0;
            if( false == UniqueView )
            {
                MyRequestViewName = "My CISPro Request History";
                UniqueView = _CswNbtSchemaModTrnsctn.restoreViews( MyRequestViewName ).Count == 0;
            }
            if( UniqueView )
            {
                CswNbtView MyRequestsView = _CswNbtSchemaModTrnsctn.makeView();
                MyRequestsView.makeNew( MyRequestViewName, NbtViewVisibility.Global );
                MyRequestsView.Category = "Requests";
                MyRequestsView.ViewMode = NbtViewRenderingMode.Tree;
                CswNbtViewRelationship RequestVr = MyRequestsView.AddViewRelationship( RequestNt, true );
                MyRequestsView.AddViewPropertyAndFilter( RequestVr, RequestNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequest.PropertyName.SubmittedDate.ToString() ), FilterMode: CswNbtPropFilterSql.PropertyFilterMode.NotNull );
                MyRequestsView.save();
            }
            #endregion Views

        }//Update()
Beispiel #11
0
        public override void update()
        {
            CswNbtMetaDataObjectClass GenericOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.GenericClass );
            CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass );

            CswNbtMetaDataFieldType TextFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Text );
            CswNbtMetaDataFieldType ListFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.List );
            CswNbtMetaDataFieldType GridFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Grid );
            CswNbtMetaDataFieldType ImageListFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.ImageList );
            CswNbtMetaDataFieldType RelationshipFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Relationship );


            //// Jurisdiction NodeType
            //CswNbtMetaDataNodeType JurisdictionNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( GenericOC )
            //{
            //    NodeTypeName = "Jurisdiction",
            //    Category = "System",
            //    IconFileName = "globe.gif"
            //} );
            //CswNbtMetaDataNodeTypeProp JurisdictionNameNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( JurisdictionNT, TextFT, "Name" ) );
            //JurisdictionNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( "Name" ) );

            //// Default Jurisdictions
            //CswNbtNode JurisNorthAmericaNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( JurisdictionNT.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
            //JurisNorthAmericaNode.Properties[JurisdictionNameNTP].AsText.Text = "North America";
            //JurisNorthAmericaNode.postChanges( false );

            //CswNbtNode JurisEuropeNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( JurisdictionNT.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
            //JurisEuropeNode.Properties[JurisdictionNameNTP].AsText.Text = "Europe";
            //JurisEuropeNode.postChanges( false );


            // GHS Phrase NodeType
            CswNbtMetaDataNodeType GHSPhraseNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( GenericOC )
            {
                NodeTypeName = "GHS Phrase",
                Category = "System",
                IconFileName = "group.gif"
            } );
            CswNbtMetaDataNodeTypeProp GHSPhraseCodeNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, TextFT, "Code" ) );
            CswNbtMetaDataNodeTypeProp GHSPhraseCategoryNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, ListFT, "Category" ) );
            CswNbtMetaDataNodeTypeProp GHSPhraseEnglishNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, TextFT, "English" ) );
            CswNbtMetaDataNodeTypeProp GHSPhraseChineseNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, TextFT, "Chinese" ) );
            CswNbtMetaDataNodeTypeProp GHSPhraseDanishNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, TextFT, "Danish" ) );
            CswNbtMetaDataNodeTypeProp GHSPhraseDutchNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, TextFT, "Dutch" ) );
            CswNbtMetaDataNodeTypeProp GHSPhraseFrenchNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, TextFT, "French" ) );
            CswNbtMetaDataNodeTypeProp GHSPhraseGermanNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, TextFT, "German" ) );
            CswNbtMetaDataNodeTypeProp GHSPhraseSpanishNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSPhraseNT, TextFT, "Spanish" ) );
            GHSPhraseCategoryNTP.ListOptions = "Physical,Health,Environmental";
            GHSPhraseNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( "Code" ) );
            
            _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswNbtResources.CswNbtModule.CISPro, GHSPhraseNT.NodeTypeId );
            
            // GHS NodeType
            CswNbtMetaDataNodeType GHSNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( GenericOC )
            {
                NodeTypeName = "GHS",
                Category = "Materials",
                IconFileName = "ball_redS.gif"
            } );
            CswNbtMetaDataNodeTypeProp GHSTypeNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSNT, ListFT, "Type" ) { IsRequired = true } );
            CswNbtMetaDataNodeTypeProp GHSMaterialNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSNT, RelationshipFT, "Material" ) { IsRequired = true } );
            CswNbtMetaDataNodeTypeProp GHSGHSPhraseNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSNT, RelationshipFT, "GHS Phrase" ) { IsRequired = true } );
            //CswNbtMetaDataNodeTypeProp GHSJurisdictionNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSNT, RelationshipFT, "Jurisdiction" ) { IsRequired = true } );
            CswNbtMetaDataNodeTypeProp GHSJurisdictionNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GHSNT, ListFT, "Jurisdiction" ) { IsRequired = true } );

            GHSTypeNTP.ListOptions = "Class Code, Label Code";
            GHSMaterialNTP.SetFK( NbtViewRelatedIdType.ObjectClassId.ToString(), MaterialOC.ObjectClassId );
            GHSGHSPhraseNTP.SetFK( NbtViewRelatedIdType.NodeTypeId.ToString(), GHSPhraseNT.NodeTypeId );
            //GHSJurisdictionNTP.SetFK( NbtViewRelatedIdType.NodeTypeId.ToString(), JurisdictionNT.NodeTypeId );
            GHSJurisdictionNTP.ListOptions = "North America, China, Europe, Japan";
            
            _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswNbtResources.CswNbtModule.CISPro, GHSNT.NodeTypeId );

            // Chemical GHS Tab
            CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
            if( null != ChemicalNT )
            {
                foreach( CswNbtMetaDataNodeTypeTab Tab in ChemicalNT.getNodeTypeTabs() )
                {
                    if( Tab.TabOrder >= 3 )
                        Tab.TabOrder += 1;
                }
                CswNbtMetaDataNodeTypeTab GHSTab = ChemicalNT.getNodeTypeTab( "GHS" );
                if( null == GHSTab )
                {
                    GHSTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ChemicalNT, "GHS", 3 );
                }
                GHSTab.TabOrder = 3;

                // Chemical GHS properties
                CswNbtMetaDataNodeTypeProp ChemicalGHSClassificationNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, ListFT, "GHS Classification" ) );
                CswNbtMetaDataNodeTypeProp ChemicalGHSClassCodesNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, GridFT, "GHS Class Codes" ) );
                CswNbtMetaDataNodeTypeProp ChemicalGHSSignalWordNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, ListFT, "GHS Signal Word" ) );
                CswNbtMetaDataNodeTypeProp ChemicalGHSLabelCodesNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, GridFT, "GHS Label Codes" ) );
                CswNbtMetaDataNodeTypeProp ChemicalGHSPictosNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, ImageListFT, "GHS Pictos" ) );

                CswCommaDelimitedString GHSClasses = new CswCommaDelimitedString(){
                    "Category 1",
                    "Category 1 / 1A / 1B",
                    "Category 1A",
                    "Category 1A / 1B",
                    "Category 1A / 1B / 1C",
                    "Category 1B",
                    "Category 2",
                    "Category 2 (skin)/2A (eye)",
                    "Category 2A",
                    "Category 2B",
                    "Category 3",
                    "Category 4",
                    "Category 5",
                    "Type A",
                    "Type B",
                    "Type C&D",
                    "Type E&F",
                    "Compressed Gas",
                    "Liquified Gas",
                    "Dissolved Gas",
                    "Refridgerated Liquidified Gas"
                };
                ChemicalGHSClassificationNTP.ListOptions = GHSClasses.ToString();
                ChemicalGHSSignalWordNTP.ListOptions = "Danger,Warning";

                ChemicalGHSClassificationNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                ChemicalGHSClassCodesNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                ChemicalGHSSignalWordNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                ChemicalGHSLabelCodesNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                ChemicalGHSPictosNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );

                ChemicalGHSClassificationNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, GHSTab.TabId, 1, 1, "Hazard Classification" );
                ChemicalGHSClassCodesNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, GHSTab.TabId, 2, 1, "Hazard Classification" );
                ChemicalGHSSignalWordNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, GHSTab.TabId, 3, 1, "Hazard Label" );
                ChemicalGHSLabelCodesNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, GHSTab.TabId, 4, 1, "Hazard Label" );
                ChemicalGHSPictosNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, GHSTab.TabId, 5, 1, "Hazard Label" );


                // Grid Views
                CswNbtView GHSClassCodesView = _CswNbtSchemaModTrnsctn.restoreView( ChemicalGHSClassCodesNTP.ViewId );
                GHSClassCodesView.Root.ChildRelationships.Clear();

                CswNbtViewRelationship ChemicalVR1 = GHSClassCodesView.AddViewRelationship( ChemicalNT, false );
                CswNbtViewRelationship GHSVR1 = GHSClassCodesView.AddViewRelationship( ChemicalVR1, NbtViewPropOwnerType.Second, GHSMaterialNTP, true );
                CswNbtViewRelationship GHSPhraseVR1 = GHSClassCodesView.AddViewRelationship( GHSVR1, NbtViewPropOwnerType.First, GHSGHSPhraseNTP, true );

                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseCodeNTP );
                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseCategoryNTP );
                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseEnglishNTP );
                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseChineseNTP );
                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseDanishNTP );
                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseDutchNTP );
                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseFrenchNTP );
                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseGermanNTP );
                GHSClassCodesView.AddViewProperty( GHSPhraseVR1, GHSPhraseSpanishNTP );

                GHSClassCodesView.AddViewPropertyAndFilter( GHSVR1, GHSTypeNTP, Value: "Class Code" );
                GHSClassCodesView.AddViewPropertyAndFilter( GHSVR1, GHSJurisdictionNTP, Value: "North America", ShowAtRuntime: true );
                GHSClassCodesView.save();

                CswNbtView GHSLabelCodesView = _CswNbtSchemaModTrnsctn.restoreView( ChemicalGHSLabelCodesNTP.ViewId );
                GHSLabelCodesView.Root.ChildRelationships.Clear();

                CswNbtViewRelationship ChemicalVR2 = GHSLabelCodesView.AddViewRelationship( ChemicalNT, false );
                CswNbtViewRelationship GHSVR2 = GHSLabelCodesView.AddViewRelationship( ChemicalVR2, NbtViewPropOwnerType.Second, GHSMaterialNTP, true );
                CswNbtViewRelationship GHSPhraseVR2 = GHSLabelCodesView.AddViewRelationship( GHSVR2, NbtViewPropOwnerType.First, GHSGHSPhraseNTP, true );

                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseCodeNTP );
                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseCategoryNTP );
                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseEnglishNTP );
                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseChineseNTP );
                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseDanishNTP );
                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseDutchNTP );
                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseFrenchNTP );
                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseGermanNTP );
                GHSLabelCodesView.AddViewProperty( GHSPhraseVR2, GHSPhraseSpanishNTP );

                GHSLabelCodesView.AddViewPropertyAndFilter( GHSVR2, GHSTypeNTP, Value: "Label Code" );
                GHSLabelCodesView.AddViewPropertyAndFilter( GHSVR2, GHSJurisdictionNTP, Value: "North America", ShowAtRuntime: true );
                GHSLabelCodesView.save();

                // Picto Options
                ChemicalGHSPictosNTP.Extended = "true"; // allow multiple values
                ChemicalGHSPictosNTP.TextAreaColumns = 100;
                ChemicalGHSPictosNTP.TextAreaRows = 100;

                CswDelimitedString PictoNames = new CswDelimitedString( '\n' ) { 
                    "Chemical",
                    "Explosive",
                    "Flammable",
                    "Natural",
                    "Oxidizer",
                    "Danger",
                    "X"
                };
                CswDelimitedString PictoPaths = new CswDelimitedString( '\n' ) { 
                    //"Images/cispro/1-1.gif",
                    //"Images/cispro/1-2.gif",
                    //"Images/cispro/1-3.gif",
                    //"Images/cispro/1-4.gif",
                    //"Images/cispro/1-5.gif",
                    //"Images/cispro/1-6.gif",
                    //"Images/cispro/5-2.gif",
                    "Images/cispro/acide.gif",
                    //"Images/cispro/acide2.gif",
                    //"Images/cispro/blan-red.gif",
                    //"Images/cispro/bleu4.gif",
                    //"Images/cispro/bleu4-noir.gif",
                    "Images/cispro/bottle.gif",
                    "Images/cispro/exclam.gif",
                    "Images/cispro/explos.gif",
                    "Images/cispro/flamme.gif",
                    //"Images/cispro/jaune5-1.gif",
                    "Images/cispro/pollu.gif",
                    "Images/cispro/rondflam.gif",
                    //"Images/cispro/rouge2.gif",
                    //"Images/cispro/rouge2_noir.gif",
                    //"Images/cispro/rouge3.gif",
                    //"Images/cispro/rouge3_noir.gif",
                    "Images/cispro/silouete.gif",
                    "Images/cispro/skull.gif"
                    //"Images/cispro/skull_2.gif",
                    //"Images/cispro/skull6.gif",
                    //"Images/cispro/stripes.gif",
                    //"Images/cispro/vert.gif"
                };
                ChemicalGHSPictosNTP.ListOptions = PictoNames.ToString();
                ChemicalGHSPictosNTP.ValueOptions = PictoPaths.ToString();
            }

            //GHS Phrase nodes
            Dictionary<Int32, string> GHSPhraseCodes = new Dictionary<Int32, string>();
            //Physical
            GHSPhraseCodes.Add( 200, "Unstable explosive" );
            GHSPhraseCodes.Add( 201, "Explosive; mass explosion hazard" );
            GHSPhraseCodes.Add( 202, "Explosive; severe projection hazard" );
            GHSPhraseCodes.Add( 203, "Explosive; fire, blast or projection hazard" );
            GHSPhraseCodes.Add( 204, "Fire or projection hazard" );
            GHSPhraseCodes.Add( 205, "May mass explode in fire" );
            GHSPhraseCodes.Add( 220, "Extremely flammable gas" );
            GHSPhraseCodes.Add( 221, "Flammable gas" );
            GHSPhraseCodes.Add( 222, "Extremely flammable material" );
            GHSPhraseCodes.Add( 223, "Flammable material" );
            GHSPhraseCodes.Add( 224, "Extremely flammable liquid and vapour" );
            GHSPhraseCodes.Add( 225, "Highly flammable liquid and vapour" );
            GHSPhraseCodes.Add( 226, "Flammable liquid and vapour" );
            GHSPhraseCodes.Add( 227, "Combustible liquid" );
            GHSPhraseCodes.Add( 228, "Flammable solid" );
            GHSPhraseCodes.Add( 240, "Heating may cause an explosion" );
            GHSPhraseCodes.Add( 241, "Heating may cause a fire or explosion" );
            GHSPhraseCodes.Add( 242, "Heating may cause a fire" );
            GHSPhraseCodes.Add( 250, "Catches fire spontaneously if exposed to air" );
            GHSPhraseCodes.Add( 251, "Self-heating; may catch fire" );
            GHSPhraseCodes.Add( 252, "Self-heating in large quantities; may catch fire" );
            GHSPhraseCodes.Add( 260, "In contact with water releases flammable gases which may ignite spontaneously" );
            GHSPhraseCodes.Add( 261, "In contact with water releases flammable gas" );
            GHSPhraseCodes.Add( 270, "May cause or intensify fire; oxidizer" );
            GHSPhraseCodes.Add( 271, "May cause fire or explosion; strong oxidizer" );
            GHSPhraseCodes.Add( 272, "May intensify fire; oxidizer" );
            GHSPhraseCodes.Add( 280, "Contains gas under pressure; may explode if heated" );
            GHSPhraseCodes.Add( 281, "Contains refrigerated gas; may cause cryogenic burns or injury" );
            GHSPhraseCodes.Add( 290, "May be corrosive to metals" );
            //Health
            GHSPhraseCodes.Add( 300, "Fatal if swallowed" );
            GHSPhraseCodes.Add( 301, "Toxic if swallowed" );
            GHSPhraseCodes.Add( 302, "Harmful if swallowed" );
            GHSPhraseCodes.Add( 303, "May be harmful if swallowed" );
            GHSPhraseCodes.Add( 304, "May be fatal if swallowed and enters airways" );
            GHSPhraseCodes.Add( 305, "May be harmful if swallowed and enters airways" );
            GHSPhraseCodes.Add( 310, "Fatal in contact with skin" );
            GHSPhraseCodes.Add( 311, "Toxic in contact with skin" );
            GHSPhraseCodes.Add( 312, "Harmful in contact with skin" );
            GHSPhraseCodes.Add( 313, "May be harmful in contact with skin" );
            GHSPhraseCodes.Add( 314, "Causes severe skin burns and eye damage" );
            GHSPhraseCodes.Add( 315, "Causes skin irritation" );
            GHSPhraseCodes.Add( 316, "Causes mild skin irritation" );
            GHSPhraseCodes.Add( 317, "May cause an allergic skin reaction" );
            GHSPhraseCodes.Add( 318, "Causes serious eye damage" );
            GHSPhraseCodes.Add( 319, "Causes serious eye irritation" );
            GHSPhraseCodes.Add( 320, "Causes eye irritation" );
            GHSPhraseCodes.Add( 330, "Fatal if inhaled" );
            GHSPhraseCodes.Add( 331, "Toxic if inhaled" );
            GHSPhraseCodes.Add( 332, "Harmful if inhaled" );
            GHSPhraseCodes.Add( 333, "May be harmful if inhaled" );
            GHSPhraseCodes.Add( 334, "May cause allergy or asthma symptoms of breathing difficulties if inhaled" );
            GHSPhraseCodes.Add( 335, "May cause respiratory irritation" );
            GHSPhraseCodes.Add( 336, "May cause drowsiness or dizziness" );
            GHSPhraseCodes.Add( 340, "May cause genetic defects" );
            GHSPhraseCodes.Add( 341, "Suspected of causing genetic defects" );
            GHSPhraseCodes.Add( 350, "May cause cancer" );
            GHSPhraseCodes.Add( 351, "Suspected of causing cancer" );
            GHSPhraseCodes.Add( 360, "May damage fertility or the unborn child" );
            GHSPhraseCodes.Add( 361, "Suspected of damaging fertility or the unborn child" );
            GHSPhraseCodes.Add( 362, "May cause harm to breast-fed children" );
            GHSPhraseCodes.Add( 370, "Causes damage to organs" );
            GHSPhraseCodes.Add( 371, "May cause damage to organs" );
            GHSPhraseCodes.Add( 372, "Causes damage to organs through prolonged or repeated exposure" );
            GHSPhraseCodes.Add( 373, "May cause damage to organs through prolonged or repeated exposure" );
            // Environmental
            GHSPhraseCodes.Add( 400, "Very toxic to aquatic life" );
            GHSPhraseCodes.Add( 401, "Toxic to aquatic life" );
            GHSPhraseCodes.Add( 402, "Harmful to aquatic life" );
            GHSPhraseCodes.Add( 410, "Very toxic to aquatic life with long lasting effects" );
            GHSPhraseCodes.Add( 411, "Toxic to aquatic life with long lasting effects" );
            GHSPhraseCodes.Add( 412, "Harmful to aquatic life with long lasting effects" );
            GHSPhraseCodes.Add( 413, "May cause long lasting harmful effects to aquatic life" );

            foreach( Int32 Code in GHSPhraseCodes.Keys )
            {
                string Category = "Physical";
                if( Code > 299 )
                {
                    Category = "Health";
                }
                else if( Code > 399 )
                {
                    Category = "Environmental";
                }

                CswNbtNode GHSPhraseNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( GHSPhraseNT.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
                GHSPhraseNode.Properties[GHSPhraseCodeNTP].AsText.Text = "H" + Code.ToString();
                GHSPhraseNode.Properties[GHSPhraseCategoryNTP].AsList.Value = Category;
                GHSPhraseNode.Properties[GHSPhraseEnglishNTP].AsText.Text = GHSPhraseCodes[Code];
                GHSPhraseNode.postChanges( false );
            } // foreach( Int32 Code in GHSPhraseCodes.Keys )

        }//Update()
        public override void update()
        {
            CswNbtMetaDataObjectClass GhsOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.GHSClass );
            CswNbtMetaDataObjectClassProp GhsMaterialOCP = GhsOC.getObjectClassProp( CswNbtObjClassGHS.PropertyName.Material );
            CswNbtMetaDataNodeType GhsNT = GhsOC.getNodeTypes().First();
            if( null != GhsNT )
            {
                CswNbtMetaDataNodeTypeTab GhsGhsTab = GhsNT.getNodeTypeTab( "GHS" ) ?? _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( GhsNT, "GHS", 1 );

                // Fix nodetype name template
                GhsNT.setNameTemplateText(
                    //                       "GHS for " +
                    //                       CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassGHS.PropertyName.Material ) +
                    //                       ": " +
                                           CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassGHS.PropertyName.Jurisdiction ) );


                // Classification is now a list
                const string ClassificationPropName = "Classification";
                const string ClassificationTabGroup = "Classification";

                CswNbtMetaDataNodeTypeProp GhsClassificationNTP = GhsNT.getNodeTypeProp( ClassificationPropName );
                _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( GhsClassificationNTP );

                GhsClassificationNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( GhsNT, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.List ), ClassificationPropName ) );
                GhsClassificationNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, DisplayRow: 6, DisplayColumn: 1, TabGroup: ClassificationTabGroup );
                GhsClassificationNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, GhsGhsTab.TabId, 6, 1, ClassificationTabGroup );

                // Classification list options
                CswCommaDelimitedString ClassificationOptions = new CswCommaDelimitedString
                    {
                        "Category 1", 
                        "Category 2", 
                        "Category 3", 
                        "Category 4", 
                        "Category 1 A/1 B/1 C", 
                        "Category 2 (skin)/2A (eye)",
                        "Category 2A",
                        "Category 2B",
                        "Category 1/ 1A / 1B",
                        "Category 1A or Category 1B",
                        "Type A",
                        "Type B",
                        "Type C&D",
                        "Type E&F",
                        "Compressed Gas",
                        "Liquidfied Gas",
                        "Dissolved Gas",
                        "Refridgerated Liquidified Gas"
                    };

                GhsClassificationNTP.ListOptions = ClassificationOptions.ToString();

                // Chemical GHS tab
                CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
                if( null != ChemicalNT )
                {
                    CswNbtMetaDataNodeTypeTab ChemicalGhsTab = ChemicalNT.getNodeTypeTab( "GHS" ) ?? _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ChemicalNT, "GHS", 3 );

                    // Delete the GHS grid, if present
                    CswNbtMetaDataNodeTypeProp ChemicalGhsGridNTP = ChemicalNT.getNodeTypeProp( "GHS" );
                    if( null != ChemicalGhsGridNTP )
                    {
                        _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( ChemicalGhsGridNTP );
                    }

                    // Add Child Contents property to Chemical GHS tab
                    CswNbtMetaDataNodeTypeProp JurisdictionNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.ChildContents ), "Jurisdiction" ) );
                    JurisdictionNTP.SetFK( NbtViewPropIdType.ObjectClassPropId.ToString(), GhsMaterialOCP.ObjectClassPropId );
                    JurisdictionNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                    JurisdictionNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, ChemicalGhsTab.TabId, 1, 1 );

                } // if(null != ChemicalNT)


            } // if (null != GhsNT)

        } //update()
        public override void update()
        {

            string UNCodeNodeTypeName = "UN Code";
            string ChemicalNodeTypeName = "Chemical";
            string LQNoNodeTypeName = "LQNo";
            string HazardsTabName = "Hazards";

            CswNbtMetaDataNodeType UNCodeNodeType = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( UNCodeNodeTypeName );
            if( null != UNCodeNodeType )
            {
                _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeType( UNCodeNodeType );
            }

            CswNbtMetaDataNodeType ChemicalNodeType = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( ChemicalNodeTypeName );

            if( null != ChemicalNodeType )
            {

                CswNbtMetaDataNodeTypeProp UnCodeProp = ChemicalNodeType.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.UNCode );

                if( null != UnCodeProp )
                {
                    CswNbtMetaDataNodeTypeTab HazardsTab = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeTab( ChemicalNodeType.NodeTypeId, HazardsTabName );

                    if( null != HazardsTab )
                    {
                        UnCodeProp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, HazardsTab.TabId );
                    }//if we have a hazards tab

                    UnCodeProp.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );

                    UnCodeProp.Attribute3 = "UN[0-9]{4}$"; //set regex attribute
                    UnCodeProp.Attribute4 = "Format of UN Code is 'UN####' !"; //set regex attribute

                }//if we have a uncode 

                //Add the LQNo prop on Chemical
                CswNbtMetaDataNodeType LQNoNodeType = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( LQNoNodeTypeName );
                if( null != LQNoNodeType )
                {
                    CswNbtMetaDataNodeTypeProp LQNoProp = ChemicalNodeType.getNodeTypeProp( LQNoNodeType.NodeTypeName );

                    if( null == LQNoProp )
                    {
                        LQNoProp = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( ChemicalNodeType, CswNbtMetaDataFieldType.NbtFieldType.Relationship, LQNoNodeType.NodeTypeName, HazardsTabName );
                    } 

                    LQNoProp.SetFK( NbtViewRelatedIdType.NodeTypeId.ToString(), LQNoNodeType.NodeTypeId );

                    LQNoProp.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );

                }

            }//if we have a chemcial node type




            ///_CswNbtSchemaModTrnsctn.MetaData.remove
        } //Update()