public override void update()
        {
            CswNbtMetaDataNodeType SDSDocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "SDS Document" );
            if( null != SDSDocumentNT )
            {
                CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
                foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
                {
                    if( MaterialNT.NodeTypeName == "Chemical" )
                    {
                        CswNbtMetaDataNodeTypeProp AssignedSDSNTP = MaterialNT.getNodeTypeProp( "Assigned SDS" );
                        if( null != AssignedSDSNTP )
                        {
                            CswNbtMetaDataNodeTypeProp OwnerOCP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner );
                            CswNbtMetaDataNodeTypeProp RevisionDateNTP = SDSDocumentNT.getNodeTypeProp( "Revision Date" );
                            CswNbtMetaDataNodeTypeProp ArchivedNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Archived );
                            CswNbtMetaDataNodeTypeProp FileNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.File );
                            CswNbtMetaDataNodeTypeProp LinkNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Link );
                            CswNbtMetaDataNodeTypeProp LanguageNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Language );
                            CswNbtMetaDataNodeTypeProp FormatNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Format );

                            CswNbtView AssignedSDSView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( AssignedSDSNTP.ViewId );
                            AssignedSDSView.Root.ChildRelationships.Clear();
                            CswNbtViewRelationship RootRel = AssignedSDSView.AddViewRelationship( MaterialNT, false );
                            CswNbtViewRelationship DocRel = AssignedSDSView.AddViewRelationship( RootRel, CswEnumNbtViewPropOwnerType.Second, OwnerOCP, true );
                            AssignedSDSView.AddViewPropertyAndFilter( DocRel, ArchivedNTP, CswEnumTristate.False.ToString(),
                                                             FilterMode: CswEnumNbtFilterMode.Equals,
                                                             ShowAtRuntime: true,
                                                             ShowInGrid: false );
                            if( null != RevisionDateNTP )
                            {
                                AssignedSDSView.AddViewProperty( DocRel, RevisionDateNTP, 1 );
                            }
                            AssignedSDSView.AddViewProperty( DocRel, FileNTP, 2 );
                            AssignedSDSView.AddViewProperty( DocRel, LinkNTP, 3 );
                            AssignedSDSView.AddViewProperty( DocRel, LanguageNTP, 4 );
                            AssignedSDSView.AddViewProperty( DocRel, FormatNTP, 5 );
                            AssignedSDSView.save();
                        }
                    }
                }
            }
        } // update()
示例#2
0
        public override void update()
        {
            CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet );
            foreach( CswNbtMetaDataObjectClass MaterialOC in MaterialPS.getObjectClasses() )
            {
                // Set default value for Obsolete property on Materials to false
                // Remove obsolete from Add layout
                CswNbtMetaDataObjectClassProp ManufacturerSitesOCP = MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.ManufacturingSites );
                CswNbtView ManufacturersView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( "ManufacturingSites", CswEnumNbtViewVisibility.Property );

                // Set view on nodetypes
                foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
                {
                    CswNbtMetaDataNodeTypeProp ObsoleteNTP = MaterialNT.getNodeTypeProp( CswNbtPropertySetMaterial.PropertyName.Obsolete );
                    //ObsoleteNTP.getDefaultValue( true ).AsLogical.Checked = CswEnumTristate.False;
                    ObsoleteNTP.DesignNode.AttributeProperty[CswEnumNbtPropertyAttributeName.DefaultValue].AsLogical.Checked = CswEnumTristate.False;
                    ObsoleteNTP.removeFromLayout( CswEnumNbtLayoutType.Add );

                    CswNbtMetaDataNodeTypeProp GridNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.ManufacturingSites );
                    GridNTP.ViewId.set( ManufacturersView.ViewId.get() );
                }
            }

        } // update()
