Beispiel #1
0
        public override void update()
        {
            // Fix DSD Picto Paths
            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes() )
            {

                CswDelimitedString PictoPaths = new CswDelimitedString( '\n' )
                    {
                        "Images/cispro/DSD/512/none.gif",
                        "Images/cispro/DSD/512/e.gif",
                        "Images/cispro/DSD/512/o.gif",
                        "Images/cispro/DSD/512/f.gif",
                        "Images/cispro/DSD/512/f_plus.gif",
                        "Images/cispro/DSD/512/t.gif",
                        "Images/cispro/DSD/512/t_plus.gif",
                        "Images/cispro/DSD/512/xn.gif",
                        "Images/cispro/DSD/512/xi.gif",
                        "Images/cispro/DSD/512/c.gif",
                        "Images/cispro/DSD/512/n.gif"
                    };
                CswNbtMetaDataNodeTypeProp PictogramsNTP = ChemicalNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.Pictograms );
                PictogramsNTP.DesignNode.AttributeProperty[CswNbtFieldTypeRuleImageList.AttributeName.ImageUrls].AsMemo.Text = PictoPaths.ToString();
                PictogramsNTP.DesignNode.AttributeProperty[CswNbtFieldTypeRuleImageList.AttributeName.HeightInPixels].AsNumber.Value = 77;
                PictogramsNTP.DesignNode.AttributeProperty[CswNbtFieldTypeRuleImageList.AttributeName.WidthInPixels].AsNumber.Value = 77;
                PictogramsNTP.DesignNode.postChanges( false );

                foreach( CswNbtObjClassChemical ChemicalNode in ChemicalNT.getNodes( false, true ) )
                {
                    CswDelimitedString oldVals = ChemicalNode.Pictograms.Value;
                    CswDelimitedString newVals = new CswDelimitedString( CswNbtNodePropImageList.Delimiter );
                    foreach( string oldVal in oldVals )
                    {
                        if( oldVal.IndexOf( "/DSD/" ) >= 0 && oldVal.IndexOf( "/DSD/512" ) == 0 )
                        {
                            newVals.Add( oldVal.Replace( "/DSD/", "/DSD/512/" ) );
                        }
                        else
                        {
                            newVals.Add( oldVal );
                        }
                    }
                    ChemicalNode.Pictograms.Value = newVals;
                    ChemicalNode.postChanges( false );
                } // foreach( CswNbtObjClassChemical ChemicalNode in ChemicalNT.getNodes( false, true ) )
            } // foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes() )

            // Example DSD Print Label
            CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ContainerClass );
            CswNbtMetaDataObjectClass PrintLabelOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.PrintLabelClass );
            if( null != PrintLabelOC )
            {
                CswNbtMetaDataNodeType PrintLabelNT = PrintLabelOC.FirstNodeType;
                if( null != PrintLabelNT )
                {
                    CswNbtObjClassPrintLabel DsdLabel = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( PrintLabelNT.NodeTypeId );
                    DsdLabel.LabelName.Text = "Example DSD Label";
                    if( null != ContainerOC )
                    {
                        foreach(CswNbtMetaDataNodeType ContainerNT in ContainerOC.getNodeTypes())
                        {
                            DsdLabel.NodeTypes.SelectedNodeTypeIds.Add( ContainerNT.NodeTypeId.ToString() );
                        }
                    }
                    DsdLabel.EplText.Text = @"I8,0,001
S2
OD
JF
WN
D12
ZB
q375
N
A25,15,0,2,1,1,N,""{Material}""
B25,45,0,1,3,6,40,N,""{Barcode}""
A25,80,0,2,1,1,N,""{Barcode}""
A25,130,0,2,1,1,N,""{NBTDSDB}""
GW0,160,{NBTDSDPICTOS}
GW128,160,{NBTDSDPICTOS_2}
GW256,160,{NBTDSDPICTOS_3}
P1";
                    DsdLabel.postChanges( false );
                }
            }


        } // update()
        public override void update()
        {
            CswNbtMetaDataNodeType ContainerNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Container" );
            if( null != ContainerNT )
            {
                CswNbtMetaDataNodeTypeTab ContainerTab = ContainerNT.getFirstNodeTypeTab();

                CswNbtMetaDataNodeTypeProp StoragePressureNTP = 
                    _CswNbtSchemaModTrnsctn.MetaData.getNodeTypePropByObjectClassProp( ContainerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.StoragePressure );
                CswNbtMetaDataNodeTypeProp StorageTemperatureNTP =
                    _CswNbtSchemaModTrnsctn.MetaData.getNodeTypePropByObjectClassProp( ContainerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.StorageTemperature );
                CswNbtMetaDataNodeTypeProp UseTypeNTP =
                    _CswNbtSchemaModTrnsctn.MetaData.getNodeTypePropByObjectClassProp( ContainerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.UseType );

                StoragePressureNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                StorageTemperatureNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                UseTypeNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );

                StoragePressureNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, ContainerTab.TabId, 1, 2, "Fire Reporting");
                StorageTemperatureNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, ContainerTab.TabId, 2, 2, "Fire Reporting" );
                UseTypeNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, ContainerTab.TabId, 3, 2, "Fire Reporting" );
            }

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

                CswNbtMetaDataFieldType ListFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.List );
                CswNbtMetaDataFieldType MultiListFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.MultiList );

                CswNbtMetaDataNodeTypeProp ChemicalMaterialTypeNTP = 
                    _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, ListFT, "Material Type" ) );
                CswNbtMetaDataNodeTypeProp ChemicalSpecialFlagsNTP = 
                    _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, MultiListFT, "Special Flags" ) );
                CswNbtMetaDataNodeTypeProp ChemicalHazardCategoriesNTP =
                    _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, MultiListFT, "Hazard Categories" ) );
                CswNbtMetaDataNodeTypeProp ChemicalHazardClassesNTP = 
                    _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( ChemicalNT, MultiListFT, "Hazard Classes" ) );

                ChemicalMaterialTypeNTP.ListOptions = "Pure,Mixture";
                ChemicalMaterialTypeNTP.DefaultValue.AsList.Value = "Pure";
                ChemicalMaterialTypeNTP.IsRequired = true;

                ChemicalSpecialFlagsNTP.ListOptions = "EHS,Waste,Not Reportable";
                CswCommaDelimitedString SpecialFlags = new CswCommaDelimitedString();
                SpecialFlags.FromString( "Not Reportable" );
                ChemicalSpecialFlagsNTP.DefaultValue.AsMultiList.Value = SpecialFlags;

                ChemicalHazardCategoriesNTP.ListOptions = "F = Fire,C = Chronic (delayed),I = Immediate (acute),R = Reactive,P = Pressure";
                CswCommaDelimitedString FireHazardClassTypes = new CswCommaDelimitedString {
                    "Aero-1",
                    "Aero-2",
                    "Aero-3",
                    "Carc",
                    "CF/D (baled)",
                    "CF/D (loose)",
                    "CL-II",
                    "CL-IIIA",
                    "CL-IIIB",
                    "Corr",
                    "CRY-FG",
                    "CRY-OXY",
                    "Exp",
                    "FG (gaseous)",
                    "FG (liquified)",
                    "FL-1A",
                    "FL-1B",
                    "FL-1C",
                    "FS",
                    "HT",
                    "Irr",
                    "OHH",
                    "Oxy-1",
                    "Oxy-2",
                    "Oxy-3",
                    "Oxy-4",
                    "Oxy-Gas",
                    "Oxy-Gas (liquid)",
                    "Perox-Det",
                    "Perox-I",
                    "Perox-II",
                    "Perox-III",
                    "Perox-IV",
                    "Perox-V",
                    "Pyro",
                    "RAD-Alpha",
                    "RAD-Beta",
                    "RAD-Gamma",
                    "Sens",
                    "Tox",
                    "UR-1",
                    "UR-2",
                    "UR-3",
                    "UR-4",
                    "WR-1",
                    "WR-2",
                    "WR-3"
                };
                ChemicalHazardClassesNTP.ListOptions = FireHazardClassTypes.ToString();

                ChemicalMaterialTypeNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                ChemicalSpecialFlagsNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                ChemicalHazardCategoriesNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                ChemicalHazardClassesNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );

                ChemicalMaterialTypeNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, HazardsTab.TabId, 2, 2, "Fire Reporting" );
                ChemicalSpecialFlagsNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, HazardsTab.TabId, 3, 2, "Fire Reporting" );
                ChemicalHazardCategoriesNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, HazardsTab.TabId, 4, 2, "Fire Reporting" );
                ChemicalHazardClassesNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, HazardsTab.TabId, 5, 2, "Fire Reporting" );

                foreach( CswNbtNode ChemicalNode in ChemicalNT.getNodes( false, false ) )
                {
                    ChemicalNode.Properties[ChemicalMaterialTypeNTP].AsList.Value = "Pure";
                    ChemicalNode.Properties[ChemicalSpecialFlagsNTP].AsMultiList.Value = SpecialFlags;
                    ChemicalNode.postChanges( false );
                }
            }
        }