Exemplo n.º 1
0
        } // getAttributes()

        public static CswNbtView setDefaultView(CswNbtMetaData MetaData, CswNbtObjClassDesignNodeTypeProp DesignNTPNode, CswNbtView View, CswEnumNbtViewRelatedIdType RelatedIdType, Int32 inFKValue, bool OnlyCreateIfNull)
        {
            if (RelatedIdType != CswEnumNbtViewRelatedIdType.Unknown &&
                (null == View ||
                 View.Root.ChildRelationships.Count == 0 ||
                 false == OnlyCreateIfNull))
            {
                if (null != View)
                {
                    View.Root.ChildRelationships.Clear();
                }

                ICswNbtMetaDataDefinitionObject targetObj = MetaData.getDefinitionObject(RelatedIdType, inFKValue);
                if (null != targetObj)
                {
                    CswNbtViewId OldViewId = View.ViewId;
                    View        = targetObj.CreateDefaultView();
                    View.ViewId = OldViewId;
                }
                else
                {
                    throw new CswDniException(CswEnumErrorType.Error, "Cannot create a relationship without a valid target.", "setDefaultView() got an invalid RelatedIdType: " + RelatedIdType + " or value: " + inFKValue);
                }

                View.Visibility = CswEnumNbtViewVisibility.Property;
                View.ViewMode   = CswEnumNbtViewRenderingMode.Tree;
                View.ViewName   = DesignNTPNode.PropName.Text;
                View.save();
            }
            return(View);
        }
        public override void update()
        {
            CswNbtMetaDataObjectClass MethodOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MethodClass );
            if( null != MethodOc )
            {
                CswNbtMetaDataNodeType MethodNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Method" );
                if( null == MethodNt )
                {
                    //Create new NodeType
                    MethodNt = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( MethodOc.ObjectClassId, "Method", "MLM" );
                    _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswNbtModuleName.MLM, MethodNt.NodeTypeId );
                    MethodNt.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassMethod.PropertyName.MethodNo ) );

                    //Create Demo Data
                    CswNbtObjClassMethod MethodNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( MethodNt.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
                    MethodNode.MethodNo.Text = "000001";
                    MethodNode.MethodDescription.Text = "Demo Method";
                    MethodNode.IsDemo = true;
                    MethodNode.postChanges( false );
                }

                CswNbtView MethodView = _CswNbtSchemaModTrnsctn.restoreView( "Methods" );
                if( null == MethodView )
                {
                    //Create new View
                    MethodView = _CswNbtSchemaModTrnsctn.makeNewView( "Methods", NbtViewVisibility.Global );
                    MethodView.Category = "MLM (demo)";
                    MethodView.IsDemo = true;
                    MethodView.ViewMode = NbtViewRenderingMode.Tree;
                    MethodView.AddViewRelationship( MethodOc, true );
                    MethodView.save();
                }
            }
        } //Update()
        public override void update()
        {
            //Create Time Unit view and apply it to every Expiration Interval ObjectClassprop

            //Create the new view
            CswNbtMetaDataNodeType TimeNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Time Unit" );

            //Set ExpirationInterval ObjectClassProp default FKValue to Time Unit NodeType (so that new material NodeTypes will start with this Unit NodeType restriction)
            CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass );
            CswNbtMetaDataObjectClassProp ExpirationInterval = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProp( MaterialOC.ObjectClassId, CswNbtObjClassMaterial.ExpirationIntervalPropertyName );

            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ExpirationInterval, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isfk, true );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ExpirationInterval, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.fktype, NbtViewRelatedIdType.NodeTypeId.ToString() );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ExpirationInterval, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.fkvalue, TimeNT.NodeTypeId );

            //Update existing ExpirationInterval NodeTypeProps to use new Time view
            foreach( CswNbtMetaDataNodeType NodeType in MaterialOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp ExpInt = NodeType.getNodeTypeProp( "Expiration Interval" );
                CswNbtView TimeView = _CswNbtSchemaModTrnsctn.restoreView( ExpInt.ViewId );
                TimeView.Root.ChildRelationships.Clear();
                TimeView.ViewName = "CswNbtNodeTypePropExpirationInterval_" + ExpInt.PropId.ToString();
                TimeView.AddViewRelationship( TimeNT, true );
                TimeView.save();
                ExpInt.SetFK( NbtViewRelatedIdType.NodeTypeId.ToString(), TimeNT.NodeTypeId );
            }

        }//Update()
