public override void update()
        {
            CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
            if( null != ChemicalNT )
            {
                CswNbtView MHCView = _CswNbtSchemaModTrnsctn.makeNewView( "Missing Hazard Classes", NbtViewVisibility.Global );
                MHCView.Category = "Materials";
                MHCView.Visibility = NbtViewVisibility.Global;
                MHCView.ViewMode = NbtViewRenderingMode.Tree;
            
                CswNbtViewRelationship RootRel = MHCView.AddViewRelationship( ChemicalNT, true );

                CswNbtMetaDataNodeTypeProp SpecialFlagsNTP = ChemicalNT.getNodeTypeProp( "Special Flags" );
                CswNbtViewProperty SpecialFlagsVP = MHCView.AddViewProperty( RootRel, SpecialFlagsNTP );
                MHCView.AddViewPropertyFilter( SpecialFlagsVP,
                                                CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                                CswNbtPropFilterSql.FilterResultMode.Hide,
                                                CswNbtSubField.SubFieldName.Value,
                                                CswNbtPropFilterSql.PropertyFilterMode.NotContains,
                                                "Not Reportable");

                CswNbtMetaDataNodeTypeProp HazardClassesNTP = ChemicalNT.getNodeTypeProp( "Hazard Classes" );
                CswNbtViewProperty HazardClassesVP = MHCView.AddViewProperty( RootRel, HazardClassesNTP );
                MHCView.AddViewPropertyFilter( HazardClassesVP,
                                                CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                                CswNbtPropFilterSql.FilterResultMode.Hide,
                                                CswNbtSubField.SubFieldName.Value,
                                                CswNbtPropFilterSql.PropertyFilterMode.Null);
                MHCView.save();
            }
        }//Update()
Ejemplo n.º 2
0
        public override void update()
        {

            /* updating the propery order on size */
            CswNbtMetaDataNodeType sizeNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Size" );
            if( null != sizeNT )
            {
                CswNbtMetaDataNodeTypeProp initQuantNTP = sizeNT.getNodeTypeProp( CswNbtObjClassSize.InitialQuantityPropertyName );
                CswNbtMetaDataNodeTypeProp catalogNoNTP = sizeNT.getNodeTypeProp( CswNbtObjClassSize.CatalogNoPropertyName );
                CswNbtMetaDataNodeTypeProp quanEditNTP = sizeNT.getNodeTypeProp( CswNbtObjClassSize.QuantityEditablePropertyName );
                CswNbtMetaDataNodeTypeProp dispensableNTP = sizeNT.getNodeTypeProp( CswNbtObjClassSize.DispensablePropertyName );

                if( null != initQuantNTP )
                {
                    initQuantNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, Int32.MinValue, 1, 1 );
                }

                if( null != catalogNoNTP )
                {
                    catalogNoNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, Int32.MinValue, 2, 1 );
                }

                if( null != quanEditNTP )
                {
                    quanEditNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, Int32.MinValue, 3, 1 );
                }

                if( null != dispensableNTP )
                {
                    dispensableNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, Int32.MinValue, 4, 1 );
                }
            }

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

            CswNbtMetaDataNodeType InventoryGroupNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Inventory Group" );
            if( null != InventoryGroupNT ) 
            {
                CswNbtMetaDataNodeTypeProp LocationsNTP = InventoryGroupNT.getNodeTypeProp( "Locations" );
                if( null != LocationsNTP )
                {
                    CswNbtViewId LocationsViewId = LocationsNTP.ViewId;
                    CswNbtView IvgLocationsView = _CswNbtSchemaModTrnsctn.restoreView( LocationsViewId );
                    if( ( null != IvgLocationsView ) && ( null != IvgLocationsView.Root.ChildRelationships[0] ) && ( null != IvgLocationsView.Root.ChildRelationships[0].ChildRelationships[0] ) )
                    {
                        IvgLocationsView.Root.ChildRelationships[0].ChildRelationships[0].AddChildren = CswEnumNbtViewAddChildrenSetting.None;
                        IvgLocationsView.save();
                    }

                }//if we have the locations nt

                CswNbtMetaDataNodeTypeProp AssignLocationsNTP = InventoryGroupNT.getNodeTypeProp( CswNbtObjClassInventoryGroup.PropertyName.AssignLocation );
                CswNbtMetaDataNodeTypeProp LocationsGridNTP = InventoryGroupNT.getNodeTypeProp( "Locations" );
                if( ( null != AssignLocationsNTP ) && ( null != LocationsGridNTP )  )
                {
                    CswNbtMetaDataNodeTypeTab LocationsTab = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeTab( InventoryGroupNT.NodeTypeId, "Locations" );
                    if( null != LocationsTab )
                    {
                        
                        //AssignLocationsNTP
                        //_CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.
                        _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout(
                            CswEnumNbtLayoutType.Edit,
                            InventoryGroupNT.NodeTypeId,
                            AssignLocationsNTP,
                            true,
                            LocationsTab.TabId,
                            1
                            );

                        _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout(
                            CswEnumNbtLayoutType.Edit,
                            InventoryGroupNT.NodeTypeId,
                            LocationsGridNTP,
                            true,
                            LocationsTab.TabId,
                            2
                            );
                        //AssignLocationsNTP.
                    }//if we have a locatioins tab

                }//if we have an assign locations button. 

            }//if we have the inventory group nt
            
        } // update()
