Пример #1
0
        public override void update()
        {
            _CswNbtSchemaModTrnsctn.createAction( CswEnumNbtActionName.Container_Expiration_Lock, false, String.Empty, "Containers" );
            _CswNbtSchemaModTrnsctn.createModuleActionJunction( CswEnumNbtModuleName.Containers, CswEnumNbtActionName.Container_Expiration_Lock );

            CswNbtMetaDataObjectClass RoleOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RoleClass );
            foreach( CswNbtObjClassRole RoleNode in RoleOC.getNodes( false, true ) )
            {
                _CswNbtSchemaModTrnsctn.Permit.set( CswEnumNbtActionName.Container_Expiration_Lock, RoleNode.Node, RoleNode.Administrator.Checked == CswEnumTristate.True );
            }

            CswNbtMetaDataPropertySet MaterialSet = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet );
            foreach( CswNbtMetaDataObjectClass MaterialOC in MaterialSet.getObjectClasses() )
            {
                foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
                {
                    CswNbtMetaDataNodeTypeProp ExpirationLockedNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.ContainerExpirationLocked );
                    ExpirationLockedNTP.removeFromLayout( CswEnumNbtLayoutType.Add );
                }
                foreach( CswNbtPropertySetMaterial MaterialNode in MaterialOC.getNodes( false, false ) )
                {
                    MaterialNode.ContainerExpirationLocked.Checked = CswEnumTristate.True;
                    MaterialNode.postChanges( false );
                }
            }
        } // update()
Пример #2
0
        }//_addMaterialComponentPermissions()

        private void _addTitleToDocumentsView()
        {
            CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet );
            foreach( CswNbtMetaDataObjectClass MaterialOC in MaterialPS.getObjectClasses() )
            {
                foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
                {
                    CswNbtMetaDataNodeTypeProp DocumentsNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.Documents );
                    CswNbtMetaDataNodeType MaterialDocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Material Document" );

                    if( null != MaterialDocumentNT )
                    {
                        CswNbtMetaDataObjectClass DocumentOC = MaterialDocumentNT.getObjectClass();
                        CswNbtMetaDataNodeTypeProp[] propsToAdd =
                            {
                                MaterialDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Title )
                            };

                        CswNbtView DocumentsView = _CswNbtSchemaModTrnsctn.restoreView( DocumentsNTP.ViewId );
                        if( null != DocumentsView )
                        {
                            _addPropertiesToView( DocumentsView, DocumentsView.Root.ChildRelationships, DocumentOC, MaterialDocumentNT, propsToAdd );
                        }
                    }
                }
            }
        }
        public override void update()
        {
            // Remove the HazardClassesNTP from all layouts for any MaterialNTs != Chemical
            CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            if( null != MaterialOC )
            {
                foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
                {
                    if( false == MaterialNT.NodeTypeName.Equals( "Chemical" ) )
                    {
                        CswNbtMetaDataNodeTypeProp HazardClassesNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.HazardClasses );
                        HazardClassesNTP.removeFromAllLayouts();
                    }
                }
            }

        } // update()
Пример #4
0
        public override void update()
        {
            // Remove the UN Code property from the add layout for all Material types
            CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass );
            if( null != MaterialOC )
            {
                foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
                {
                    CswNbtMetaDataNodeTypeProp UNCodeNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.UNCode );
                    if( null != UNCodeNTP )
                    {
                        UNCodeNTP.removeFromLayout( LayoutType: CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                    }
                }
            }


        } //Update()