Exemplo n.º 4
0
        } //Update()

        private void _removeDocumentClassPropAndFilters( CswNbtView DocumentsView, CswNbtMetaDataNodeType MaterialDocumentNT )
        {
            IEnumerable<CswNbtViewRelationship> ChildRelationships = DocumentsView.Root.ChildRelationships[0].ChildRelationships;
            CswNbtMetaDataNodeTypeProp DocumentClassNTP = MaterialDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.DocumentClass );
            foreach( CswNbtViewRelationship Parent in ChildRelationships )
            {
                if( Parent.SecondName.Equals( MaterialDocumentNT.NodeTypeName ) )
                {
                    CswNbtViewProperty PropToDelete = null;
                    foreach( CswNbtViewProperty ViewProp in Parent.Properties )
                    {
                        if( null != ViewProp.Filters && ViewProp.Filters.Count > 0 )
                        {
                            ViewProp.removeFilter( (CswNbtViewPropertyFilter) ViewProp.Filters[0] );
                        }
                        if( ViewProp.NodeTypePropId == DocumentClassNTP.PropId )
                        {
                            PropToDelete = ViewProp; 
                        }  
                    }
                    if( null != PropToDelete )
                    {
                        Parent.removeProperty( PropToDelete );
                    }
                    DocumentsView.save();
                }
            }
        }
Exemplo n.º 5
0
        public override void update()
        {
            // New 'Locations' view

            CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.LocationClass );
            CswNbtMetaDataObjectClassProp LocationLocationOCP = LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.Location );

            Int32 maxDepth = CswConvert.ToInt32( _CswNbtSchemaModTrnsctn.getConfigVariableValue( CswNbtResources.ConfigurationVariables.loc_max_depth.ToString() ) );
            if( maxDepth == Int32.MinValue )
            {
                maxDepth = 5;
            }
            string LocationsViewName = "Locations";
            CswNbtView LocationsView = _CswNbtSchemaModTrnsctn.restoreView( LocationsViewName, NbtViewVisibility.Global );
            if( null == LocationsView )
            {
                LocationsView = _CswNbtSchemaModTrnsctn.makeView();
                LocationsView.saveNew( LocationsViewName, NbtViewVisibility.Global );
                LocationsView.ViewMode = NbtViewRenderingMode.Tree;
            }

            LocationsView.Root.ChildRelationships.Clear();
            CswNbtViewRelationship LocRel1 = LocationsView.AddViewRelationship( LocationOC, true );
            LocationsView.AddViewPropertyAndFilter( LocRel1, LocationLocationOCP,
                                                    Conjunction: CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                                    SubFieldName: CswNbtSubField.SubFieldName.NodeID,
                                                    FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Null );
            CswNbtViewRelationship LocReln = LocRel1;
            for( Int32 i = 2; i <= maxDepth; i++ )
            {
                LocReln = LocationsView.AddViewRelationship( LocReln, NbtViewPropOwnerType.Second, LocationLocationOCP, true );
            }
            LocationsView.save();
        } //Update()
