Example #1
0
        public override void update()
        {
            // case 25898 - Fix material layout
            // Note: While it is possible for nodetype and property names to have been mutated by customers,
            // it's impossible at this stage of CISPro development, so we can rely on existing names.

            CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass);

            CswNbtMetaDataNodeTypeLayoutMgr.LayoutType EditLayout = CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit;
            CswNbtMetaDataNodeTypeLayoutMgr.LayoutType AddLayout  = CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add;

            CswNbtMetaDataNodeTypeTab IdentityTab;
            CswNbtMetaDataNodeTypeTab namedTab;
            CswNbtMetaDataNodeTypeTab HazardsTab;
            CswNbtMetaDataNodeTypeTab PhysicalTab;
            CswNbtMetaDataNodeTypeTab StructureTab;
            CswNbtMetaDataNodeTypeTab DocumentsTab;
            CswNbtMetaDataNodeTypeTab ContainersTab;
            CswNbtMetaDataNodeTypeTab BiosafetyTab;
            CswNbtMetaDataNodeTypeTab PictureTab;

            foreach (CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes())
            {
                foreach (CswNbtMetaDataNodeTypeProp MatNTP in MaterialNT.getNodeTypeProps())
                {
                    _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.removePropFromAllLayouts(MatNTP);

                    switch (MaterialNT.NodeTypeName)
                    {
                    case "Chemical":
                        MaterialNT.IconFileName = "atom.gif";
                        MaterialNT.setNameTemplateText(CswNbtMetaData.MakeTemplateEntry(CswNbtObjClassMaterial.TradenamePropertyName));

                        IdentityTab   = _getTab(MaterialNT, "Identity", 0);
                        namedTab      = _getTab(MaterialNT, MaterialNT.NodeTypeName, 1);
                        HazardsTab    = _getTab(MaterialNT, "Hazards", 2);
                        PhysicalTab   = _getTab(MaterialNT, "Physical", 3);
                        StructureTab  = _getTab(MaterialNT, "Structure", 4);
                        DocumentsTab  = _getTab(MaterialNT, "Documents", 5);
                        ContainersTab = _getTab(MaterialNT, "Containers", 6);

                        switch (MatNTP.PropName)
                        {
                        // Identity
                        case CswNbtObjClassMaterial.TradenamePropertyName:
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 1, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 1, 1);
                            break;

                        case CswNbtObjClassMaterial.SupplierPropertyName:
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 2, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 2, 1);
                            break;

                        case CswNbtObjClassMaterial.PartNumberPropertyName:
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 3, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 3, 1);
                            break;

                        case CswNbtObjClassMaterial.RequestPropertyName: MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 4, 1); break;

                        case CswNbtObjClassMaterial.ReceivePropertyName: MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 5, 1); break;

                        // Chemical
                        case "Synonyms": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 1, 1); break;

                        case CswNbtObjClassMaterial.CasNoPropertyName: MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 2, 1); break;

                        case "Components": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 3, 1); break;

                        case CswNbtObjClassMaterial.RegulatoryListsPropertyName: MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 4, 1); break;;

                        case CswNbtObjClassMaterial.ExpirationIntervalPropertyName: MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 5, 1); break;

                        case CswNbtObjClassMaterial.ApprovalStatusPropertyName: MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 6, 1); break;

                        // Hazards
                        case "Hazardous": MatNTP.updateLayout(EditLayout, false, HazardsTab.TabId, 1, 1); break;

                        case "NFPA": MatNTP.updateLayout(EditLayout, false, HazardsTab.TabId, 2, 1); break;

                        case CswNbtObjClassMaterial.StorageCompatibilityPropertyName: MatNTP.updateLayout(EditLayout, false, HazardsTab.TabId, 3, 1); break;

                        case "PPE": MatNTP.updateLayout(EditLayout, false, HazardsTab.TabId, 4, 1); break;

                        // Physical
                        case "Physical Description":
                            MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 1, 1);
                            MatNTP.TextAreaColumns = 20;
                            break;

                        case CswNbtObjClassMaterial.PhysicalStatePropertyName:
                            MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 2, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 4, 1);
                            break;

                        case "Molecular Weight": MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 3, 1); break;

                        case CswNbtObjClassMaterial.SpecificGravityPropertyName: MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 4, 1); break;

                        case "pH": MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 5, 1); break;

                        case "Boiling Point": MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 3, 2); break;

                        case "Melting Point": MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 4, 2); break;

                        case "Aqueous Solubility": MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 5, 2); break;

                        case "Flash Point": MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 3, 3); break;

                        case "Vapor Pressure": MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 4, 3); break;

                        case "Vapor Density": MatNTP.updateLayout(EditLayout, false, PhysicalTab.TabId, 5, 3); break;

                        // Structure
                        case "Formula": MatNTP.updateLayout(EditLayout, false, StructureTab.TabId, 1, 1); break;

                        case "Structure": MatNTP.updateLayout(EditLayout, false, StructureTab.TabId, 2, 1); break;

                        // Documents
                        case "Documents": MatNTP.updateLayout(EditLayout, false, DocumentsTab.TabId, 1, 1); break;

                        // Containers
                        case "Inventory Levels": MatNTP.updateLayout(EditLayout, false, ContainersTab.TabId, 1, 2); break;

                        // (delete)
                        case "Storage Type": _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp(MatNTP); break;
                        }

                        break;

                    case "Biological":
                        MaterialNT.IconFileName = "dna.gif";
                        MaterialNT.setNameTemplateText(CswNbtMetaData.MakeTemplateEntry("Biological Name"));

                        IdentityTab   = _getTab(MaterialNT, "Identity", 0);
                        namedTab      = _getTab(MaterialNT, MaterialNT.NodeTypeName, 1);
                        BiosafetyTab  = _getTab(MaterialNT, "Biosafety", 2);
                        PictureTab    = _getTab(MaterialNT, "Picture", 3);
                        DocumentsTab  = _getTab(MaterialNT, "Documents", 4);
                        ContainersTab = _getTab(MaterialNT, "Containers", 5);

                        _removeTab(MaterialNT, "Physical");

                        switch (MatNTP.PropName)
                        {
                        // Identity
                        case CswNbtObjClassMaterial.TradenamePropertyName:
                            MatNTP.PropName = "Biological Name";
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 1, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 1, 1);
                            break;

                        case CswNbtObjClassMaterial.SupplierPropertyName:
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 2, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 2, 1);
                            break;

                        case CswNbtObjClassMaterial.PartNumberPropertyName:
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 3, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 3, 1);
                            break;

                        case CswNbtObjClassMaterial.RequestPropertyName: MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 4, 1); break;

                        // Biological
                        case "Synonyms": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 1, 1); break;

                        case "Reference Number": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 2, 1); break;

                        case "Type": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 3, 1); break;

                        case "Species Origin": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 4, 1); break;

                        case "Vectors": MatNTP.updateLayout(EditLayout, false, BiosafetyTab.TabId, 5, 1); break;

                        case "Reference Type": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 6, 1); break;

                        //case CswNbtObjClassMaterial.ExpirationIntervalPropertyName: MatNTP.updateLayout( EditLayout, false, namedTab.TabId, 6, 1 ); break;
                        case CswNbtObjClassMaterial.ApprovalStatusPropertyName: MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 7, 1); break;

                        // Biosafety
                        case "Biosafety Level": MatNTP.updateLayout(EditLayout, false, BiosafetyTab.TabId, 1, 1); break;

                        case CswNbtObjClassMaterial.PhysicalStatePropertyName:
                            MatNTP.updateLayout(EditLayout, false, BiosafetyTab.TabId, 3, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 4, 1);
                            MatNTP.ListOptions = CswNbtObjClassMaterial.PhysicalStates.Options.ToString();
                            break;

                        case CswNbtObjClassMaterial.SpecificGravityPropertyName: MatNTP.updateLayout(EditLayout, false, BiosafetyTab.TabId, 4, 1); break;
                        //case CswNbtObjClassMaterial.StorageCompatibilityPropertyName: MatNTP.updateLayout( EditLayout, false, BiosafetyTab.TabId, 5, 1 ); break;

                        // Documents
                        case "Documents": MatNTP.updateLayout(EditLayout, false, DocumentsTab.TabId, 1, 1); break;

                        // Containers
                        case "Inventory Levels": MatNTP.updateLayout(EditLayout, false, ContainersTab.TabId, 1, 2); break;

                        //case CswNbtObjClassMaterial.CasNoPropertyName: MatNTP.updateLayout( EditLayout, false, namedTab.TabId, 1, 2 ); break;
                        //case CswNbtObjClassMaterial.RegulatoryListsPropertyName: MatNTP.updateLayout( EditLayout, false, namedTab.TabId, 1, 4 ); break;

                        // (delete)
                        case "Storage Type": _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp(MatNTP); break;
                        }
                        break;

                    case "Supply":
                        MaterialNT.IconFileName = "tube.gif";
                        MaterialNT.setNameTemplateText(CswNbtMetaData.MakeTemplateEntry(CswNbtObjClassMaterial.TradenamePropertyName));

                        IdentityTab   = _getTab(MaterialNT, "Identity", 0);
                        namedTab      = _getTab(MaterialNT, MaterialNT.NodeTypeName, 1);
                        PictureTab    = _getTab(MaterialNT, "Picture", 2);
                        DocumentsTab  = _getTab(MaterialNT, "Documents", 3);
                        ContainersTab = _getTab(MaterialNT, "Containers", 4);

                        _removeTab(MaterialNT, "Physical");

                        switch (MatNTP.PropName)
                        {
                        // Identity
                        case CswNbtObjClassMaterial.TradenamePropertyName:
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 1, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 1, 1);
                            break;

                        case CswNbtObjClassMaterial.SupplierPropertyName:
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 2, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 2, 1);
                            break;

                        case CswNbtObjClassMaterial.PartNumberPropertyName:
                            MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 3, 1);
                            MatNTP.updateLayout(AddLayout, false, Int32.MinValue, 3, 1);
                            break;

                        case CswNbtObjClassMaterial.RequestPropertyName: MatNTP.updateLayout(EditLayout, false, IdentityTab.TabId, 4, 1); break;

                        // Supply
                        case "Description": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 1, 1); break;

                        case "Synonyms": MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 2, 1); break;

                        //case CswNbtObjClassMaterial.ExpirationIntervalPropertyName: MatNTP.updateLayout( EditLayout, false, namedTab.TabId, 4, 1 ); break;
                        case CswNbtObjClassMaterial.ApprovalStatusPropertyName: MatNTP.updateLayout(EditLayout, false, namedTab.TabId, 5, 1); break;

                        // Picture
                        case "Picture": MatNTP.updateLayout(EditLayout, false, PictureTab.TabId, 1, 1); break;

                        // Documents
                        case "Documents": MatNTP.updateLayout(EditLayout, false, DocumentsTab.TabId, 1, 1); break;

                        //case CswNbtObjClassMaterial.CasNoPropertyName: MatNTP.updateLayout( EditLayout, false, namedTab.TabId, 1, 2 ); break;
                        //case CswNbtObjClassMaterial.RegulatoryListsPropertyName: MatNTP.updateLayout( EditLayout, false, namedTab.TabId, 1, 4 ); break; ;
                        //case CswNbtObjClassMaterial.StorageCompatibilityPropertyName: MatNTP.updateLayout( EditLayout, false, HazardsTab.TabId, 1, 3 ); break;
                        //case CswNbtObjClassMaterial.PhysicalStatePropertyName: MatNTP.updateLayout( EditLayout, false, PhysicalTab.TabId, 1, 2 ); break;
                        //case CswNbtObjClassMaterial.SpecificGravityPropertyName: MatNTP.updateLayout( EditLayout, false, PhysicalTab.TabId, 1, 4 ); break;

                        // Containers
                        case "Inventory Levels": MatNTP.updateLayout(EditLayout, false, ContainersTab.TabId, 1, 2); break;

                        // (delete)
                        case "Storage Type": _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp(MatNTP); break;

                        case "Components": _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp(MatNTP); break;
                        }

                        break;
                    } // switch( MaterialNT.NodeTypeName )
                }     // foreach( CswNbtMetaDataNodeTypeProp MatNTP in MaterialNT.getNodeTypeProps() )
            }         // foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() )
        }             // update()
        public override void update()
        {
            CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MailReportClass );
            CswNbtMetaDataNodeType MailReportNT = MailReportOC.FirstNodeType;

            if( null != MailReportNT )
            {
                CswNbtMetaDataNodeTypeProp DueDateIntervalNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.DueDateInterval );
                CswNbtMetaDataNodeTypeProp EnabledNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Enabled );
                CswNbtMetaDataNodeTypeProp EventNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Event );
                CswNbtMetaDataNodeTypeProp FinalDueDateNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.FinalDueDate );
                CswNbtMetaDataNodeTypeProp LastProcessedNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.LastProcessed );
                CswNbtMetaDataNodeTypeProp MessageNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Message );
                CswNbtMetaDataNodeTypeProp NameNTP = MailReportNT.getNodeTypeProp( "Name" );
                CswNbtMetaDataNodeTypeProp NextDueDateNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.NextDueDate );
                CswNbtMetaDataNodeTypeProp NodesToReportNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.NodesToReport );
                CswNbtMetaDataNodeTypeProp OutputFormatNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.OutputFormat );
                CswNbtMetaDataNodeTypeProp RecipientsNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Recipients );
                CswNbtMetaDataNodeTypeProp ReportNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Report );
                CswNbtMetaDataNodeTypeProp ReportViewNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.ReportView );
                CswNbtMetaDataNodeTypeProp RunNowNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.RunNow );
                CswNbtMetaDataNodeTypeProp RunStatusNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.RunStatus );
                CswNbtMetaDataNodeTypeProp RunTimeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.RunTime );
                CswNbtMetaDataNodeTypeProp TargetTypeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.TargetType );
                CswNbtMetaDataNodeTypeProp TypeNTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.Type );
                CswNbtMetaDataNodeTypeProp NTP = MailReportNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMailReport.PropertyName.WarningDays );

                CswNbtMetaDataNodeTypeLayoutMgr.LayoutType LayoutEdit = CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit;

                CswNbtMetaDataNodeTypeTab Tab1 = MailReportNT.getFirstNodeTypeTab();
                CswNbtMetaDataNodeTypeTab Tab2 = MailReportNT.getSecondNodeTypeTab();


                // Fix default mail report layout
                if( Tab2 == null )
                {
                    Tab2 = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( MailReportNT, "Schedule", 2 );
                }
                else
                {
                    Tab2.TabName = "Schedule";  // formerly "Settings"
                }

                // clear the old layout
                _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.clearLayout( LayoutEdit, MailReportNT.NodeTypeId );

                // setup the new layout
                if( null != NameNTP )
                {
                    NameNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 1, 1 );
                }
                TypeNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 2, 1 );
                ReportNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 3, 1 );
                EventNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 4, 1 );
                ReportViewNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 5, 1 );
                TargetTypeNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 6, 1 );
                OutputFormatNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 7, 1 );
                MessageNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 8, 1 );
                RecipientsNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 9, 1 );
                EnabledNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 10, 1 );
                RunNowNTP.updateLayout( LayoutEdit, true, Tab1.TabId, 11, 1 );

                DueDateIntervalNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 1, 1 );
                NextDueDateNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 2, 1 );
                FinalDueDateNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 3, 1 );
                RunTimeNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 4, 1 );
                LastProcessedNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 5, 1 );
                RunStatusNTP.updateLayout( LayoutEdit, true, Tab2.TabId, 6, 1 );


                // Remove Output Format from add layout
                OutputFormatNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
            }
        }//Update()