Пример #5
0
        private void _updateUnapprovedMaterialsView()
        {
            CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            CswNbtMetaDataObjectClassProp MaterialIdProp = MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.MaterialId );
            CswNbtMetaDataObjectClassProp TradeNameProp = MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.TradeName );
            CswNbtMetaDataObjectClassProp SupplierProp = MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.Supplier );
            CswNbtMetaDataObjectClassProp PartNoProp = MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.PartNumber );
            CswNbtMetaDataObjectClassProp CASNoProp = MaterialOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.CasNo );

            CswNbtView UnapprovedMaterialsView = _CswNbtSchemaModTrnsctn.restoreView( "Unapproved Materials", CswEnumNbtViewVisibility.Global );
            if( null == UnapprovedMaterialsView )
            {
                UnapprovedMaterialsView = _CswNbtSchemaModTrnsctn.makeNewView( "Unapproved Materials", CswEnumNbtViewVisibility.Global );
                UnapprovedMaterialsView.ViewMode = CswEnumNbtViewRenderingMode.Grid;
                UnapprovedMaterialsView.Category = "Materials";
            }
            else
            {
                UnapprovedMaterialsView.Root.ChildRelationships.Clear();
            }

            CswNbtViewRelationship MatRel = UnapprovedMaterialsView.AddViewRelationship( MaterialPS, true );
            CswNbtViewProperty ApprovedForReceivingPropVP = 
                MaterialOC.getNodeTypes()
                .Select( MaterialNT => MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.ApprovedForReceiving ) )
                .Select( ApprovedForReceivingProp => UnapprovedMaterialsView.AddViewProperty( MatRel, ApprovedForReceivingProp ) ).FirstOrDefault();
            UnapprovedMaterialsView.AddViewPropertyFilter( ApprovedForReceivingPropVP,
                                          CswEnumNbtFilterConjunction.And,
                                          CswEnumNbtFilterResultMode.Hide,
                                          CswEnumNbtSubFieldName.Checked,
                                          CswEnumNbtFilterMode.Equals,
                                          "false");
            UnapprovedMaterialsView.AddViewProperty( MatRel, MaterialIdProp, 1 );
            UnapprovedMaterialsView.AddViewProperty( MatRel, TradeNameProp, 2 );
            UnapprovedMaterialsView.AddViewProperty( MatRel, SupplierProp, 3 );
            UnapprovedMaterialsView.AddViewProperty( MatRel, PartNoProp, 4 );
            UnapprovedMaterialsView.AddViewProperty( MatRel, CASNoProp, 5 );
            UnapprovedMaterialsView.save();
        }