Exemplo n.º 6
0
        public override void update()
        {
            CswNbtMetaDataObjectClass JurisdictionOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.JurisdictionClass );
            if( null != JurisdictionOc )
            {
                CswNbtMetaDataNodeType JurisdictionNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Jurisdiction" );
                if( null == JurisdictionNt )
                {
                    //Create new NodeType
                    JurisdictionNt = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( JurisdictionOc.ObjectClassId, "Jurisdiction", "MLM" );
                    _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswNbtModuleName.CISPro, JurisdictionNt.NodeTypeId );
                    JurisdictionNt.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassJurisdiction.PropertyName.Name ) );

                    //Create Demo Data
                    CswNbtObjClassJurisdiction JurisdictionNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( JurisdictionNt.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
                    JurisdictionNode.Name.Text = "Default Jurisdiction";
                    JurisdictionNode.IsDemo = true;
                    JurisdictionNode.postChanges( false );
                }

                CswNbtView JurisdictionView = _CswNbtSchemaModTrnsctn.restoreView( "Jurisdictions" );
                if( null == JurisdictionView )
                {
                    //Create demo View
                    JurisdictionView = _CswNbtSchemaModTrnsctn.makeNewView( "Jurisdictions", NbtViewVisibility.Global );
                    JurisdictionView.Category = "MLM (demo)";
                    JurisdictionView.IsDemo = true;
                    JurisdictionView.ViewMode = NbtViewRenderingMode.Tree;
                    JurisdictionView.AddViewRelationship( JurisdictionOc, true );
                    JurisdictionView.save();
                }
            }
        } //Update()
        private void _createMyContainersView()
        {
            CswNbtView MyContainersView = _CswNbtSchemaModTrnsctn.restoreView( "My Containers" ) ??
                                          _CswNbtSchemaModTrnsctn.makeNewView( "My Containers", NbtViewVisibility.Global );
            MyContainersView.ViewMode = NbtViewRenderingMode.Grid;
            MyContainersView.Category = "Containers";
            MyContainersView.Root.ChildRelationships.Clear();

            CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.ContainerClass );
            CswNbtViewRelationship ContainerRel = MyContainersView.AddViewRelationship( ContainerOC, false );

            CswNbtViewProperty BarcodeVP = MyContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Barcode ) );
            BarcodeVP.Order = 1;
            CswNbtViewProperty StatusVP = MyContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Status ) );
            StatusVP.Order = 2;
            CswNbtViewProperty QuantityVP = MyContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Quantity ) );
            QuantityVP.Order = 3;
            CswNbtViewProperty LocationVP = MyContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Location ) );
            LocationVP.Order = 4;
            CswNbtViewProperty DisposedVP = MyContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Disposed ) );
            DisposedVP.Order = 5;
            MyContainersView.AddViewPropertyFilter( DisposedVP,
                                          CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                          CswNbtPropFilterSql.FilterResultMode.Hide,
                                          CswNbtSubField.SubFieldName.Checked,
                                          CswNbtPropFilterSql.PropertyFilterMode.Equals,
                                          "false" );
            CswNbtViewProperty OwnerVP = MyContainersView.AddViewProperty( ContainerRel, ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Owner ) );
            OwnerVP.Order = 6;
            OwnerVP.ShowInGrid = false;
            MyContainersView.AddViewPropertyFilter( OwnerVP, FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals, Value: "me" );
            MyContainersView.save();
        }