Ejemplo n.º 4
0
        private void _updateContainersView( CswNbtMetaDataNodeType MaterialNT )
        {
            CswNbtMetaDataNodeTypeProp ContainersNTP = MaterialNT.getNodeTypeProp( MaterialNT.NodeTypeName + " Containers" );
            if( null != ContainersNTP )
            {
                CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ContainerClass );
                CswNbtMetaDataObjectClassProp MatOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Material );
                CswNbtMetaDataObjectClassProp DisposedOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Disposed );
                CswNbtMetaDataObjectClassProp BarcodeOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Barcode );
                CswNbtMetaDataObjectClassProp QuantityOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Quantity );
                CswNbtMetaDataObjectClassProp StatusOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Status );
                CswNbtMetaDataObjectClassProp OwnerOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Owner );
                CswNbtMetaDataObjectClassProp LocationOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Location );

                CswNbtView ContainersView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( ContainersNTP.ViewId );
                ContainersView.Root.ChildRelationships.Clear();
                CswNbtViewRelationship RootRel = ContainersView.AddViewRelationship( MaterialPS, false );
                CswNbtViewRelationship MatRel = ContainersView.AddViewRelationship( RootRel, CswEnumNbtViewPropOwnerType.Second, MatOCP, true );
                ContainersView.AddViewPropertyAndFilter( MatRel, DisposedOCP, CswEnumTristate.False.ToString(),
                                                             FilterMode: CswEnumNbtFilterMode.Equals,
                                                             ShowAtRuntime: false,
                                                             ShowInGrid: false );
                ContainersView.AddViewProperty( MatRel, BarcodeOCP, 1 );
                ContainersView.AddViewProperty( MatRel, QuantityOCP, 2 );
                ContainersView.AddViewProperty( MatRel, StatusOCP, 3 );
                ContainersView.AddViewProperty( MatRel, OwnerOCP, 4 );
                ContainersView.AddViewProperty( MatRel, LocationOCP, 5 );
                ContainersView.save();
            }
        }
Ejemplo n.º 5
0
        public override void update()
        {
            HashSet<string> barcodesInSystem = new HashSet<string>();

            CswNbtMetaDataNodeType containerNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Container" );
            if( null != containerNT )
            {
                //check for any duplicate barcodes and make them unique
                foreach( CswNbtNode curContainer in containerNT.getNodes( false, true ) )
                {
                    CswNbtNodePropBarcode barCode = curContainer.Properties[CswNbtMetaDataFieldType.NbtFieldType.Barcode].AsBarcode;
                    while( barcodesInSystem.Contains( barCode.Barcode ) )
                    {
                        barCode.setBarcodeValueOverride( "", false ); //clear the barcode
                        barCode.setBarcodeValue(); //then let it go to the next sequence so it's %100 unique
                    }
                    barcodesInSystem.Add( barCode.Barcode );
                    curContainer.postChanges( false );
                }

                //make the barcode prop unique
                CswNbtMetaDataNodeTypeProp barcodeNTP = containerNT.getNodeTypeProp( CswNbtObjClassContainer.BarcodePropertyName );
                if( null != barcodeNTP )
                {
                    barcodeNTP.setIsUnique( true );
                }
            }
        }//Update()
Ejemplo n.º 6
0
        /// <summary>
        /// Add new Relationship entries to a definition (for use by CswNbtImporter)
        /// </summary>
        public static void addRelationshipEntries(CswNbtResources CswNbtResources, DataTable RelationshipsDataTable)
        {
            CswTableUpdate importRelationshipsUpdate = CswNbtResources.makeCswTableUpdate("storeDefinition_Relationships_update", CswNbtImportTables.ImportDefRelationships.TableName);

            foreach (DataRow RelRow in RelationshipsDataTable.Select())
            {
                //set blank instances to min value
                if (RelRow["instance"] == DBNull.Value || String.IsNullOrEmpty(RelRow["instance"].ToString()))
                {
                    RelRow["instance"] = Int32.MinValue;
                }

                string NodeTypeName                     = RelRow["nodetypename"].ToString();
                string RelationshipName                 = RelRow["relationship"].ToString();
                CswNbtMetaDataNodeType     NodeType     = CswNbtResources.MetaData.getNodeType(NodeTypeName);
                CswNbtMetaDataNodeTypeProp Relationship = NodeType.getNodeTypeProp(RelationshipName);
                if (null == NodeType)
                {
                    throw new CswDniException(CswEnumErrorType.Error, "Error reading bindings", "Invalid NodeType defined in 'Relationships' sheet: " + NodeTypeName);
                }
                else if (null == Relationship)
                {
                    throw new CswDniException(CswEnumErrorType.Error, "Error reading bindings", "Invalid Relationship defined in 'Relationships' sheet: " + RelRow["relationship"].ToString() + " (nodetype: " + NodeTypeName + ")");
                }
            } // foreach( DataRow RelRow in RelationshipsDataTable.Rows )

            //this is a hack, and the fact that we can even do this makes me sad
            importRelationshipsUpdate._DoledOutTables.Add(RelationshipsDataTable);
            importRelationshipsUpdate.update(RelationshipsDataTable);
        } // addRelationshipEntries()
Ejemplo n.º 7
0
        } // getBulkEditProperties()

        public static void DownloadBulkEditData(ICswResources CswResources, BulkEditDownload ret, BulkEditParams Params)
        {
            CswNbtResources        NbtResources = (CswNbtResources)CswResources;
            CswNbtMetaDataNodeType NodeType     = NbtResources.MetaData.getNodeType(Params.NodeTypeId);

            if (null != NodeType)
            {
                ret.CsvData = new DataTable();
                ret.CsvData.Columns.Add("nodeid");
                foreach (Int32 PropId in Params.PropIds)
                {
                    CswNbtMetaDataNodeTypeProp Prop = NodeType.getNodeTypeProp(PropId);
                    if (Prop.getFieldTypeRule().SubFields.Count > 1)
                    {
                        foreach (CswNbtSubField SubField in Prop.getFieldTypeRule().SubFields)
                        {
                            ret.CsvData.Columns.Add(Prop.PropName + " " + SubField.Name);
                        }
                    }
                    else
                    {
                        ret.CsvData.Columns.Add(Prop.PropName);
                    }
                }

                CswNbtView  View = NbtResources.ViewSelect.restoreView(new CswNbtViewId(Params.ViewId));
                ICswNbtTree Tree = NbtResources.Trees.getTreeFromView(View, RequireViewPermissions: true, IncludeSystemNodes: false, IncludeHiddenNodes: false);
                _recurseBulkEditData(NodeType, Tree, ret, Params);
            }
        } // DownloadBulkEditData()