示例#3
0
        public override void update()
        {
            CswNbtMetaDataNodeType SDSDocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "SDS Document" );
            if( null != SDSDocumentNT )
            {
                CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass );
                foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
                {
                    CswNbtMetaDataNodeTypeProp DocumentsNTP = MaterialNT.getNodeTypeProp("Documents");
                    if( null != DocumentsNTP )
                    {
                        //Material: Documents - MaterialClass->MaterialDocument (by Owner) - Title, Acquired Date, Expiration Date, Archived, File, Link (no filters)
                        CswNbtView DocumentsView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( DocumentsNTP.ViewId );
                        CswNbtMetaDataNodeType MaterialDocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Material Document" );
                        if( null != MaterialDocumentNT )
                        {
                            _removeDocumentClassPropAndFilters( DocumentsView, MaterialDocumentNT );
                        }
                    }
                    if( MaterialNT.NodeTypeName == "Chemical")
                    {
                        //Chemical: Assigned SDS - MaterialClass->SDS Document (by Owner) - Title, Language, Format, File, Link, Revision Date, Archived (equals 0, show at runtime)
                        CswNbtMetaDataNodeTypeProp AssignedSDSNTP = MaterialNT.getNodeTypeProp( "Assigned SDS" );
                        if( null != AssignedSDSNTP )
                        {
                            CswNbtView AssignedSDSView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( AssignedSDSNTP.ViewId );
                            AssignedSDSView.Root.ChildRelationships.Clear();
                            CswNbtViewRelationship RootRel = AssignedSDSView.AddViewRelationship( MaterialNT, false );
                            CswNbtMetaDataNodeTypeProp OwnerOCP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner );
                            CswNbtViewRelationship DocRel = AssignedSDSView.AddViewRelationship( RootRel, NbtViewPropOwnerType.Second, OwnerOCP, true );
                            CswNbtMetaDataNodeTypeProp ArchivedNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Archived );
                            AssignedSDSView.AddViewPropertyAndFilter( DocRel, ArchivedNTP, Tristate.False.ToString(),
                                                             FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals,
                                                             ShowAtRuntime: true, 
                                                             ShowInGrid: false );
                            CswNbtMetaDataNodeTypeProp TitleNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Title );
                            AssignedSDSView.AddViewProperty( DocRel, TitleNTP );
                            CswNbtMetaDataNodeTypeProp LanguageNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Language );
                            AssignedSDSView.AddViewProperty( DocRel, LanguageNTP );
                            CswNbtMetaDataNodeTypeProp FormatNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Format );
                            AssignedSDSView.AddViewProperty( DocRel, FormatNTP );
                            CswNbtMetaDataNodeTypeProp FileNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.File );
                            AssignedSDSView.AddViewProperty( DocRel, FileNTP );
                            CswNbtMetaDataNodeTypeProp LinkNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Link );
                            AssignedSDSView.AddViewProperty( DocRel, LinkNTP );
                            CswNbtMetaDataNodeTypeProp RevisionDateNTP = SDSDocumentNT.getNodeTypeProp( "Revision Date" );
                            if( null != RevisionDateNTP )
                            {
                                AssignedSDSView.AddViewProperty( DocRel, RevisionDateNTP );
                            }
                            AssignedSDSView.save();
                        }
                    }
                }

                CswNbtView SDSView = _CswNbtSchemaModTrnsctn.restoreView("SDS Expiring Next Month");
                if( null != SDSView )
                {
                    //ViewSelect: SDS Expiring Next Month - SDS Document - Expiration Date (value <= today+30)
                    SDSView.Root.ChildRelationships.Clear();
                    CswNbtViewRelationship RootRel = SDSView.AddViewRelationship( SDSDocumentNT, false );
                    CswNbtMetaDataNodeTypeProp ExpirationDateNTP = SDSDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.ExpirationDate );
                    SDSView.AddViewPropertyAndFilter( RootRel, ExpirationDateNTP, "today+30",
                                                     FilterMode: CswNbtPropFilterSql.PropertyFilterMode.LessThanOrEquals);
                    SDSView.save();
                }
            }
        } //Update()