Exemplo n.º 8
0
        public override void update()
        {
            CswNbtView DueInspectionsAllView = _CswNbtSchemaModTrnsctn.restoreView( "Due Inspections (all)" );
            if( null != DueInspectionsAllView )
            {
                // Set the view name
                DueInspectionsAllView.ViewName = "Due Inspections";

                // Show the due date filter at runtime
                CswNbtMetaDataObjectClass InspectionDesignOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.InspectionDesignClass );
                CswNbtMetaDataObjectClassProp DueDateOCP = InspectionDesignOC.getObjectClassProp( CswNbtObjClassInspectionDesign.PropertyName.DueDate );

                foreach( CswNbtViewRelationship ViewRelationship in DueInspectionsAllView.Root.ChildRelationships )
                {
                    foreach( CswNbtViewProperty ViewProperty in ViewRelationship.Properties )
                    {
                        if( ViewProperty.ObjectClassPropId == DueDateOCP.ObjectClassPropId )
                        {
                            foreach( CswNbtViewPropertyFilter ViewPropertyFilter in ViewProperty.Filters )
                            {
                                if( ViewPropertyFilter.Value == "today+7" )
                                {
                                    ViewPropertyFilter.ShowAtRuntime = CswConvert.ToBoolean( CswEnumTristate.True );
                                    break;
                                }
                            }
                        }
                    }
                }

                DueInspectionsAllView.save();
            }


        } // update()
        public override void update()
        {
            CswNbtMetaDataObjectClass UnitOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.UnitOfMeasureClass );
            IEnumerable<CswNbtMetaDataObjectClassProp> OCPropsToUpdate = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProps( CswNbtMetaDataFieldType.NbtFieldType.Quantity );

            foreach( CswNbtMetaDataObjectClassProp QuantityProp in OCPropsToUpdate )
            {
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuantityProp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isfk, true );
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuantityProp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.fktype, NbtViewRelatedIdType.ObjectClassId.ToString() );
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuantityProp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.fkvalue, UnitOC.ObjectClassId );
            }

            IEnumerable<CswNbtMetaDataNodeTypeProp> NTPropsToUpdate = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProps( CswNbtMetaDataFieldType.NbtFieldType.Quantity );

            foreach( CswNbtMetaDataNodeTypeProp NodeTypeProp in NTPropsToUpdate )
            {
                CswNbtViewId NewViewId = NodeTypeProp.ViewId;
                CswNbtView UnitView = _CswNbtSchemaModTrnsctn.restoreView( NewViewId );
                UnitView.Root.ChildRelationships.Clear();
                UnitView.ViewName = "CswNbtNodeTypePropQuantity_" + NodeTypeProp.NodeTypeId.ToString();
                UnitView.AddViewRelationship( UnitOC, true );
                UnitView.save();

                NodeTypeProp.ViewId = UnitView.ViewId;
                NodeTypeProp.SetFK( NbtViewRelatedIdType.ObjectClassId.ToString(), UnitOC.ObjectClassId );
            }

        }//Update()
Exemplo n.º 10
0
        public override void update()
        {
            CswNbtMetaDataObjectClass receiptLotOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.ReceiptLotClass );

            CswNbtMetaDataNodeType receiptLotNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Receipt Lot" );
            if( null == receiptLotNT )
            {
                receiptLotNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( receiptLotOC.ObjectClassId, "Receipt Lot", "MLM" );

                /* Name template text should be Receipt Lot No - waiting on 27877 */

            }

            //create receipt lots view
            CswNbtView receiptLotsView = _CswNbtSchemaModTrnsctn.restoreView( "Receipt Lots" );
            if( null == receiptLotsView )
            {
                receiptLotsView = _CswNbtSchemaModTrnsctn.makeNewView( "Receipt Lots", NbtViewVisibility.Global );
                receiptLotsView.Category = "MLM (demo)";
                receiptLotsView.ViewMode = NbtViewRenderingMode.Tree;
                receiptLotsView.AddViewRelationship( receiptLotOC, true );
                receiptLotsView.IsDemo = false;
                receiptLotsView.save();
            }

        }
        public override void update()
        {
            // Create a view that the impersonation nodeselect uses
            CswNbtView ImpersonationView = _CswNbtSchemaModTrnsctn.makeNewView( "Impersonation NodeSelect View", CswEnumNbtViewVisibility.Hidden );
            ImpersonationView.IsSystem = true;

            CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.UserClass );
            CswNbtMetaDataObjectClassProp UsernameOCP = UserOC.getObjectClassProp( CswNbtObjClassUser.PropertyName.Username );
            CswNbtMetaDataObjectClassProp RoleOCP = UserOC.getObjectClassProp( CswNbtObjClassUser.PropertyName.Role );
            CswNbtViewRelationship Parent = ImpersonationView.AddViewRelationship( UserOC, true );
            ImpersonationView.AddViewPropertyAndFilter(
                ParentViewRelationship: Parent,
                MetaDataProp: UsernameOCP,
                Conjunction: CswEnumNbtFilterConjunction.And,
                Value: CswNbtObjClassUser.ChemSWAdminUsername,
                FilterMode: CswEnumNbtFilterMode.NotEquals
                );
            ImpersonationView.AddViewPropertyAndFilter(
                ParentViewRelationship: Parent,
                MetaDataProp: RoleOCP,
                Conjunction: CswEnumNbtFilterConjunction.And,
                Value: CswNbtObjClassRole.ChemSWAdminRoleName,
                FilterMode: CswEnumNbtFilterMode.NotEquals,
                SubFieldName: CswEnumNbtSubFieldName.Name
                );
            ImpersonationView.save();
        } // update()