Ejemplo n.º 8
0
        public override void update()
        {

            CswNbtMetaDataNodeType sizeNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Size" );
            if( null != sizeNT )
            {
                CswNbtMetaDataNodeTypeProp containerTypeNTP = sizeNT.getNodeTypeProp( "Container Type" );
                if( null != containerTypeNTP )
                {
                    containerTypeNTP.ListOptions = "Aboveground Tank [A]," +
                                                       "Bag [J]," +
                                                       "Belowground Tank [B]," +
                                                       "Box [K]," +
                                                       "Can [F]," +
                                                       "Carboy [G]," +
                                                       "Cylinder [L]," +
                                                       "Fiberdrum [I]," +
                                                       "Glass Bottle or Jug [M]," +
                                                       "Plastic [N]," +
                                                       "Plastic or Non-Metal Drum [E]," +
                                                       "Steel Drum [D]," +
                                                       "Tank Inside Building [C]," +
                                                       "Tank Wagon [P]," +
                                                       "Tote Bin [O]";
                }
            }

        }//Update()
Ejemplo n.º 9
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()
        /// <summary>
        /// Update logic
        /// </summary>
        public override void update()
        {

            CswNbtMetaDataNodeType materialDocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Material Document" );
            CswNbtMetaDataNodeTypeProp documentClassNTP = materialDocumentNT.getNodeTypeProp( "Document Class" );
            if( null != materialDocumentNT && null != documentClassNTP )
            {
                CswNbtMetaDataNodeTypeTab materialDocumentNTT = materialDocumentNT.getFirstNodeTypeTab();
                if( null != materialDocumentNTT )
                {
                    CswNbtMetaDataNodeTypeProp issueDateNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( materialDocumentNT, CswNbtMetaDataFieldType.NbtFieldType.DateTime, "Issue Date", materialDocumentNTT.TabId );

                    issueDateNTP.setFilter( documentClassNTP, documentClassNTP.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassDocument.DocumentClasses.MSDS );

                    _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout(
                        CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add,
                        materialDocumentNT.NodeTypeId,
                        issueDateNTP.PropId,
                        true,
                        materialDocumentNTT.TabId );

                    _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout(
                        CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit,
                        materialDocumentNT.NodeTypeId,
                        issueDateNTP.PropId,
                        true,
                        materialDocumentNTT.TabId );
                }
            }

        }
