public override void update() { /* Receive wizard property order: Owner, Location, Label Format, Expiration Date */ CswNbtMetaDataNodeType ContainerNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Container" ); if( null != ContainerNT ) { CswNbtMetaDataNodeTypeProp LocationNTP = ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.Location ); CswNbtMetaDataNodeTypeProp OwnerNTP = ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.Owner ); CswNbtMetaDataNodeTypeProp ExpirationDateNTP = ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.ExpirationDate ); CswNbtMetaDataNodeTypeProp LabelFormat = ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.LabelFormat ); if( null != OwnerNTP ) { OwnerNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, Int32.MinValue, 7, 1 ); } if( null != LocationNTP ) { LocationNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, Int32.MinValue, 8, 1 ); } if( null != LabelFormat ) { LabelFormat.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, Int32.MinValue, 9, 1 ); } if( null != ExpirationDateNTP ) { ExpirationDateNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, Int32.MinValue, 15, 1 ); } } } //Update()
public override void update() { CswNbtMetaDataObjectClass CertDefSpecOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.CertDefSpecClass); CswNbtMetaDataNodeType CertDefSpecDefaultNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType(new CswNbtWcfMetaDataModel.NodeType(CertDefSpecOC) { Category = "MLM", ObjectClass = CertDefSpecOC, ObjectClassId = CertDefSpecOC.ObjectClassId, NodeTypeName = "CertDef Spec", Searchable = true, NameTemplate = CswNbtMetaData.MakeTemplateEntry(CswNbtObjClassCertDefSpec.PropertyName.NameForTestingConditions) }); CswNbtMetaDataNodeTypeTab ConditionsTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab(CertDefSpecDefaultNT, "Conditions", 2); CswNbtMetaDataNodeTypeTab CharacteristicsTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab(CertDefSpecDefaultNT, "Characteristics", 3); CswNbtMetaDataNodeTypeProp ConditionsNTP = CertDefSpecDefaultNT.getNodeTypePropByObjectClassProp(CswNbtObjClassCertDefSpec.PropertyName.Conditions); ConditionsNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, ConditionsTab.TabId, 1, 1); CswNbtMetaDataNodeTypeProp CharacteristicsNTP = CertDefSpecDefaultNT.getNodeTypePropByObjectClassProp(CswNbtObjClassCertDefSpec.PropertyName.Characteristics); CharacteristicsNTP.updateLayout(CswEnumNbtLayoutType.Edit, true, CharacteristicsTab.TabId, 1, 1); }
public override void update() { CswNbtMetaDataObjectClass DocumentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.DocumentClass ); CswNbtMetaDataNodeType SDSNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( DocumentOC ) { NodeTypeName = "SDS Document", Category = "Materials" } ); CswNbtMetaDataNodeTypeProp TradeNameNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner ); CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" ); if( null != ChemicalNT ) { TradeNameNTP.SetFK( NbtViewRelatedIdType.NodeTypeId.ToString(), ChemicalNT.NodeTypeId ); } TradeNameNTP.PropName = "Tradename"; CswNbtMetaDataNodeTypeProp RevisionDateNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( SDSNT, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.DateTime ), "Revision Date" ) ); CswNbtMetaDataNodeTypeProp LanguageNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Language ); LanguageNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, SDSNT.getFirstNodeTypeTab().TabId ); CswNbtMetaDataNodeTypeProp FormatNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Format ); FormatNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, true, SDSNT.getFirstNodeTypeTab().TabId ); SDSNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassDocument.PropertyName.Title ) ); foreach( CswNbtMetaDataNodeType DocNT in DocumentOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp DocClassNTP = DocNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.DocumentClass ); DocClassNTP.removeFromAllLayouts(); } } //Update()
public override void update() { CswNbtMetaDataNodeType ContainerNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Container" ); if( null != ContainerNT ) { CswNbtMetaDataNodeTypeTab FireCodeTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ContainerNT, "Fire Code" ); CswNbtMetaDataNodeTypeProp StoragePressureNTP = ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.StoragePressure ); CswNbtMetaDataNodeTypeProp StorageTemperatureNTP = ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.StorageTemperature ); CswNbtMetaDataNodeTypeProp UseTypeNTP = ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.UseType ); StoragePressureNTP.removeFromAllLayouts(); StorageTemperatureNTP.removeFromAllLayouts(); UseTypeNTP.removeFromAllLayouts(); StoragePressureNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, FireCodeTab.TabId, 1, 1 ); StorageTemperatureNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, FireCodeTab.TabId, 2, 1 ); UseTypeNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, FireCodeTab.TabId, 3, 1 ); foreach( CswNbtMetaDataNodeTypeTab Tab in ContainerNT.getNodeTypeTabs() ) { if( Tab.TabOrder >= 4 ) Tab.TabOrder += 1; } CswNbtMetaDataNodeTypeTab DispensesTab = ContainerNT.getNodeTypeTab( "Dispenses" ); if( null == DispensesTab ) { DispensesTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ContainerNT, "Dispenses", 4 ); } CswNbtMetaDataNodeTypeProp DispenseNTP = ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.Dispense ); DispenseNTP.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Edit, true, DispensesTab.TabId, 1, 1 ); } } //Update()
private void _createNewSDSDocNT() { CswEnumNbtNodeTypePermission[] NTPermissions = { CswEnumNbtNodeTypePermission.View, CswEnumNbtNodeTypePermission.Create, CswEnumNbtNodeTypePermission.Edit, CswEnumNbtNodeTypePermission.Delete }; //New Document NT CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass ); CswNbtMetaDataObjectClass DocumentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.SDSDocumentClass ); CswNbtMetaDataNodeType SDSNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( DocumentOC.ObjectClassId, "SDS Document", "Materials" ); _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswEnumNbtModuleName.SDS, SDSNT.NodeTypeId ); //Default Title CswNbtMetaDataNodeTypeProp TitleNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Title ); TitleNTP.DefaultValue.AsText.Text = "Safety Data Sheet"; TitleNTP.removeFromLayout( CswEnumNbtLayoutType.Add ); //Set Owner FK to Material OC (This needs to be done explicitly for the NTP - see Case 26605) CswNbtMetaDataNodeTypeProp OwnerNTP = SDSNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner ); OwnerNTP.PropName = "Material"; OwnerNTP.SetFK( CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), ChemicalOC.ObjectClassId ); //NT Permission CswNbtObjClassRole RoleNode = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Admin" ); if( null != RoleNode ) { _CswNbtSchemaModTrnsctn.Permit.set( NTPermissions, SDSNT, RoleNode, true ); } }
} // GeneratedNodeCount public CswNbtView GetGeneratedTargetsView( DateTime TargetDay ) { CswNbtView View = new CswNbtView( _CswNbtResources ); View.ViewName = "Generated Node Count"; CswNbtMetaDataNodeType TargetNT = _CswNbtResources.MetaData.getNodeType( CswConvert.ToInt32( TargetType.SelectedNodeTypeIds[0] ) ); CswNbtMetaDataNodeTypeProp GeneratorNTP = TargetNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetGeneratorTarget.PropertyName.Generator ); CswNbtMetaDataNodeTypeProp CreatedDateNTP = TargetNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetGeneratorTarget.PropertyName.CreatedDate ); CswNbtViewRelationship TargetRel = View.AddViewRelationship( TargetNT, false ); View.AddViewPropertyAndFilter( TargetRel, GeneratorNTP, Conjunction: CswEnumNbtFilterConjunction.And, ResultMode: CswEnumNbtFilterResultMode.Hide, Value: this.NodeId.PrimaryKey.ToString(), SubFieldName: ( (CswNbtFieldTypeRuleRelationship) GeneratorNTP.getFieldTypeRule() ).NodeIDSubField.Name, FilterMode: CswEnumNbtFilterMode.Equals ); if( DateTime.MinValue != TargetDay ) { View.AddViewPropertyAndFilter( TargetRel, CreatedDateNTP, Conjunction: CswEnumNbtFilterConjunction.And, ResultMode: CswEnumNbtFilterResultMode.Hide, Value: TargetDay.Date.ToString(), FilterMode: CswEnumNbtFilterMode.Equals ); } return View; }
public override void update() { //New Document NT CswNbtMetaDataObjectClass ReceiptLotOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ReceiptLotClass ); CswNbtMetaDataObjectClass CofADocOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.CofADocumentClass ); CswNbtMetaDataNodeType CofANT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "C of A Document" ) ?? _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeTypeDeprecated( CofADocOC.ObjectClassId, "C of A Document", "Materials" ); _CswNbtSchemaModTrnsctn.createModuleNodeTypeJunction( CswEnumNbtModuleName.CofA, CofANT.NodeTypeId ); //Default Title CswNbtMetaDataNodeTypeProp TitleNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Title ); TitleNTP.DefaultValue.AsText.Text = "Certificate of Analysis"; TitleNTP.removeFromLayout( CswEnumNbtLayoutType.Add ); //Set Owner FK to ReceiptLot OC (This needs to be done explicitly for the NTP - see Case 26605) CswNbtMetaDataNodeTypeProp OwnerNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner ); OwnerNTP.PropName = "Receipt Lot"; OwnerNTP.SetFK( CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), ReceiptLotOC.ObjectClassId ); //Set Prop Filters (This needs to be done explicitly for the NTP - see Case 26605) CswNbtMetaDataNodeTypeProp FileTypeNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.FileType ); CswNbtMetaDataNodeTypeProp FileNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.File ); FileNTP.setFilter( FileTypeNTP, FileTypeNTP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswNbtPropertySetDocument.CswEnumDocumentFileTypes.File ); CswNbtMetaDataNodeTypeProp LinkNTP = CofANT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Link ); LinkNTP.setFilter( FileTypeNTP, FileTypeNTP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswNbtPropertySetDocument.CswEnumDocumentFileTypes.Link ); //NT Permission CswNbtObjClassRole RoleNode = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Admin" ); if( null != RoleNode ) { _CswNbtSchemaModTrnsctn.Permit.set( NTPermissions, CofANT, RoleNode, true ); } } // update()
private CswNbtNode _getTargetNodeForGenerator(CswNbtNode CswNbtNodeGenerator, CswPrimaryKey ParentPk, string TargetDateFilter) { CswNbtNode ReturnVal = null; CswNbtObjClassGenerator GeneratorNode = (CswNbtObjClassGenerator)CswNbtNodeGenerator; if (String.IsNullOrEmpty(GeneratorNode.TargetType.SelectedNodeTypeIds.ToString())) { throw new CswDniException(CswEnumErrorType.Error, "Invalid generator configuration", "_getTargetNodeForGenerator got a null SelectedNodeTypeIds on nodeid " + GeneratorNode.NodeId); } else { Int32 NodeTypeId = CswConvert.ToInt32(GeneratorNode.TargetType.SelectedNodeTypeIds[0]); // case 28612 - just check the first one if (Int32.MinValue != NodeTypeId) { CswNbtMetaDataNodeType ThisCreatedNodeType = _CswNbtResources.MetaData.getNodeType(NodeTypeId); if (null != ThisCreatedNodeType) { CswNbtMetaDataNodeType CreatedNodeType = ThisCreatedNodeType.getNodeTypeLatestVersion(); CswNbtMetaDataObjectClass CreatedMetaDataObjectClass = CreatedNodeType.getObjectClass(); CswNbtObjClass CreatedObjClass = CswNbtObjClassFactory.makeObjClass(_CswNbtResources, CreatedMetaDataObjectClass); if (!(CreatedObjClass is CswNbtPropertySetGeneratorTarget)) { throw new CswDniException("CswNbtActGenerateNodes got an invalid object class: " + CreatedObjClass.ObjectClass.ToString()); } CswNbtPropertySetGeneratorTarget GeneratorTarget = (CswNbtPropertySetGeneratorTarget)CreatedObjClass; // CreatedForNTP is the parent or owner of the new node. Inspections created for Inspection Targets, Tasks for Equipment, etc. CswNbtMetaDataNodeTypeProp CreatedForNTP = CreatedNodeType.getNodeTypePropByObjectClassProp(GeneratorTarget.ParentPropertyName); CswNbtMetaDataNodeTypeProp GeneratorNTP = CreatedNodeType.getNodeTypePropByObjectClassProp(CswNbtPropertySetGeneratorTarget.PropertyName.Generator); CswNbtMetaDataNodeTypeProp DueDateNTP = CreatedNodeType.getNodeTypePropByObjectClassProp(CswNbtPropertySetGeneratorTarget.PropertyName.DueDate); CswNbtView CswNbtView = new CswNbtView(_CswNbtResources); CswNbtView.ViewName = "Nodes for Generator"; CswNbtViewRelationship RootRelationship = CswNbtView.AddViewRelationship(CreatedNodeType, false); CswNbtViewProperty CreatedForParentProp = CswNbtView.AddViewProperty(RootRelationship, CreatedForNTP); CswNbtView.AddViewPropertyFilter(CreatedForParentProp, CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID, CswEnumNbtFilterMode.Equals, ParentPk.PrimaryKey.ToString(), false); CswNbtViewProperty GeneratorProp = CswNbtView.AddViewProperty(RootRelationship, GeneratorNTP); CswNbtView.AddViewPropertyFilter(GeneratorProp, CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID, CswEnumNbtFilterMode.Equals, CswNbtNodeGenerator.NodeId.PrimaryKey.ToString(), false); CswNbtViewProperty DueDateProp = CswNbtView.AddViewProperty(RootRelationship, DueDateNTP); //Case 24572 CswNbtView.AddViewPropertyFilter(DueDateProp, CswNbtFieldTypeRuleDateTime.SubFieldName.Value, CswEnumNbtFilterMode.Equals, TargetDateFilter, false); ICswNbtTree ExistingNodesTree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, CswNbtView, true, false, false); if (ExistingNodesTree.getChildNodeCount() > 0) { ExistingNodesTree.goToNthChild(0); ReturnVal = ExistingNodesTree.getNodeForCurrentPosition(); } } } } return(ReturnVal); }//_getTargetNodeForGenerator
private void _setPermissionPropFilters( CswNbtMetaDataNodeType PermissionNT ) { CswNbtMetaDataNodeTypeProp ApplyToAllWorkUnitsNTP = PermissionNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetPermission.PropertyName.ApplyToAllWorkUnits ); CswNbtMetaDataNodeTypeProp WorkUnitNTP = PermissionNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetPermission.PropertyName.WorkUnit ); WorkUnitNTP.setFilter( ApplyToAllWorkUnitsNTP, ApplyToAllWorkUnitsNTP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswEnumTristate.False ); CswNbtMetaDataNodeTypeProp ApplyToAllRolesNTP = PermissionNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetPermission.PropertyName.ApplyToAllRoles ); CswNbtMetaDataNodeTypeProp RoleNTP = PermissionNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetPermission.PropertyName.Role ); RoleNTP.setFilter( ApplyToAllRolesNTP, ApplyToAllRolesNTP.getFieldTypeRule().SubFields.Default, CswEnumNbtFilterMode.Equals, CswEnumTristate.False ); }
public override void update() { CswNbtMetaDataObjectClass mepOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.ManufacturerEquivalentPartClass ); //create the MEP NT CswNbtMetaDataNodeType mepNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Manufacturing Equivalent Part" ); if( null == mepNT ) { mepNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( mepOC.ObjectClassId, "Manufacturing Equivalent Part", "MLM" ); string mepNameTemplate = CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassManufacturerEquivalentPart.PropertyName.Manufacturer ); mepNameTemplate += CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassManufacturerEquivalentPart.PropertyName.EnterprisePart ); mepNameTemplate += CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassManufacturerEquivalentPart.PropertyName.Material ); mepNT.setNameTemplateText( mepNameTemplate ); CswNbtMetaDataNodeTypeProp materialNTP = mepNT.getNodeTypePropByObjectClassProp( CswNbtObjClassManufacturerEquivalentPart.PropertyName.Material ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, mepNT.NodeTypeId, materialNTP.PropId, true ); CswNbtMetaDataNodeTypeProp epNTP = mepNT.getNodeTypePropByObjectClassProp( CswNbtObjClassManufacturerEquivalentPart.PropertyName.EnterprisePart ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, mepNT.NodeTypeId, epNTP.PropId, true ); CswNbtMetaDataNodeTypeProp manufactufacturerNTP = mepNT.getNodeTypePropByObjectClassProp( CswNbtObjClassManufacturerEquivalentPart.PropertyName.Manufacturer ); _CswNbtSchemaModTrnsctn.MetaData.NodeTypeLayout.updatePropLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add, mepNT.NodeTypeId, manufactufacturerNTP.PropId, true ); //create demo MEP node CswNbtObjClassManufacturerEquivalentPart mepNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( mepNT.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode ); //get the default EP node and set it o the demo MEP nodes EP prop CswNbtMetaDataNodeType epNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Enterprise Part" ); if( null != epNT ) { foreach( CswNbtObjClassEnterprisePart epNode in epNT.getNodes( false, false ) ) { if( epNode.GCAS.Text.Equals( "EP123" ) ) //the default EP node had its GCAS set to this in CswUpdateSchema_01T_Case27865_part1 { mepNode.EnterprisePart.RelatedNodeId = epNode.NodeId; } } } mepNode.IsDemo = true; mepNode.postChanges( false ); } //create the MEPs view CswNbtView mepsView = _CswNbtSchemaModTrnsctn.restoreView( "Manufacturing Equivalent Parts" ); if( null == mepsView ) { mepsView = _CswNbtSchemaModTrnsctn.makeNewView( "Manufacturing Equivalent Parts", NbtViewVisibility.Global ); mepsView.Category = "MLM (demo)"; mepsView.ViewMode = NbtViewRenderingMode.Tree; mepsView.AddViewRelationship( mepOC, true ); mepsView.IsDemo = true; mepsView.save(); } }
private void _deleteFutureNodes() { // BZ 6754 - Delete all future nodes CswNbtMetaDataObjectClass GeneratorObjectClass = ObjectClass; if( TargetType.SelectedNodeTypeIds.Count == 1 ) { Int32 SelectedTargetNtId = CswConvert.ToInt32( TargetType.SelectedNodeTypeIds[0] ); if( Int32.MinValue != SelectedTargetNtId ) { CswNbtMetaDataNodeType TargetNodeType = _CswNbtResources.MetaData.getNodeType( SelectedTargetNtId ); if( null != TargetNodeType ) { CswNbtMetaDataObjectClass TargetObjectClass = TargetNodeType.getObjectClass(); CswNbtObjClass TargetObjClass = CswNbtObjClassFactory.makeObjClass( _CswNbtResources, TargetObjectClass ); if( !( TargetObjClass is CswNbtPropertySetGeneratorTarget ) ) { throw new CswDniException( "CswNbtObjClassGenerator.beforeDeleteNode() got an invalid object class: " + TargetObjectClass.ObjectClass ); } CswNbtMetaDataNodeTypeProp GeneratorProp = TargetNodeType.getNodeTypePropByObjectClassProp( CswNbtPropertySetGeneratorTarget.PropertyName.Generator ); CswNbtMetaDataNodeTypeProp IsFutureProp = TargetNodeType.getNodeTypePropByObjectClassProp( CswNbtPropertySetGeneratorTarget.PropertyName.IsFuture ); CswNbtView View = new CswNbtView( _CswNbtResources ); View.ViewName = "CswNbtObjClassSchedule.beforeDeleteNode()"; CswNbtViewRelationship GeneratorRelationship = View.AddViewRelationship( GeneratorObjectClass, false ); GeneratorRelationship.NodeIdsToFilterIn.Add( _CswNbtNode.NodeId ); CswNbtViewRelationship TargetRelationship = View.AddViewRelationship( GeneratorRelationship, CswEnumNbtViewPropOwnerType.Second, GeneratorProp, false ); CswNbtViewProperty IsFutureProperty = View.AddViewProperty( TargetRelationship, IsFutureProp ); View.AddViewPropertyFilter( IsFutureProperty, CswNbtFieldTypeRuleLogical.SubFieldName.Checked, CswEnumNbtFilterMode.Equals, CswEnumTristate.True ); ICswNbtTree TargetTree = _CswNbtResources.Trees.getTreeFromView( _CswNbtResources.CurrentNbtUser, View, true, false, false ); TargetTree.goToRoot(); if( TargetTree.getChildNodeCount() > 0 ) // should always be the case { TargetTree.goToNthChild( 0 ); if( TargetTree.getChildNodeCount() > 0 ) // might not always be the case { for( int i = 0; i < TargetTree.getChildNodeCount(); i += 1 ) { TargetTree.goToNthChild( i ); CswNbtNode TargetNode = TargetTree.getNodeForCurrentPosition(); TargetNode.delete(); TargetTree.goToParentNode(); } } } } } } }
} //Update() private void _updateDocumentProps( string NodeTypeName ) { CswNbtMetaDataNodeType DocNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( NodeTypeName ); if( null != DocNT ) { CswNbtMetaDataNodeTypeProp OwnerNTP = DocNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner ); OwnerNTP.PropName = "Material"; OwnerNTP.ReadOnly = true; CswNbtMetaDataNodeTypeProp TitleNTP = DocNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Title ); TitleNTP.Attribute1 = "40";//Size attribute } }
}//_addBalanceConfigurationNT() public void _updateUserLayout() { CswNbtMetaDataNodeType UserNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "User" ); CswNbtMetaDataNodeTypeProp DefaultBalanceNTP = UserNT.getNodeTypePropByObjectClassProp( CswNbtObjClassUser.PropertyName.DefaultBalance ); CswNbtMetaDataNodeTypeProp DefaultPrinterNTP = UserNT.getNodeTypePropByObjectClassProp( CswNbtObjClassUser.PropertyName.DefaultPrinter ); //insert the Balance prop to the layout after the Printer prop DefaultBalanceNTP.updateLayout( CswEnumNbtLayoutType.Add, DefaultPrinterNTP, true ); DefaultBalanceNTP.updateLayout( CswEnumNbtLayoutType.Edit, DefaultPrinterNTP, true ); }//_updateUserLayout()
private CswNbtMetaDataNodeType _createGroupNT( CswEnumNbtObjectClass GroupClass, string GroupNTName, string TargetsGridPropName ) { CswNbtMetaDataObjectClass GroupOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( GroupClass ); CswNbtMetaDataNodeType GroupNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( GroupOC.ObjectClassId, GroupNTName, "System" ); GroupNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassReportGroup.PropertyName.Name ) ); CswNbtMetaDataNodeTypeTab TaregetsTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( GroupNT, TargetsGridPropName ); CswNbtMetaDataNodeTypeProp TargetsNTP = GroupNT.getNodeTypePropByObjectClassProp( TargetsGridPropName ); TargetsNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, TaregetsTab.TabId ); CswNbtMetaDataNodeTypeTab PermissionsTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( GroupNT, CswNbtObjClassReportGroup.PropertyName.Permissions ); CswNbtMetaDataNodeTypeProp PermissionsNTP = GroupNT.getNodeTypePropByObjectClassProp( CswNbtObjClassReportGroup.PropertyName.Permissions ); PermissionsNTP.updateLayout( CswEnumNbtLayoutType.Edit, true, PermissionsTab.TabId ); return GroupNT; }
/// <summary> /// Update logic /// </summary> public override void update() { /* Get the Vendor NT and hide the newly created properties */ CswNbtMetaDataNodeType vendorNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Vendor" ); if( null != vendorNT ) { CswNbtMetaDataNodeTypeProp corporateEntityNTP = vendorNT.getNodeTypePropByObjectClassProp( CswNbtObjClassVendor.PropertyName.CorporateEntityName ); corporateEntityNTP.removeFromAllLayouts(); CswNbtMetaDataNodeTypeProp vendorTypeNTP = vendorNT.getNodeTypePropByObjectClassProp( CswNbtObjClassVendor.PropertyName.VendorTypeName ); vendorTypeNTP.removeFromAllLayouts(); } }//Update()
} // update() private CswNbtView _editView( string DocumentNodeType, CswNbtMetaDataObjectClass ObjectClassOfProperty, string DocumentObjClassProp ) { CswNbtView DocumentsView = null; CswNbtMetaDataNodeType DocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( DocumentNodeType ); if( null != DocumentNT ) { CswNbtMetaDataNodeType NodeTypeOfProperty = ObjectClassOfProperty.FirstNodeType; if( null != NodeTypeOfProperty ) { // documents property that contains the viewxml CswNbtMetaDataNodeTypeProp DocumentsNTP = NodeTypeOfProperty.getNodeTypePropByObjectClassProp( DocumentObjClassProp ); if( null != DocumentsNTP ) { CswNbtMetaDataNodeTypeProp LinkNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetDocument.PropertyName.Link ); CswNbtMetaDataNodeTypeProp FileNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetDocument.PropertyName.File ); CswNbtMetaDataNodeTypeProp OpenFileNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetDocument.PropertyName.OpenFile ); DocumentsView = _CswNbtSchemaModTrnsctn.restoreView( DocumentsNTP.ViewId ); if( false == DocumentsView.IsEmpty() ) { // View.Root only gives us the <TreeView></TreeView> content. It does not give the first relationship. We are assuming // that these views have two relationships: An OC (or PS) and a Document relationship // To get at the Document relationship, we need to get the second relationship. If the view doesn't have this second relationship, // we will just ignore it and won't make any changes CswNbtViewRelationship ParentRel = DocumentsView.Root.ChildRelationships[0]; if( ParentRel.ChildRelationships.Count > 0 ) { DocumentsView.removeViewProperty( LinkNTP ); DocumentsView.removeViewProperty( FileNTP ); CswNbtViewRelationship ChildRel = ParentRel.ChildRelationships[0]; if( null == ChildRel.findProperty( OpenFileNTP.NodeTypeId ) ) { DocumentsView.AddViewProperty( ChildRel, OpenFileNTP ); } DocumentsView.save(); } } //if( false == DocumentsView.IsEmpty() ) }//if( null != DocumentsNTP ) }//if( null != NodeTypeOfProperty ) }//if( null != DocumentNT ) return DocumentsView; }//_editView()
public override void update() { CswNbtMetaDataObjectClass SizeOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.SizeClass ); CswNbtMetaDataNodeType SizeNt = SizeOc.FirstNodeType; if( SizeNt != null ) { //Hide Dispensable and QuantityEditable properties CswNbtMetaDataNodeTypeProp DispensableNtp = SizeNt.getNodeTypePropByObjectClassProp( CswNbtObjClassSize.PropertyName.Dispensable ); DispensableNtp.removeFromAllLayouts(); CswNbtMetaDataNodeTypeProp QuantityEditableNtp = SizeNt.getNodeTypePropByObjectClassProp( CswNbtObjClassSize.PropertyName.QuantityEditable ); QuantityEditableNtp.removeFromAllLayouts(); } }//Update()
public override void update() { const string ViewName = "PI Schedule ParentView"; CswNbtMetaDataNodeType InspectionGeneratorNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Inspection Schedule" ); if( null != InspectionGeneratorNT ) { CswNbtMetaDataNodeTypeProp ParentViewNTP = InspectionGeneratorNT.getNodeTypePropByObjectClassProp( CswNbtObjClassGenerator.PropertyName.ParentView ); CswNbtView ExistingView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( ParentViewNTP.DefaultValue.AsViewReference.ViewId ); if( null != ExistingView && ExistingView.ViewName == ViewName ) { foreach( CswNbtObjClassGenerator InspectionSchedNode in InspectionGeneratorNT.getNodes( false, true, false, true ) ) { CswNbtView ParentView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( InspectionSchedNode.ParentView.ViewId ); if( ParentView.IsEmpty() ) { ParentView.CopyFromView( ExistingView ); ParentView.save(); InspectionSchedNode.postChanges( false ); } } } else { throw new CswDniException( CswEnumErrorType.Error, "Default Value for Inspection Schedule Parent View is invalid", "InspectionSchedule.ParentView NTP default value got an unexpected view" ); } } } // update()
public override void update() { // Page Size should have a min of 5 and a max of 50 CswNbtMetaDataObjectClass UserOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.UserClass ); CswNbtMetaDataObjectClassProp PageSizeOCP = UserOC.getObjectClassProp( CswNbtObjClassUser.PropertyName.PageSize ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( PageSizeOCP, CswEnumNbtObjectClassPropAttributes.numberminvalue, 5 ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( PageSizeOCP, CswEnumNbtObjectClassPropAttributes.numbermaxvalue, 50 ); // Update existing data CswNbtMetaDataNodeType UserNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "User" ); if( null != UserNT ) { CswNbtMetaDataNodeTypeProp PageSizeNTP = UserNT.getNodeTypePropByObjectClassProp( PageSizeOCP ); if( null != PageSizeNTP ) { foreach( CswNbtNode UserNode in UserNT.getNodes( false, true ) ) { if( UserNode.Properties[PageSizeNTP].AsNumber.Value < 5 ) { UserNode.Properties[PageSizeNTP].AsNumber.Value = 5; } else if( UserNode.Properties[PageSizeNTP].AsNumber.Value > 50 ) { UserNode.Properties[PageSizeNTP].AsNumber.Value = 50; } } } } } // update()
} // InitActionPermissionOptions() private void _deleteRelatedPermissionNodes() { CswNbtView PermissionsView = new CswNbtView( _CswNbtResources ); CswNbtMetaDataPropertySet PermissionPS = _CswNbtResources.MetaData.getPropertySet( CswEnumNbtPropertySetName.PermissionSet ); CswNbtViewRelationship RootVR = PermissionsView.AddViewRelationship( PermissionPS, false ); CswNbtViewPropertyFilter Filter = null; foreach( CswNbtMetaDataObjectClass PermOC in PermissionPS.getObjectClasses() ) { if( Filter == null ) { CswNbtMetaDataNodeType PermNT = PermOC.FirstNodeType; if( null != PermNT ) { CswNbtMetaDataNodeTypeProp RoleOCP = PermNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetPermission.PropertyName.Role ); Filter = PermissionsView.AddViewPropertyAndFilter( RootVR, MetaDataProp: RoleOCP, Value: NodeId.PrimaryKey.ToString(), SubFieldName: CswEnumNbtSubFieldName.NodeID, FilterMode: CswEnumNbtFilterMode.Equals ); } } else { break; } } ICswNbtTree PermissionsTree = _CswNbtResources.Trees.getTreeFromView( PermissionsView, false, true, true ); for( int i = 0; i < PermissionsTree.getChildNodeCount(); i++ ) { PermissionsTree.goToNthChild( i ); CswNbtNode PermissionNode = PermissionsTree.getNodeForCurrentPosition(); PermissionNode.delete(); PermissionsTree.goToRoot(); } }
} //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(); } } }
public override void update() { // Add nodetypes for new object classes CswNbtMetaDataObjectClass RegListMemberOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListMemberClass ); CswNbtMetaDataObjectClassProp RegListMemberChemicalOCP = RegListMemberOC.getObjectClassProp( CswNbtObjClassRegulatoryListMember.PropertyName.Chemical ); CswNbtMetaDataNodeType RegListMemberNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeTypeDeprecated( new CswNbtWcfMetaDataModel.NodeType( RegListMemberOC ) { NodeTypeName = "Regulatory List Member", Category = "Materials", SearchDeferObjectClassPropId = RegListMemberChemicalOCP.ObjectClassPropId } ); RegListMemberNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassRegulatoryListMember.PropertyName.Chemical ) + "-" + CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassRegulatoryListMember.PropertyName.RegulatoryList ) ); RegListMemberNT.getNodeTypePropByObjectClassProp( CswNbtObjClassRegulatoryListMember.PropertyName.ByUser ).removeFromLayout( CswEnumNbtLayoutType.Add ); CswNbtMetaDataObjectClass RegListCasNoOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListCasNoClass ); CswNbtMetaDataObjectClassProp RegListCasNoRegListOCP = RegListCasNoOC.getObjectClassProp( CswNbtObjClassRegulatoryListCasNo.PropertyName.RegulatoryList ); CswNbtMetaDataNodeType RegListCasNoNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeTypeDeprecated( new CswNbtWcfMetaDataModel.NodeType( RegListCasNoOC ) { NodeTypeName = "Regulatory List CAS", Category = "Materials", SearchDeferObjectClassPropId = RegListCasNoRegListOCP.ObjectClassPropId } ); RegListCasNoNT.setNameTemplateText( CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassRegulatoryListCasNo.PropertyName.RegulatoryList ) + "-" + CswNbtMetaData.MakeTemplateEntry( CswNbtObjClassRegulatoryListCasNo.PropertyName.CASNo ) ); // Grant permissions to cispro_admin CswNbtObjClassRole CISProAdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Admin" ); CswEnumNbtNodeTypePermission[] AllPerms = new CswEnumNbtNodeTypePermission[] { CswEnumNbtNodeTypePermission.Create, CswEnumNbtNodeTypePermission.Delete, CswEnumNbtNodeTypePermission.Edit, CswEnumNbtNodeTypePermission.View }; _CswNbtSchemaModTrnsctn.Permit.set( AllPerms, RegListMemberNT, CISProAdminRole, true ); _CswNbtSchemaModTrnsctn.Permit.set( AllPerms, RegListCasNoNT, CISProAdminRole, true ); } // update()
/// <summary> /// Update logic /// </summary> public override void update() { CswNbtMetaDataObjectClass SizeOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.SizeClass ); // moved to RunBeforeEveryExecutionOfUpdater_01OC //CswNbtMetaDataObjectClassProp UnitCountOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( SizeOc ) //{ // PropName = CswNbtObjClassSize.PropertyName.UnitCount, // FieldType = CswNbtMetaDataFieldType.NbtFieldType.Number, // IsRequired = true, // SetValOnAdd = true, // NumberMinValue = 1, // NumberPrecision = 0 //} ); CswNbtMetaDataNodeType SizeNt = SizeOc.FirstNodeType; if( null != SizeNt ) { CswNbtMetaDataNodeTypeProp UnitCountNtp = SizeNt.getNodeTypePropByObjectClassProp( CswNbtObjClassSize.PropertyName.UnitCount ); UnitCountNtp.DefaultValue.AsNumber.Value = 1; } foreach( CswNbtObjClassSize SizeNode in SizeOc.getNodes( false, false ) ) { SizeNode.UnitCount.Value = 1; SizeNode.postChanges( false ); } }
} // setupPhraseView() private void _setupClassificationView(CswNbtView View, CswCommaDelimitedString SelectedClassIds) { CswNbtMetaDataObjectClass GhsClassOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSClassificationClass); CswNbtMetaDataNodeType GhsClassNT = GhsClassOC.FirstNodeType; View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null); View.ViewMode = CswEnumNbtViewRenderingMode.Grid; View.Root.ChildRelationships.Clear(); if (SelectedClassIds.Count > 0) { CswNbtViewRelationship ClassVR = View.AddViewRelationship(GhsClassOC, false); foreach (string ClassId in SelectedClassIds) { CswPrimaryKey ClassPk = new CswPrimaryKey(); ClassPk.FromString(ClassId); ClassVR.NodeIdsToFilterIn.Add(ClassPk); } View.AddViewProperty(ClassVR, GhsClassOC.getObjectClassProp(CswNbtObjClassGHSClassification.PropertyName.Category)); if (null != GhsClassNT) { CswNbtMetaDataNodeTypeProp LanguageProp = GhsClassNT.getNodeTypePropByObjectClassProp(_getLanguageForTranslation()); CswNbtViewProperty LanguageVP = View.AddViewProperty(ClassVR, LanguageProp); LanguageVP.Width = 100; } } // if( SelectedClassIds.Count > 0 ) View.SaveToCache(IncludeInQuickLaunch: false, UpdateCache: true, KeepInQuickLaunch: false); } // _setupClassificationView()
public CswNbtView setupPhraseView(CswNbtView View, CswCommaDelimitedString SelectedPhraseIds) { CswNbtMetaDataObjectClass GhsPhraseOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSPhraseClass); CswNbtMetaDataNodeType GhsPhraseNT = GhsPhraseOC.FirstNodeType; View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null); View.ViewMode = CswEnumNbtViewRenderingMode.Grid; View.Root.ChildRelationships.Clear(); if (SelectedPhraseIds.Count > 0) { CswNbtViewRelationship PhraseVR = View.AddViewRelationship(GhsPhraseOC, false); foreach (string PhraseId in SelectedPhraseIds) { CswPrimaryKey PhrasePk = new CswPrimaryKey(); PhrasePk.FromString(PhraseId); PhraseVR.NodeIdsToFilterIn.Add(PhrasePk); } View.AddViewProperty(PhraseVR, GhsPhraseOC.getObjectClassProp(CswNbtObjClassGHSPhrase.PropertyName.Code)); if (null != GhsPhraseNT) { CswNbtMetaDataNodeTypeProp LanguageProp = GhsPhraseNT.getNodeTypePropByObjectClassProp(_getLanguageForTranslation()); CswNbtViewProperty LanguageVP = View.AddViewProperty(PhraseVR, LanguageProp); LanguageVP.Width = 100; } } // if( SelectedPhraseIds.Count > 0 ) return(View); } // setupPhraseView()
private void _addExpirationDateToContainersView() { string[] ViewsToUpdate = { "Chemical Containers", "Biological Containers", "Supply Containers" }; foreach( string ViewName in ViewsToUpdate ) { CswNbtView View = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( ViewName, CswEnumNbtViewVisibility.Property ); if( null != View ) { CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ContainerClass ); CswNbtMetaDataNodeType ContainerNT = ContainerOC.FirstNodeType; if( null != ContainerNT ) { CswNbtMetaDataNodeTypeProp[] propsToAdd = { ContainerNT.getNodeTypePropByObjectClassProp( CswNbtObjClassContainer.PropertyName.ExpirationDate ) }; _addPropertiesToView( View, View.Root.ChildRelationships, ContainerOC, ContainerNT, propsToAdd ); } } } }
}//_addMaterialComponentPermissions() private void _addTitleToDocumentsView() { CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet ); foreach( CswNbtMetaDataObjectClass MaterialOC in MaterialPS.getObjectClasses() ) { foreach( CswNbtMetaDataNodeType MaterialNT in MaterialOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp DocumentsNTP = MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.Documents ); CswNbtMetaDataNodeType MaterialDocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Material Document" ); if( null != MaterialDocumentNT ) { CswNbtMetaDataObjectClass DocumentOC = MaterialDocumentNT.getObjectClass(); CswNbtMetaDataNodeTypeProp[] propsToAdd = { MaterialDocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Title ) }; CswNbtView DocumentsView = _CswNbtSchemaModTrnsctn.restoreView( DocumentsNTP.ViewId ); if( null != DocumentsView ) { _addPropertiesToView( DocumentsView, DocumentsView.Root.ChildRelationships, DocumentOC, MaterialDocumentNT, propsToAdd ); } } } } }
/// <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()
private void _removeTargetsNotMatchingSelectedParent() { //If only one Parent NT is allowed (and selected), cycle through selected Target NTs and remove any that aren't related to the selected Parent NT if( Node.getNodeType().getFirstVersionNodeType().NodeTypeName == InspectionGeneratorNodeTypeName && ParentType.SelectMode == CswEnumNbtPropertySelectMode.Single && ParentType.SelectedNodeTypeIds.Count > 0 ) { CswCommaDelimitedString InvalidNodeTypes = new CswCommaDelimitedString(); foreach( Int32 InspectionDesignNodeTypeId in TargetType.SelectedNodeTypeIds.ToIntCollection() ) { CswNbtMetaDataNodeType InspectionDesignNt = _CswNbtResources.MetaData.getNodeType( InspectionDesignNodeTypeId ); if( null != InspectionDesignNt ) { Int32 InspectionTargetNTId = CswConvert.ToInt32( ParentType.SelectedNodeTypeIds[0] ); CswNbtMetaDataNodeTypeProp DesignTargetNtp = InspectionDesignNt.getNodeTypePropByObjectClassProp( CswNbtObjClassInspectionDesign.PropertyName.Target ); if( _fkIsValid( DesignTargetNtp ) && InspectionTargetNTId != DesignTargetNtp.FKValue ) { InvalidNodeTypes.Add( InspectionDesignNt.NodeTypeName ); TargetType.SelectedNodeTypeIds.Remove( InspectionDesignNt.NodeTypeId.ToString() ); } } } if( InvalidNodeTypes.Count > 0 && false == Owner.wasAnySubFieldModified() ) { throw new CswDniException( CswEnumErrorType.Warning, "Unable to add the following " + TargetType.PropName + " options because they do not belong to " + Owner.CachedNodeName + ": <br/>" + InvalidNodeTypes.ToString().Replace( ",", "<br/>" ), "Invalid Target Type options selected: " + InvalidNodeTypes ); } } }
public override void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request) { Int32 ObjectClassPropId = CswConvert.ToInt32(LandingPageRow["to_objectclasspropid"]); if (ObjectClassPropId != Int32.MinValue) { CswNbtNode RequestNode = _CswNbtResources.Nodes.GetNode(CswConvert.ToPrimaryKey(Request.NodeId)); if (null != RequestNode) { CswNbtMetaDataNodeType NodeType = RequestNode.getNodeType(); if (null != NodeType) { String OCPName = _CswNbtResources.MetaData.getObjectClassPropName(ObjectClassPropId); CswNbtMetaDataNodeTypeProp NodeTypeProp = NodeType.getNodeTypePropByObjectClassProp(OCPName); if (null != NodeTypeProp && false == RequestNode.Properties[NodeTypeProp].AsButton.Hidden) { String DisplayText = LandingPageRow["displaytext"].ToString(); _ItemData.Text = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : "Add New " + NodeTypeProp.PropName; _ItemData.NodeTypePropId = RequestNode.NodeId.ToString() + "_" + NodeTypeProp.PropId.ToString(); _ItemData.ActionName = NodeTypeProp.PropName; _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + NodeType.IconFileName; _setCommonItemDataForUI(LandingPageRow); } } } } }