Exemplo n.º 12
0
        public override void update()
        {

            //Get all views with a category of "Lab Safety" and add '(demo)' to 'viewname' and 'category'
            CswTableSelect nodeViewsTS = _CswNbtSchemaModTrnsctn.makeCswTableSelect( "select_by_category_26772", "node_views" );
            DataTable nodeViews = nodeViewsTS.getTable( "where category = 'Lab Safety'" );
            foreach( DataRow row in nodeViews.Rows )
            {
                CswNbtView curView = _CswNbtSchemaModTrnsctn.restoreView( row["viewname"].ToString() );
                if( null != curView ) //paranoid
                {
                    curView.ViewName += " (demo)";
                    curView.Category += " (demo)";
                    curView.save();
                }
            }

            //get all nodetypes with a category of 'Labe Safety' and add '(demo)' to 'category' and 'nodetypename'
            CswTableUpdate nodetypeTU = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "select_nt_category_26772", "nodetypes" );
            DataTable nodeTypes = nodetypeTU.getTable( "where category = 'Lab Safety'" );
            foreach( DataRow row in nodeTypes.Rows )
            {
                row["nodetypename"] += " (demo)";
                row["category"] += " (demo)";
            }
            nodetypeTU.update( nodeTypes );

        }//Update()
        /// <summary>
        /// Update logic
        /// </summary>
        public override void update()
        {
            // Set the Request Item's Size Relationship View
            CswNbtMetaDataObjectClass RequestItemOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestItemClass );
            CswNbtMetaDataObjectClass SizeOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.SizeClass );
            CswNbtMetaDataObjectClassProp RequestItemMaterialOCP = RequestItemOC.getObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Material );
            CswNbtMetaDataObjectClassProp SizeMaterialOCP = SizeOC.getObjectClassProp( CswNbtObjClassSize.PropertyName.Material );

            foreach( CswNbtMetaDataNodeType RequestItemNT in RequestItemOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp RequestItemSizeNTP = RequestItemNT.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Size );

                CswNbtView SizeView = _CswNbtSchemaModTrnsctn.restoreView( RequestItemSizeNTP.ViewId );
                SizeView.Root.ChildRelationships.Clear();

                CswNbtViewRelationship RequestItemViewRel = SizeView.AddViewRelationship( RequestItemOC, false );
                CswNbtViewRelationship MaterialViewRel = SizeView.AddViewRelationship( RequestItemViewRel, NbtViewPropOwnerType.First, RequestItemMaterialOCP, true );
                CswNbtViewRelationship SizeViewRel = SizeView.AddViewRelationship( MaterialViewRel, NbtViewPropOwnerType.Second, SizeMaterialOCP, true );

                //Case 27438 
                CswNbtMetaDataObjectClass SizeOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.SizeClass );
                CswNbtMetaDataNodeType SizeNt = SizeOc.FirstNodeType;
                CswNbtMetaDataNodeTypeProp DispensableNtp = SizeNt.getNodeTypePropByObjectClassProp( CswNbtObjClassSize.PropertyName.Dispensable );
                SizeView.AddViewPropertyAndFilter(
                        ParentViewRelationship: SizeViewRel,
                        MetaDataProp: DispensableNtp,
                        Value: Tristate.False.ToString(),
                        SubFieldName: CswNbtSubField.SubFieldName.Checked,
                        FilterMode: CswNbtPropFilterSql.PropertyFilterMode.NotEquals
                        );

                SizeView.save();
            }

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

            CswNbtMetaDataObjectClass materialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass );
            foreach( CswNbtMetaDataNodeType materialNT in materialOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp documentNTP = materialNT.getNodeTypeProp( "Documents" );
                if( null != documentNTP )
                {
                    CswNbtView documentsPropView = _CswNbtSchemaModTrnsctn.restoreView( documentNTP.ViewId );
                    foreach( CswNbtViewProperty viewProp in documentsPropView.getOrderedViewProps( true ) )
                    {
                        if( viewProp.Name.Equals( CswNbtObjClassDocument.PropertyName.Archived ) )
                        {
                            documentsPropView.AddViewPropertyFilter( viewProp,
                                Conjunction: CswNbtPropFilterSql.PropertyFilterConjunction.Or,
                                SubFieldName: CswNbtSubField.SubFieldName.Checked,
                                FilterMode: CswNbtPropFilterSql.PropertyFilterMode.Equals,
                                Value: CswConvert.ToDbVal( true ).ToString()
                            );
                        }
                    }
                    documentsPropView.save();

                } // if( null != documentNTP )
            } //foreach( CswNbtMetaDataNodeType materialNT in materialOC.getNodeTypes() )

        } //Update()
        public override void update()
        {
            // Create the view
            CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet );

            CswNbtMetaDataObjectClass ManufacturerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ManufacturerClass );
            CswNbtMetaDataObjectClassProp MaterialOCP = ManufacturerOC.getObjectClassProp( CswNbtObjClassManufacturer.PropertyName.Material );
            CswNbtMetaDataObjectClassProp ManufacturingSiteOCP = ManufacturerOC.getObjectClassProp( CswNbtObjClassManufacturer.PropertyName.ManufacturingSite );
            CswNbtMetaDataObjectClassProp QualifiedOCP = ManufacturerOC.getObjectClassProp( CswNbtObjClassManufacturer.PropertyName.Qualified );

            CswNbtView ManufacturersView = _CswNbtSchemaModTrnsctn.makeSafeView( "ManufacturingSites", CswEnumNbtViewVisibility.Property );
            ManufacturersView.ViewName = "ManufacturingSites";
            ManufacturersView.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            ManufacturersView.Root.ChildRelationships.Clear();

            CswNbtViewRelationship root = ManufacturersView.AddViewRelationship( MaterialPS, false );
            CswNbtViewRelationship relationship = ManufacturersView.AddViewRelationship( root, CswEnumNbtViewPropOwnerType.Second, MaterialOCP, true );

            ManufacturersView.AddViewProperty( relationship, ManufacturingSiteOCP );
            ManufacturersView.AddViewProperty( relationship, QualifiedOCP );

            ManufacturersView.save();

            foreach( CswNbtMetaDataObjectClass MaterialOC in MaterialPS.getObjectClasses() )
            {
                CswNbtMetaDataObjectClassProp GridOCP = MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.ManufacturingSites );
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( GridOCP, CswEnumNbtObjectClassPropAttributes.viewxml, ManufacturersView.ToString() );
            }

        } // update()