Ejemplo n.º 11
0
        private void _updateDocumentsView( CswNbtMetaDataNodeType MaterialNT )
        {
            CswNbtMetaDataNodeTypeProp DocumentsNTP = MaterialNT.getNodeTypeProp( "Documents" );
            if( null != DocumentsNTP )
            {
                CswNbtMetaDataNodeType DocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Material Document" );
                if( null != DocumentNT )
                {
                    CswNbtMetaDataNodeTypeProp MatOCP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner );
                    CswNbtMetaDataNodeTypeProp AcquiredDateNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.AcquiredDate );
                    CswNbtMetaDataNodeTypeProp ExpDateNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.ExpirationDate );
                    CswNbtMetaDataNodeTypeProp FileNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.File );
                    CswNbtMetaDataNodeTypeProp LinkNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Link );
                    CswNbtMetaDataNodeTypeProp ArchivedNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Archived );

                    CswNbtView DocumentsView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( DocumentsNTP.ViewId );
                    DocumentsView.Root.ChildRelationships.Clear();
                    CswNbtViewRelationship RootRel = DocumentsView.AddViewRelationship( MaterialPS, false );
                    CswNbtViewRelationship MatRel = DocumentsView.AddViewRelationship( RootRel, CswEnumNbtViewPropOwnerType.Second, MatOCP, true );
                    DocumentsView.AddViewPropertyAndFilter( MatRel, ArchivedNTP, CswEnumTristate.False.ToString(),
                                                             FilterMode: CswEnumNbtFilterMode.Equals,
                                                             ShowAtRuntime: true,
                                                             ShowInGrid: false );
                    DocumentsView.AddViewProperty( MatRel, AcquiredDateNTP, 1 );
                    DocumentsView.AddViewProperty( MatRel, ExpDateNTP, 2 );
                    DocumentsView.AddViewProperty( MatRel, FileNTP, 3 );
                    DocumentsView.AddViewProperty( MatRel, LinkNTP, 4 );
                    DocumentsView.save();
                }
            }
        }
        }//Update()

        private void _addToPreview( String NodeTypePropName )
        {
            CswNbtMetaDataNodeTypeProp ChemicalNTP = ChemicalNT.getNodeTypeProp( NodeTypePropName );
            if( null != ChemicalNTP )
            {
                ChemicalNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true );
            }
        }
        } // update()

        private void _migrateMaterialNodeTypePropsToNonChemical( CswNbtMetaDataNodeType MaterialNT )
        {
            //Update the NodeTypeProps' OCPs to point to NonChemical's OCPs - if NonChemical does not have an OCP with the given NTP name, the NTP is deleted.
            CswNbtMetaDataObjectClass NonChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.NonChemicalClass );

            List<int> DoomedNTPIds = new List<int>();
            CswTableUpdate NTPUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "28690_ntp_update", "nodetype_props" );
            DataTable NTPTable = NTPUpdate.getTable( "where nodetypeid = " + MaterialNT.NodeTypeId + " and objectclasspropid is not null" );
            foreach( DataRow NTPRow in NTPTable.Rows )
            {
                string NTPropName = NTPRow["propname"].ToString();
                bool MoveProp = ( NTPropName == CswNbtPropertySetMaterial.PropertyName.MaterialId ||
                                    NTPropName == CswNbtPropertySetMaterial.PropertyName.TradeName ||
                                    NTPropName == CswNbtPropertySetMaterial.PropertyName.Supplier ||
                                    NTPropName == CswNbtPropertySetMaterial.PropertyName.PartNumber ||
                                    NTPropName == CswNbtPropertySetMaterial.PropertyName.ApprovedForReceiving ||
                                    NTPropName == CswNbtPropertySetMaterial.PropertyName.Receive ||
                                    NTPropName == CswNbtPropertySetMaterial.PropertyName.Request ||
                                    NTPropName == CswNbtPropertySetMaterial.PropertyName.C3ProductId ||
                                    NTPropName == CswNbtPropertySetMaterial.PropertyName.C3SyncDate ||
                                    NTPropName == CswNbtObjClass.PropertyName.Save || 
                                    NTPropName == "Biological Name" );//Special Case
                if( MoveProp )
                {
                    if( NTPropName == "Biological Name" )//Special Case
                    {
                        NTPropName = CswNbtPropertySetMaterial.PropertyName.TradeName;
                    }
                    NTPRow["objectclasspropid"] = NonChemicalOC.getObjectClassProp( NTPropName ).ObjectClassPropId;
                }
                else
                {
                    NTPRow["objectclasspropid"] = DBNull.Value;
                    DoomedNTPIds.Add( CswConvert.ToInt32( NTPRow["nodetypepropid"] ) );
                }
            }
            NTPUpdate.update( NTPTable );

            foreach( int DoomedNTPId in DoomedNTPIds )
            {
                CswNbtMetaDataNodeTypeProp DoomedNTP = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( DoomedNTPId );
                _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( DoomedNTP );
            }

            //special case - remove SDS grid prop
            CswNbtMetaDataNodeTypeProp AssignedSDSNTP = MaterialNT.getNodeTypeProp( "Assigned SDS" );
            if( null != AssignedSDSNTP )
            {
                _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( AssignedSDSNTP );
            }

            //remove hazards tab
            CswNbtMetaDataNodeTypeTab HazardsTab = MaterialNT.getNodeTypeTab( "Hazards" );
            if( null != HazardsTab )
            {
                _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeTab( HazardsTab );
            }
        }
 private void _filterToSDS( CswNbtMetaDataNodeType DocumentNT, String NodeTypePropName )
 {
     CswNbtMetaDataNodeTypeProp DocumentNTP = DocumentNT.getNodeTypeProp( NodeTypePropName );
     if( null != DocumentNTP )
     {
         DocumentNTP.setFilter( DocumentClassNTP, DocumentClassNTP.getFieldTypeRule().SubFields.Default, CswNbtPropFilterSql.PropertyFilterMode.Equals, CswNbtObjClassDocument.DocumentClasses.SDS );
         DocumentNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, DocumentNT.getFirstNodeTypeTab().TabId );
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Add new Binding entries to a definition (for use by CswNbtImporter)
        /// </summary>
        public static void addBindingEntries(CswNbtResources CswNbtResources, DataTable BindingsDataTable)
        {
            CswTableUpdate importBindingsUpdate = CswNbtResources.makeCswTableUpdate("storeDefinition_Bindings_update", CswNbtImportTables.ImportDefBindings.TableName);

            foreach (DataRow BindingRow in BindingsDataTable.Select())
            {
                //set blank instances to min value
                if (BindingRow["instance"] == DBNull.Value || String.IsNullOrEmpty(BindingRow["instance"].ToString()))
                {
                    BindingRow["instance"] = Int32.MinValue;
                }

                CswNbtMetaDataNodeType     DestNodeType = null;
                CswNbtMetaDataNodeTypeProp DestProp     = null;

                string DestNTName  = BindingRow["destnodetypename"].ToString();
                string DestNTPName = BindingRow["destpropname"].ToString();
                DestNodeType = CswNbtResources.MetaData.getNodeType(DestNTName);

                if (DestNTPName == "Legacy Id")
                {
                    BindingRow["destsubfield"] = "";
                }
                else
                {
                    DestProp = DestNodeType.getNodeTypeProp(DestNTPName);
                    if (null == DestNodeType)
                    {
                        throw new CswDniException(CswEnumErrorType.Error, "Error reading bindings", "Invalid destnodetype defined in 'Bindings' sheet: " + DestNTName);
                    }
                    else if (null == DestProp)
                    {
                        throw new CswDniException(CswEnumErrorType.Error, "Error reading bindings", "Invalid destproperty defined in 'Bindings' sheet: " + BindingRow["destpropname"].ToString() + " (nodetype: " + DestNTName + ")");
                    }
                    else
                    {
                        string DestSubFieldStr = BindingRow["destsubfield"].ToString();
                        if (DestSubFieldStr != CswEnumNbtSubFieldName.Blob.ToString())
                        {
                            CswNbtSubField DestSubfield = DestProp.getFieldTypeRule().SubFields[(CswEnumNbtSubFieldName)BindingRow["destsubfield"].ToString()];
                            if (DestSubfield == null)
                            {
                                DestSubfield    = DestProp.getFieldTypeRule().SubFields.Default;
                                DestSubFieldStr = DestSubfield.Name.ToString();
                            }
                        }
                        BindingRow["destsubfield"] = DestSubFieldStr;
                    } // else -- (when DestNodeType and DestProp are defined)
                }
            }         // foreach( DataRow BindingRow in BindingsDataTable.Rows )

            //this is a hack, and the fact that we can even do this makes me sad
            importBindingsUpdate._DoledOutTables.Add(BindingsDataTable);
            importBindingsUpdate.update(BindingsDataTable);
        } // addBindingEntries()
        public override void update()
        {
            CswNbtMetaDataNodeType VolumeUnitNodeType = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Unit (Volume)" );
            if( null != VolumeUnitNodeType )
            {
                createUnitOfMeasureNode( VolumeUnitNodeType.NodeTypeId, "cu.ft.", 3.53147, -2, Tristate.True );
            }

            CswNbtMetaDataNodeType RadiationUnitNodeType = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( "UnitOfMeasureClass", "Unit (Radiation)", "Units" );
            RadiationUnitNodeType.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassUnitOfMeasure.PropertyName.Name ) );
            CswNbtMetaDataNodeTypeProp RadiationBaseUnitProp = RadiationUnitNodeType.getNodeTypeProp( CswNbtObjClassUnitOfMeasure.PropertyName.BaseUnit );
            RadiationBaseUnitProp.DefaultValue.AsText.Text = "Ci";
            CswNbtMetaDataNodeTypeProp RadiationUnitTypeProp = RadiationUnitNodeType.getNodeTypeProp( CswNbtObjClassUnitOfMeasure.PropertyName.UnitType );
            RadiationUnitTypeProp.DefaultValue.AsList.Value = CswNbtObjClassUnitOfMeasure.UnitTypes.Radiation.ToString();
            RadiationUnitTypeProp.removeFromAllLayouts();

            createUnitOfMeasureNode( RadiationUnitNodeType.NodeTypeId, "Ci", 1.0, 0, Tristate.True );
            createUnitOfMeasureNode( RadiationUnitNodeType.NodeTypeId, "mCi", 1.0, 3, Tristate.True );
            createUnitOfMeasureNode( RadiationUnitNodeType.NodeTypeId, "Bq", 2.7027027, -11, Tristate.True );
        }
        private void _upgradeControlZoneToObjectClass()
        {
            CswNbtMetaDataObjectClass ControlZoneOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.ControlZoneClass);

            if (null == ControlZoneOC)
            {
                ControlZoneOC = _CswNbtSchemaModTrnsctn.createObjectClass(CswEnumNbtObjectClass.ControlZoneClass, "folder.png", false);
                _CswNbtSchemaModTrnsctn.createObjectClassProp(ControlZoneOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName   = CswNbtObjClassControlZone.PropertyName.Name,
                    FieldType  = CswEnumNbtFieldType.Text,
                    IsRequired = true,
                    IsUnique   = true
                });
                _CswNbtSchemaModTrnsctn.createObjectClassProp(ControlZoneOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName       = CswNbtObjClassControlZone.PropertyName.MAQOffset,
                    FieldType      = CswEnumNbtFieldType.Number,
                    NumberMinValue = 0,
                    NumberMaxValue = 100
                });
                CswNbtMetaDataObjectClass FCEASOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.FireClassExemptAmountSetClass);
                _CswNbtSchemaModTrnsctn.createObjectClassProp(ControlZoneOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName   = CswNbtObjClassControlZone.PropertyName.FireClassSetName,
                    FieldType  = CswEnumNbtFieldType.Relationship,
                    IsRequired = true,
                    IsFk       = true,
                    FkType     = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(),
                    FkValue    = FCEASOC.ObjectClassId
                });
                CswNbtMetaDataObjectClassProp LocationsOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(ControlZoneOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName  = CswNbtObjClassControlZone.PropertyName.Locations,
                    FieldType = CswEnumNbtFieldType.Grid
                });
                CswNbtMetaDataNodeType ControlZoneNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType("Control Zone");
                if (null != ControlZoneNT)
                {
                    CswNbtMetaDataNodeTypeProp CZLocationsNTP = ControlZoneNT.getNodeTypeProp("Locations");
                    if (null != CZLocationsNTP)
                    {
                        CswNbtView CZLocationsView = _CswNbtSchemaModTrnsctn.restoreView(CZLocationsNTP.ViewId);
                        if (null != CZLocationsView)
                        {
                            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(LocationsOCP, CswEnumNbtObjectClassPropAttributes.viewxml, CZLocationsView.ToString());
                        }
                    }
                    _CswNbtSchemaModTrnsctn.MetaData.ConvertObjectClass(ControlZoneNT, ControlZoneOC);
                }
            }
        }
        public override void update()
        {
            // Create a demo mail report (notification)

            CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.UserClass );
            CswNbtMetaDataObjectClass MailReportOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MailReportClass );

            CswNbtMetaDataNodeType MailReportNT = MailReportOC.FirstNodeType;
            CswNbtMetaDataNodeTypeProp MailReportNameNTP = MailReportNT.getNodeTypeProp( "Name" );

            CswNbtMetaDataNodeType UserNT = UserOC.FirstNodeType;
            CswNbtMetaDataNodeTypeProp UserLockedNTP = UserNT.getNodeTypePropByObjectClassProp( CswNbtObjClassUser.PropertyName.AccountLocked );


            if( null != MailReportNT && null != UserNT )
            {
                CswNbtObjClassMailReport MailReportNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( MailReportNT.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
                if( null != MailReportNameNTP )
                {
                    MailReportNode.Node.Properties[MailReportNameNTP].AsText.Text = "Locked Users Notification";
                }
                MailReportNode.OutputFormat.Value = "link";

                MailReportNode.Type.Value = CswNbtObjClassMailReport.TypeOptionView;
                MailReportNode.Event.Value = CswNbtObjClassMailReport.EventOption.Edit.ToString();
                MailReportNode.TargetType.SelectedNodeTypeIds.Add( UserNT.NodeTypeId.ToString() );
                MailReportNode.Message.Text = "The following user accounts have been locked:";
                MailReportNode.Enabled.Checked = Tristate.False;
                MailReportNode.IsDemo = true;

                CswRateInterval HourlyRate = _CswNbtSchemaModTrnsctn.makeRateInterval();
                HourlyRate.setHourly( 1, DateTime.Now );
                MailReportNode.DueDateInterval.RateInterval = HourlyRate;

                CswNbtObjClassUser AdminUser = _CswNbtSchemaModTrnsctn.Nodes.makeUserNodeFromUsername( "admin" );
                if( null != AdminUser )
                {
                    MailReportNode.Recipients.AddUser( AdminUser.UserId );
                }

                MailReportNode.postChanges( true );

                CswNbtView ReportView = _CswNbtSchemaModTrnsctn.restoreView( MailReportNode.ReportView.ViewId );
                ReportView.Root.ChildRelationships.Clear();
                CswNbtViewRelationship UserRel = ReportView.AddViewRelationship( UserNT, false );
                ReportView.AddViewPropertyAndFilter( UserRel, UserLockedNTP, Tristate.True.ToString() );
                ReportView.save();

            } // if( null != MailReportNT )

        }//Update()