Пример #6
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()
        public override void update()
        {
            //1 - add MaterialName column to Location's Containers Grid Property
            CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.LocationClass );
            foreach( CswNbtMetaDataNodeType LocationNT in LocationOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp ContainersGridProp = LocationNT.getNodeTypePropByObjectClassProp(CswNbtObjClassLocation.PropertyName.Containers);
                CswNbtView ContainersView = _CswNbtSchemaModTrnsctn.restoreView( ContainersGridProp.ViewId );
                if( null != ContainersView )
                {
                    ContainersView.ViewMode = NbtViewRenderingMode.Grid;
                    ContainersView.Root.ChildRelationships.Clear();
                    ContainersView.ViewVisibility = NbtViewVisibility.Property.ToString();

                    CswNbtViewRelationship LocRootRel = ContainersView.AddViewRelationship( LocationOC, false );
                    CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.ContainerClass );
                    CswNbtMetaDataObjectClassProp LocationOCP = LocationOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Location );
                    CswNbtViewRelationship ContainerRel = ContainersView.AddViewRelationship( LocRootRel, NbtViewPropOwnerType.Second, LocationOCP, false );

                    CswNbtViewProperty BarcodeVP = ContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Barcode ) );
                    BarcodeVP.Order = 1;
                    CswNbtViewProperty MaterialVP = ContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Material ) );
                    MaterialVP.Order = 2;
                    CswNbtViewProperty StatusVP = ContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Status ) );
                    StatusVP.Order = 3;
                    CswNbtViewProperty ExpDateVP = ContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.ExpirationDate ) );
                    ExpDateVP.Order = 4;
                    CswNbtViewProperty MissingVP = ContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Missing ) );
                    MissingVP.Order = 5;
                    CswNbtViewProperty OwnerVP = ContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Owner ) );
                    OwnerVP.Order = 6;
                    CswNbtViewProperty DisposedVP = ContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Disposed ) );
                    DisposedVP.Order = 7;
                    DisposedVP.ShowInGrid = false;
                    ContainersView.AddViewPropertyFilter( DisposedVP,
                                                  CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                                  CswNbtPropFilterSql.FilterResultMode.Hide,
                                                  CswNbtSubField.SubFieldName.Checked,
                                                  CswNbtPropFilterSql.PropertyFilterMode.Equals,
                                                  "false" );
                    ContainersView.save();            
                }
            }

            //2 - Move the Material Buttons to the second column in the Identity Tab in Edit Layout
            CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass );
            foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeTab IdentityTab = MaterialNT.getIdentityTab();
                CswNbtMetaDataNodeTypeProp RequestNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.Request );
                RequestNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, IdentityTab.TabId, 1, 2 );
                CswNbtMetaDataNodeTypeProp ReceiveNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.Receive );
                ReceiveNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, IdentityTab.TabId, 2, 2 );
                CswNbtMetaDataNodeTypeProp PartNumberNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.PartNumber );
                PartNumberNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, IdentityTab.TabId, 1, 1 );
                CswNbtMetaDataNodeTypeProp TradenameNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.Tradename );
                TradenameNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, IdentityTab.TabId, 2, 1 );
                CswNbtMetaDataNodeTypeProp SupplierNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.Supplier );
                SupplierNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, IdentityTab.TabId, 3, 1 );
            }

            //3 - Add the following properties to the Chemical's Preview Layout: TradeName, Supplier, NFPA, PPE, GHS pictos, Storage Compatibility
            ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
            if( null != ChemicalNT )
            {
                _addToPreview( CswNbtObjClassMaterial.PropertyName.Tradename );
                _addToPreview( CswNbtObjClassMaterial.PropertyName.Supplier );
                _addToPreview( "NFPA" );
                _addToPreview( "PPE" );
                _addToPreview( "GHS Pictos" );
                _addToPreview( CswNbtObjClassMaterial.PropertyName.StorageCompatibility );
            }

            //4 - Rename Expired Containers View to "My Expired Contianers"
            CswNbtView MyExpiredContainersView = _CswNbtSchemaModTrnsctn.restoreView( "Expiring Containers" );
            if( null != MyExpiredContainersView )
            {
                MyExpiredContainersView.ViewName = "My Expiring Containers";
                MyExpiredContainersView.save();
            }

            //5 - Create new "My Contianers" grid, which is essentially the Containers view with an "owner=me" filter
            _createMyContainersView();            

            //6-8 - update action and view permissions for CIS_Pro roles, and add WelcomePage Items (in Part 2 of script)

            //9 - rename MSDS to SDS everywhere
            CswNbtMetaDataObjectClass DocumentClass = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.DocumentClass );
            foreach(CswNbtMetaDataNodeType DocumentNT in DocumentClass.getNodeTypes())
            {
                DocumentClassNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.DocumentClass );
                DocumentClassNTP.ListOptions = DocumentClassNTP.ListOptions.Replace( "MSDS", "SDS" );
                DocumentClassNTP.DefaultValue.AsList.Value = DocumentClassNTP.DefaultValue.AsList.Value.Replace( "MSDS", "SDS" );
                DocumentClassNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, DocumentNT.getFirstNodeTypeTab().TabId );
                _filterToSDS( DocumentNT, CswNbtObjClassDocument.PropertyName.Language );
                _filterToSDS( DocumentNT, CswNbtObjClassDocument.PropertyName.Format );
                _filterToSDS( DocumentNT, "Issue Date" );
            }
            foreach( CswNbtObjClassDocument DocumentNode in DocumentClass.getNodes( false, false ) )
            {
                if( DocumentNode.DocumentClass.Value == "MSDS" )
                {
                    DocumentNode.DocumentClass.Value = "SDS";
                    DocumentNode.postChanges( false );
                }
            }
            CswNbtView MSDSView = _CswNbtSchemaModTrnsctn.restoreView( "MSDS Expiring Next Month" );
            if( null != MSDSView )
            {
                MSDSView.ViewName = "SDS Expiring Next Month";
                MSDSView.save();
            }

        }//Update()
        public override void update()
        {
            // New 'IsConstituent' property
            CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet );
            foreach( CswNbtMetaDataObjectClass MaterialOC in _CswNbtSchemaModTrnsctn.MetaData.getObjectClassesByPropertySetId( MaterialPS.PropertySetId ) )
            {
                foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
                {
                    CswNbtMetaDataNodeTypeProp IsConstituentNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.IsConstituent );
                    IsConstituentNTP.DefaultValue.AsLogical.Checked = CswEnumTristate.False;
                    IsConstituentNTP.removeFromAllLayouts();

                    foreach( CswNbtPropertySetMaterial MaterialNode in MaterialNT.getNodes( false, true ) )
                    {
                        MaterialNode.IsConstituent.Checked = CswEnumTristate.False;
                        MaterialNode.postChanges( false );
                    }
                }
            }

            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            if( null != ChemicalOC.FirstNodeType )
            {
                //1. Create a new NodeType (of ObjClassChemical) called "Constituent"
                CswNbtMetaDataNodeType ConstituentNT = _CswNbtSchemaModTrnsctn.MetaData.CopyNodeType( ChemicalOC.FirstNodeType, "Constituent" );

                CswNbtMetaDataNodeTypeProp TradeNameNTP = ConstituentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.TradeName );
                ConstituentNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( TradeNameNTP.PropName ) );

                // IsConstituent is true here
                CswNbtMetaDataNodeTypeProp IsConstituentNTP = ConstituentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent );
                IsConstituentNTP.DefaultValue.AsLogical.Checked = CswEnumTristate.True;

                //2. Set Allow Receiving prop to "false" by default
                CswNbtMetaDataNodeTypeProp ApprovedReceivingNTP = ConstituentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.ApprovedForReceiving );
                ApprovedReceivingNTP.DefaultValue.AsLogical.Checked = CswEnumTristate.False;
                ApprovedReceivingNTP.ServerManaged = true;

                Collection<CswNbtMetaDataNodeTypeProp> PropertiesToDelete = new Collection<CswNbtMetaDataNodeTypeProp>();
                PropertiesToDelete.Add( ConstituentNT.getNodeTypeProp( "Chemical Sizes" ) );
                PropertiesToDelete.Add( ConstituentNT.getNodeTypeProp( "Inventory Levels" ) );
                PropertiesToDelete.Add( ConstituentNT.getNodeTypeProp( "Chemical Containers" ) );
                PropertiesToDelete.Add( ConstituentNT.getNodeTypeProp( "Components" ) );

                foreach( CswNbtMetaDataNodeTypeProp DoomedProp in PropertiesToDelete )
                {
                    if( null != DoomedProp )
                    {
                        _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( DoomedProp );
                    }
                }

                CswNbtMetaDataNodeTypeProp SupplierNTP = ConstituentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.Supplier );
                SupplierNTP.removeFromAllLayouts();


                // Grant permissions to cispro_admin
                CswNbtObjClassRole CISProAdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Admin" );
                CswEnumNbtNodeTypePermission[] AllPerms = new CswEnumNbtNodeTypePermission[]
                {
                    CswEnumNbtNodeTypePermission.Create, CswEnumNbtNodeTypePermission.Delete, CswEnumNbtNodeTypePermission.Edit, CswEnumNbtNodeTypePermission.View
                };
                _CswNbtSchemaModTrnsctn.Permit.set( AllPerms, ConstituentNT, CISProAdminRole, true );

            } // if( null != ChemicalOC.FirstNodeType )
        } // update()