Exemplo n.º 16
0
        } // OnDisable()

        private void _toggleMaterialSupplierView(bool MLMDisabled)
        {
            CswNbtMetaDataObjectClass vendorOC    = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.VendorClass);
            CswNbtMetaDataPropertySet MaterialSet = _CswNbtResources.MetaData.getPropertySet(CswEnumNbtPropertySetName.MaterialSet);

            foreach (CswNbtMetaDataObjectClass materialOC in MaterialSet.getObjectClasses())
            {
                foreach (CswNbtMetaDataNodeType materialNT in _CswNbtResources.MetaData.getNodeTypes(materialOC.ObjectClassId))
                {
                    CswNbtMetaDataNodeTypeProp supplierNTP = materialNT.getNodeTypePropByObjectClassProp(CswNbtObjClassChemical.PropertyName.Supplier);
                    CswNbtView supplierView = _CswNbtResources.ViewSelect.restoreView(supplierNTP.ViewId);
                    supplierView.Clear();
                    CswNbtViewRelationship parent = supplierView.AddViewRelationship(vendorOC, true);
                    if (false == MLMDisabled)
                    {
                        CswNbtMetaDataObjectClassProp vendorTypeOCP = vendorOC.getObjectClassProp(CswNbtObjClassVendor.PropertyName.VendorTypeName);
                        supplierView.AddViewPropertyAndFilter(parent,
                                                              MetaDataProp: vendorTypeOCP,
                                                              Value: CswNbtObjClassVendor.VendorTypes.Corporate,
                                                              FilterMode: CswEnumNbtFilterMode.Equals);
                    }
                    supplierView.Visibility = CswEnumNbtViewVisibility.Property;
                    supplierView.ViewName   = "Supplier";
                    supplierView.save();
                }
            }
        }