Ejemplo n.º 19
0
        public override void update()
        {
            #region PART ONE
            //Remove Part Number (chemical, biological and supply NTPs) from Add layout, so it doesn't show up twice while creating a material
            CswNbtMetaDataNodeType chemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
            if( null != chemicalNT )
            {
                CswNbtMetaDataNodeTypeProp chemPartNoNTP = chemicalNT.getNodeTypeProp( CswNbtObjClassMaterial.PartNumberPropertyName );
                if( null != chemPartNoNTP )
                {
                    chemPartNoNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                }
            }

            CswNbtMetaDataNodeType bioNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Biological" );
            if( null != bioNT )
            {
                CswNbtMetaDataNodeTypeProp bioPartNoNTP = bioNT.getNodeTypeProp( CswNbtObjClassMaterial.PartNumberPropertyName );
                if( null != bioPartNoNTP )
                {
                    bioPartNoNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                }
            }

            CswNbtMetaDataNodeType supplyNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Supply" );
            if( null != supplyNT )
            {
                CswNbtMetaDataNodeTypeProp supplyPartNoNTP = supplyNT.getNodeTypeProp( CswNbtObjClassMaterial.PartNumberPropertyName );
                if( null != supplyPartNoNTP )
                {
                    supplyPartNoNTP.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );
                }
            }
            #endregion

            #region PART FIVE
            //Remove 'Supplier'from add layout so it doesn' show up in Create Materials Wizard
            CswNbtMetaDataNodeType sizeNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Size" );
            if( null != sizeNT )
            {
                CswNbtMetaDataNodeTypeProp supplierNTP = sizeNT.getNodeTypeProp("Supplier");
                if (null != supplierNTP)
                {
                    supplierNTP.removeFromLayout(CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add);
                }
            }

            #endregion

        }//Update()
        public override void update()
        {
            // Update existing 'Locations' view for Order change
            {
                CswNbtView LocationsView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( "Locations", NbtViewVisibility.Global );
                if( null != LocationsView )
                {
                    CswNbtObjClassLocation.makeLocationsTreeView( ref LocationsView, _CswNbtSchemaModTrnsctn );
                    LocationsView.save();
                }
            }

            // Also fix the Equipment by Location view
            {
                CswNbtView EquipByLocView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( "Equipment By Location", NbtViewVisibility.Global );
                if( null != EquipByLocView )
                {
                    CswNbtObjClassLocation.makeLocationsTreeView( ref EquipByLocView, _CswNbtSchemaModTrnsctn );

                    CswNbtMetaDataObjectClass EquipmentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.EquipmentClass );
                    CswNbtMetaDataNodeType EquipmentNT = EquipmentOC.FirstNodeType;
                    CswNbtMetaDataNodeTypeProp EquipmentLocationNTP = null;
                    if( null != EquipmentNT )
                    {
                        EquipmentLocationNTP = EquipmentNT.getNodeTypeProp( "Location" );
                    }
                    CswNbtMetaDataObjectClass AssemblyOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.EquipmentAssemblyClass );
                    CswNbtMetaDataNodeType AssemblyNT = AssemblyOC.FirstNodeType;
                    CswNbtMetaDataNodeTypeProp AssemblyLocationNTP = null;
                    if( null != AssemblyNT )
                    {
                        AssemblyLocationNTP = AssemblyNT.getNodeTypeProp( "Location" );
                    }

                    foreach( CswNbtViewRelationship LocRel in EquipByLocView.Root.GetAllChildrenOfType( NbtViewNodeType.CswNbtViewRelationship ) )
                    {
                        if( null != EquipmentLocationNTP )
                        {
                            EquipByLocView.AddViewRelationship( LocRel, NbtViewPropOwnerType.Second, EquipmentLocationNTP, true );
                        }
                        if( null != AssemblyLocationNTP )
                        {
                            EquipByLocView.AddViewRelationship( LocRel, NbtViewPropOwnerType.Second, AssemblyLocationNTP, true );
                        }
                    }
                    EquipByLocView.save();
                }
            }
        } //Update()
