private static void _recurseForRelatingNodes(CswNbtResources NbtResources, CswNbtExplorerReturn Return, CswNbtNode Node, int Level, string OwnerIdStr) { CswNbtMetaDataNodeType TargetNodeType = Node.getNodeType(); foreach (CswNbtMetaDataNodeTypeProp RelNTP in TargetNodeType.getNodeTypeProps(CswEnumNbtFieldType.Relationship)) //TODO: Locations are just like relationships, we should be able to handle them { CswNbtNodePropRelationship RelProp = Node.Properties[RelNTP]; string Icon = _getIconFromRelationshipProp(NbtResources, RelNTP); if (CswTools.IsPrimaryKey(RelProp.RelatedNodeId)) { CswNbtNode TargetNode = NbtResources.Nodes[RelProp.RelatedNodeId]; CswNbtMetaDataNodeType TargetNT = TargetNode.getNodeType(); if (FilterVal.Contains("NT_" + TargetNode.NodeTypeId) || FilterVal.Contains("OC_" + TargetNode.getObjectClassId())) { string targetIdStr = OwnerIdStr + "_" + RelProp.RelatedNodeId.ToString(); _addToGraph(Return, RelProp.PropName + ": " + RelProp.CachedNodeName, Node.NodeId.ToString(), RelProp.RelatedNodeId.ToString(), Icon, Level, "Instance", RelProp.RelatedNodeId.ToString(), TargetNT.NodeTypeName, RelNTP.PropId); if (Level + 1 <= MAX_DEPTH) { _recurseForRelatedNTs(NbtResources, Return, TargetNode.NodeTypeId, 1, RelProp.RelatedNodeId.ToString()); } if (Level + 1 <= MAX_DEPTH) { _recurseForRelatingNodes(NbtResources, Return, TargetNode, Level + 1, targetIdStr); } } } } }
public void onBeforeWriteDesignNode(CswNbtObjClassDesignNodeTypeProp DesignNTPNode) { // Copy value of 'Add To Template' to the Template CswNbtNodePropText TemplateProp = DesignNTPNode.AttributeProperty[AttributeName.Template].AsText; CswNbtNodePropRelationship AddToTemplateProp = DesignNTPNode.AttributeProperty[AttributeName.AddToTemplate].AsRelationship; if (CswTools.IsPrimaryKey(AddToTemplateProp.RelatedNodeId)) { CswNbtObjClassDesignNodeTypeProp SelectedProp = _CswNbtFieldResources.CswNbtResources.Nodes[AddToTemplateProp.RelatedNodeId]; if (null != SelectedProp) { string newTemplate = TemplateProp.Text; if (false == string.IsNullOrEmpty(newTemplate)) { newTemplate += " "; } newTemplate += CswNbtMetaData.MakeTemplateEntry(SelectedProp.RelationalNodeTypeProp.FirstPropVersionId.ToString()); TemplateProp.Text = newTemplate; // Clear the selected value AddToTemplateProp.RelatedNodeId = null; AddToTemplateProp.CachedNodeName = string.Empty; AddToTemplateProp.PendingUpdate = false; } // if( null != SelectedProp ) } // if( CswTools.IsPrimaryKey( AddToTemplateProp.RelatedNodeId ) ) }
protected override void afterPopulateProps() { LabelCodes.InitOptions = _initGhsPhraseOptions; Classifications.InitOptions = _initGhsClassificationOptions; AddLabelCodes.SetOnPropChange(OnAddLabelCodesPropChange); Pictograms.SetOnPropChange(OnPictorgramsChange); LabelCodesGrid.SetOnBeforeRender(delegate(CswNbtNodeProp Prop) { CswNbtNodePropGrid PropAsGrid = (CswNbtNodePropGrid)Prop; CswNbtView UpdatedPhraseView = setupPhraseView(PropAsGrid.View, LabelCodes.Value); UpdatedPhraseView.SaveToCache(IncludeInQuickLaunch: false, UpdateCache: true, KeepInQuickLaunch: false); }); ClassificationsGrid.SetOnBeforeRender(delegate(CswNbtNodeProp Prop) { CswNbtNodePropGrid PropAsGrid = (CswNbtNodePropGrid)Prop; _setupClassificationView(PropAsGrid.View, Classifications.Value); }); SignalWord.SetOnBeforeRender(delegate(CswNbtNodeProp Prop) { CswNbtNodePropRelationship PropAsRelationship = (CswNbtNodePropRelationship)Prop; Dictionary <CswPrimaryKey, string> TranslatedOpts = new Dictionary <CswPrimaryKey, string>(); ICswNbtTree tree = _CswNbtResources.Trees.getTreeFromView(PropAsRelationship.View, true, false, false); int count = tree.getChildNodeCount(); for (int i = 0; i < count; i++) { tree.goToNthChild(i); CswNbtObjClassGHSSignalWord SignalWordNode = tree.getNodeForCurrentPosition(); string TranslatedText = SignalWordNode.Node.Properties[_getLanguageForTranslation()].AsText.Text; TranslatedOpts.Add(SignalWordNode.NodeId, TranslatedText); tree.goToParentNode(); } PropAsRelationship.SetOptionsOverride(TranslatedOpts); if (CswTools.IsPrimaryKey(PropAsRelationship.RelatedNodeId)) { CswNbtObjClassGHSSignalWord Selected = _CswNbtResources.Nodes[PropAsRelationship.RelatedNodeId]; string TranslantedText = Selected.Node.Properties[_getLanguageForTranslation()].AsText.Text; Selected.Node.NodeName = (false == string.IsNullOrEmpty(TranslantedText) ? TranslantedText : Selected.English.Text); } }); } //afterPopulateProps()
public void onBeforeWriteDesignNode(CswNbtObjClassDesignNodeTypeProp DesignNTPNode) { CswNbtNodePropRelationship SequenceProp = DesignNTPNode.AttributeProperty[CswEnumNbtPropertyAttributeName.Sequence].AsRelationship; if (SequenceProp.wasSubFieldModified(CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID)) { if (null != DesignNTPNode.RelationalNodeTypeProp && null != DesignNTPNode.RelationalNodeType) { // Update nodes foreach (CswNbtNode CurrentNode in DesignNTPNode.RelationalNodeType.getNodes(false, false)) { CswNbtNodePropWrapper CurrentProp = CurrentNode.Properties[DesignNTPNode.RelationalNodeTypeProp]; if (CurrentProp.AsSequence.Empty) { CurrentProp.AsSequence.setSequenceValue(); } } } // if prop is sequence or barcode } // if(SequenceProp.wasSubFieldModified( CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID ) ) } // onBeforeWriteDesignNode()
public void UpdateNode(CswNbtNode Node, bool ForceUpdate) { // BZ 10240 if ((Node.PendingUpdate || ForceUpdate) && Node.getObjectClass().ObjectClass == CswEnumNbtObjectClass.EquipmentClass) { ((CswNbtObjClassEquipment)Node).SyncEquipmentToAssembly(); } // Case 30126 if (null != Node.getObjectClass().getPropertySet()) { if ((Node.PendingUpdate || ForceUpdate) && Node.getObjectClass().getPropertySet().Name == CswEnumNbtPropertySetName.MaterialSet) { ((CswNbtPropertySetMaterial)Node).onUpdatePropertyValue(); } } // Update all out of date values for a given node foreach (CswNbtNodePropWrapper PropWrapper in Node.Properties) { if (PropWrapper.PendingUpdate || Node.PendingUpdate || ForceUpdate) { switch (PropWrapper.getFieldTypeValue()) { case CswEnumNbtFieldType.Composite: CswNbtNodePropComposite CompositeProp = PropWrapper.AsComposite; CompositeProp.RecalculateCompositeValue(); break; case CswEnumNbtFieldType.Location: CswNbtNodePropLocation LocationProp = PropWrapper.AsLocation; LocationProp.RefreshNodeName(); break; case CswEnumNbtFieldType.LogicalSet: CswNbtNodePropLogicalSet LogicalSetProp = PropWrapper.AsLogicalSet; LogicalSetProp.RefreshStringValue(SetPendingUpdate: false); break; case CswEnumNbtFieldType.NodeTypeSelect: CswNbtNodePropNodeTypeSelect NodeTypeSelectProp = PropWrapper.AsNodeTypeSelect; NodeTypeSelectProp.RefreshSelectedNodeTypeNames(); break; case CswEnumNbtFieldType.PropertyReference: CswNbtNodePropPropertyReference PropertyReferenceProp = PropWrapper.AsPropertyReference; PropertyReferenceProp.RecalculateReferenceValue(); break; case CswEnumNbtFieldType.Quantity: CswNbtNodePropQuantity QuantityProp = PropWrapper.AsQuantity; QuantityProp.RefreshNodeName(); break; case CswEnumNbtFieldType.Relationship: CswNbtNodePropRelationship RelationshipProp = PropWrapper.AsRelationship; RelationshipProp.RefreshNodeName(); break; case CswEnumNbtFieldType.ViewPickList: CswNbtNodePropViewPickList ViewPickListProp = PropWrapper.AsViewPickList; ViewPickListProp.RefreshViewName(); break; case CswEnumNbtFieldType.ViewReference: CswNbtNodePropViewReference ViewReferenceProp = PropWrapper.AsViewReference; ViewReferenceProp.RefreshViewName(); break; case CswEnumNbtFieldType.MTBF: CswNbtNodePropMTBF MTBFProp = PropWrapper.AsMTBF; MTBFProp.RefreshCachedValue(); break; default: if (PropWrapper.PendingUpdate) { PropWrapper.setPendingUpdate(false); } break; } // switch (PropWrapper.FieldType.FieldType) } // if(PropWrapper.PendingUpdate) } // foreach (CswNbtNodePropWrapper PropWrapper in Node.Properties) if (Node.PendingUpdate) { Node.PendingUpdate = false; } } // UpdateNode()