Exemplo n.º 17
0
        private void _updateMissingHazardClassesView()
        {
            CswNbtView MHCView = _CswNbtSchemaModTrnsctn.restoreView( "Missing Hazard Classes" );
            if( null == MHCView )
            {
                MHCView = _CswNbtSchemaModTrnsctn.makeNewView( "Missing Hazard Classes", CswEnumNbtViewVisibility.Global );
                MHCView.ViewMode = CswEnumNbtViewRenderingMode.Tree;
                MHCView.Category = "Materials";
            }
            else
            {
                MHCView.Root.ChildRelationships.Clear();
            }

            CswNbtViewRelationship RootRel = MHCView.AddViewRelationship( ChemicalOC, true );

            CswNbtMetaDataObjectClassProp SpecialFlagsOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.SpecialFlags );
            CswNbtViewProperty SpecialFlagsVP = MHCView.AddViewProperty( RootRel, SpecialFlagsOCP );
            MHCView.AddViewPropertyFilter( SpecialFlagsVP,
                                            CswEnumNbtFilterConjunction.And,
                                            CswEnumNbtFilterResultMode.Hide,
                                            CswEnumNbtSubFieldName.Value,
                                            CswEnumNbtFilterMode.NotContains,
                                            "Not Reportable" );

            CswNbtMetaDataObjectClassProp HazardClassesOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.HazardClasses );
            CswNbtViewProperty HazardClassesVP = MHCView.AddViewProperty( RootRel, HazardClassesOCP );
            MHCView.AddViewPropertyFilter( HazardClassesVP,
                                            CswEnumNbtFilterConjunction.And,
                                            CswEnumNbtFilterResultMode.Hide,
                                            CswEnumNbtSubFieldName.Value,
                                            CswEnumNbtFilterMode.Null );
            MHCView.save();
        }
Exemplo n.º 18
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();
            }
        }
Exemplo n.º 19
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();
                }
            }
        }
 private void _markViewAsDemoData( string ViewName )
 {
     CswNbtView View = _CswNbtSchemaModTrnsctn.restoreView( ViewName );
     if( null != View )
     {
         View.IsDemo = true;
         View.save();
     }
 }
Exemplo n.º 21
0
        public void OnReportViewChange(CswNbtNodeProp Prop, bool Creating)
        {
            // case 28844 - Change view visibility from 'Property' to 'Hidden', so grids will run correctly
            // This will only trigger when the viewid is first set.
            CswNbtView View = _CswNbtResources.ViewSelect.restoreView(ReportView.ViewId);

            View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null);
            View.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            View.save();
        } // OnReportViewChange()