Ejemplo n.º 21
0
        public override void update()
        {
            CswNbtMetaDataObjectClass GhsOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.GHSClass );
            CswNbtMetaDataNodeType GhsNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "GHS" );
            if( null != GhsNT )
            {
                CswNbtMetaDataNodeTypeProp GhsPhraseNTP = GhsNT.getNodeTypeProp( "GHS Phrase" );
                CswNbtMetaDataNodeTypeProp GhsTypeNTP = GhsNT.getNodeTypeProp( "Type" );
                CswNbtMetaDataNodeTypeProp GhsJurisdictionNTP = GhsNT.getNodeTypeProp( "Jurisdiction" );
                _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( GhsTypeNTP );
                _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( GhsPhraseNTP );
                _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp( GhsJurisdictionNTP );

                _CswNbtSchemaModTrnsctn.MetaData.ConvertObjectClass( GhsNT, GhsOC );
            } // if( null != GhsNT )

            CswNbtMetaDataObjectClass GhsPhraseOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.GHSPhraseClass );
            CswNbtMetaDataNodeType GhsPhraseNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "GHS Phrase" );
            if( null != GhsPhraseNT )
            {
                _CswNbtSchemaModTrnsctn.MetaData.ConvertObjectClass( GhsPhraseNT, GhsPhraseOC );
            } // if( null != GhsPhraseNT )
            
        } //Update()
Ejemplo n.º 22
0
 protected static void _addNameTemplateProps(CswNbtView View, CswNbtViewRelationship Relationship, CswNbtMetaDataNodeType NodeType)
 {
     if (View.ViewMode != CswEnumNbtViewRenderingMode.Tree && View.ViewMode != CswEnumNbtViewRenderingMode.List)
     {
         foreach (string TemplateId in NodeType.NameTemplatePropIds)
         {
             Int32 TemplateIdInt            = CswConvert.ToInt32(TemplateId);
             CswNbtMetaDataNodeTypeProp ntp = NodeType.getNodeTypeProp(TemplateIdInt);
             if (null != ntp && null == Relationship.findPropertyByName(ntp.PropName))
             {
                 View.AddViewProperty(Relationship, ntp);
             }
         }
     }
 }
Ejemplo n.º 23
0
        public override void update()
        {
            //Creates the preview layout for mol files
            CswNbtMetaDataNodeType chemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
            if( null != chemicalNT )
            {
                CswNbtMetaDataNodeTypeProp structureNTP = chemicalNT.getNodeTypeProp( "Structure" );
                if( null != structureNTP )
                {
                    structureNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true );
                }
            }


        }//Update()
Ejemplo n.º 24
0
        public override void update()
        {
            CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
            if( null != ChemicalNT )
            {
                CswNbtMetaDataNodeTypeProp ContainersNTP = ChemicalNT.getNodeTypeProp( "Chemical Containers" );
                if( null != ContainersNTP )
                {
                    CswNbtViewId ChemContainersViewId = ContainersNTP.ViewId;
                    CswNbtView ChemContainersView = _CswNbtSchemaModTrnsctn.restoreView( ChemContainersViewId );
                    CswNbtViewProperty DisposedViewProp = ChemContainersView.findPropertyByName( "Disposed" );
                    foreach( CswNbtViewPropertyFilter CurrentFilter in DisposedViewProp.Filters )
                    {
                        CurrentFilter.ShowAtRuntime = true;
                    }

                    ChemContainersView.save();

                }//if we ahve a containers NTP

            }//if we have a chemical NT


            CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.LocationClass );
            foreach( CswNbtMetaDataNodeType CurrentLocationNT in LocationOC.getNodeTypes() )
            {
                    CswNbtMetaDataNodeTypeProp ContainersNTP = CurrentLocationNT.getNodeTypeProp( "Containers" );
                    if( null != ContainersNTP )
                    {
                        CswNbtViewId ChemContainersViewId = ContainersNTP.ViewId;
                        CswNbtView ChemContainersView = _CswNbtSchemaModTrnsctn.restoreView( ChemContainersViewId );
                        CswNbtViewProperty DisposedViewProp = ChemContainersView.findPropertyByName( "Disposed" );
                        foreach( CswNbtViewPropertyFilter CurrentFilter in DisposedViewProp.Filters )
                        {
                            CurrentFilter.ShowAtRuntime = true;
                        }

                        ChemContainersView.save();

                    }//if we ahve a containers NTP

            }//iterate location node types





        } // update()
Ejemplo n.º 25
0
        private void _updateSynonymsView( CswNbtMetaDataNodeType MaterialNT )
        {
            CswNbtMetaDataNodeTypeProp SynonymsNTP = MaterialNT.getNodeTypeProp( "Synonyms" );
            if( null != SynonymsNTP )
            {
                CswNbtMetaDataObjectClass MatSynOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.MaterialSynonymClass );
                CswNbtMetaDataObjectClassProp MatOCP = MatSynOC.getObjectClassProp( CswNbtObjClassMaterialSynonym.PropertyName.Material );
                CswNbtMetaDataObjectClassProp NameOCP = MatSynOC.getObjectClassProp( CswNbtObjClassMaterialSynonym.PropertyName.Name );

                CswNbtView SynonymsView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( SynonymsNTP.ViewId );
                SynonymsView.Root.ChildRelationships.Clear();
                CswNbtViewRelationship RootRel = SynonymsView.AddViewRelationship( MaterialPS, false );
                CswNbtViewRelationship MatRel = SynonymsView.AddViewRelationship( RootRel, CswEnumNbtViewPropOwnerType.Second, MatOCP, true );
                SynonymsView.AddViewProperty( MatRel, NameOCP, 1 );
                SynonymsView.save();
            }
        }
        public override void update()
        {
            // Farewell LocationContents, I hardly knew ye

            // delete box's LocationContents property and Contents tab
            CswNbtMetaDataNodeType BoxNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType("Box");

            if (null != BoxNT)
            {
                CswNbtMetaDataNodeTypeProp BoxLocationContentsNTP = BoxNT.getNodeTypeProp("LocationContents");
                if (null != BoxLocationContentsNTP)
                {
                    _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp(BoxLocationContentsNTP);
                }

                CswNbtMetaDataNodeTypeTab BoxContentsNTT = BoxNT.getNodeTypeTab("Contents");
                if (null != BoxContentsNTT)
                {
                    _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeTab(BoxContentsNTT);
                }
            }

            // field_types_subfields
            {
                CswTableUpdate FieldTypeSubFieldUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("30564_ft_update", "field_types_subfields");
                DataTable      Table = FieldTypeSubFieldUpdate.getTable("where fieldtypeid = (select fieldtypeid from field_types where fieldtype= 'LocationContents')");
                foreach (DataRow Row in Table.Rows)
                {
                    Row.Delete();
                }
                FieldTypeSubFieldUpdate.update(Table);
            }

            // field_types
            {
                CswTableUpdate FieldTypeUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("30564_ft_update", "field_types");
                DataTable      Table           = FieldTypeUpdate.getTable("where fieldtype= 'LocationContents'");
                foreach (DataRow Row in Table.Rows)
                {
                    Row.Delete();
                }
                FieldTypeUpdate.update(Table);
            }
        }
Ejemplo n.º 27
0
        public override void update()
        {
            CswNbtMetaDataObjectClass TaskOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.TaskClass );
            CswNbtMetaDataObjectClassProp DueDataOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.DueDate );
            CswNbtMetaDataObjectClassProp DoneOnOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.DoneOn );
            CswNbtMetaDataObjectClassProp CompletedOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.Completed );
            CswNbtMetaDataObjectClassProp SummaryOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.Summary );
            CswNbtMetaDataObjectClassProp OwnerOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.Owner ); //Equipment or Assembly for NTs
            CswNbtMetaDataObjectClassProp TechOCP = TaskOC.getObjectClassProp( CswNbtObjClassTask.PropertyName.Technician );
            //Location could not be upgraded to an OCP (See BV) so we just get the first Location NTP
            CswNbtMetaDataNodeTypeProp LocationNTP = null;
            CswNbtMetaDataNodeType FirstTaskNT = TaskOC.getNodeTypes().FirstOrDefault();
            if( null != FirstTaskNT )
            {
                LocationNTP = FirstTaskNT.getNodeTypeProp( "Location" );
            }

            CswNbtView CompletedTasks = _CswNbtSchemaModTrnsctn.makeSafeView( "Tasks: Completed", CswEnumNbtViewVisibility.Global );
            CompletedTasks.SetViewMode( CswEnumNbtViewRenderingMode.Grid );
            CompletedTasks.Category = "Tasks";
            CswNbtViewRelationship parent = CompletedTasks.AddViewRelationship( TaskOC, true );

            CompletedTasks.AddViewProperty( parent, DueDataOCP, 1 );
            CompletedTasks.AddViewProperty( parent, DoneOnOCP, 2 );

            CswNbtViewProperty completedVP = CompletedTasks.AddViewProperty( parent, CompletedOCP );
            CompletedTasks.AddViewPropertyFilter( completedVP, Value: true.ToString() );
            completedVP.ShowInGrid = false;

            CompletedTasks.AddViewProperty( parent, SummaryOCP, 3 );

            CompletedTasks.AddViewProperty( parent, OwnerOCP, 4 );

            if( null != LocationNTP )
            {
                CompletedTasks.AddViewProperty( parent, LocationNTP, 5 );
            }

            CompletedTasks.AddViewProperty( parent, TechOCP, 6 );

            CompletedTasks.save();


        } // update()
Ejemplo n.º 28
0
        public override void update()
        {
            CswNbtMetaDataObjectClass DocumentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.DocumentClass );
            CswNbtMetaDataNodeType SDSNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "SDS Document" );
            if( null != SDSNT )
            {
                foreach( CswNbtObjClassDocument DocNode in DocumentOC.getNodes( false, false ) )
                {
                    if( DocNode.NodeTypeId != SDSNT.NodeTypeId && 
                        ( DocNode.DocumentClass.Value == "SDS" || 
                        ( false == string.IsNullOrEmpty( DocNode.Language.Value ) && false == string.IsNullOrEmpty( DocNode.Format.Value ) ) ) )
                    {
                        CswNbtObjClassDocument SDSNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( SDSNT.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
                        SDSNode.Title.Text = DocNode.Title.Text;
                        SDSNode.Owner.RelatedNodeId = DocNode.Owner.RelatedNodeId;
                        SDSNode.FileType.Value = DocNode.FileType.Value;
                        SDSNode.Link.Text = DocNode.Link.Text;
                        SDSNode.Link.Href = DocNode.Link.Href;
                        SDSNode.Language.Value = DocNode.Language.Value;
                        SDSNode.Format.Value = DocNode.Format.Value;
                        SDSNode.AcquiredDate.DateTimeValue = DocNode.AcquiredDate.DateTimeValue;
                        SDSNode.ExpirationDate.DateTimeValue = DocNode.ExpirationDate.DateTimeValue;
                        SDSNode.Archived.Checked = DocNode.Archived.Checked;
                        if( SDSNode.Title.Text.EndsWith( "(Archived)" ) && SDSNode.Archived.Checked == Tristate.True )
                        {
                            SDSNode.Title.Text = SDSNode.Title.Text.Replace("(Archived)", "");
                        }
                        CswNbtMetaDataNodeTypeProp RevisionDateNTP = SDSNT.getNodeTypeProp( "Revision Date" );
                        CswNbtMetaDataNodeTypeProp DocRevDateNTP = DocNode.NodeType.getNodeTypeProp( "Revision Date" );
                        if( null != RevisionDateNTP && null != DocRevDateNTP )
                        {
                            SDSNode.Node.Properties[RevisionDateNTP].AsDateTime.DateTimeValue = DocNode.Node.Properties[DocRevDateNTP].AsDateTime.DateTimeValue;
                        }
                        SDSNode.postChanges( false );
                        _CswNbtSchemaModTrnsctn.execArbitraryPlatformNeutralSql( @"update jct_nodes_props 
set field1 = (select field1 from jct_nodes_props where nodeid = " + DocNode.NodeId.PrimaryKey + @" and nodetypepropid = " + DocNode.File.NodeTypePropId + @"),
field2 = (select field2 from jct_nodes_props where nodeid = " + DocNode.NodeId.PrimaryKey + @" and nodetypepropid = " + DocNode.File.NodeTypePropId + @"),
blobdata = (select blobdata from jct_nodes_props where nodeid = " + DocNode.NodeId.PrimaryKey + @" and nodetypepropid = " + DocNode.File.NodeTypePropId + @")
where  nodeid = " + SDSNode.NodeId.PrimaryKey + @" and nodetypepropid = " + SDSNode.File.NodeTypePropId );
                        DocNode.Node.delete( false, true );
                    }
                }
            }
        } //Update()
        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()
Ejemplo n.º 30
0
        public void ReadPropertyData(CswNbtNode Node, CswNbtWcfProperty WcfProp)
        {
            CswNbtMetaDataNodeType NodeType    = Node.getNodeType();
            CswNbtNodePropWrapper  propWrapper = null;

            if (false == String.IsNullOrEmpty(WcfProp.OriginalPropName))
            {
                propWrapper = Node.Properties[WcfProp.OriginalPropName];
            }
            else
            {
                CswNbtMetaDataNodeTypeProp ntp = NodeType.getNodeTypeProp(WcfProp.PropName);
                propWrapper = Node.Properties[ntp];
            }

            JObject propData = ConvertWcfPropertyData(WcfProp);

            propWrapper.ReadJSON(propData, null, null);
        }