public void onSetFk(CswNbtObjClassDesignNodeTypeProp DesignNTPNode) { Collection <CswNbtFieldTypeAttribute> Attributes = getAttributes(); CswNbtFieldTypeAttribute FkTypeAttr = Attributes.FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Fktype); CswNbtFieldTypeAttribute FkValueAttr = Attributes.FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Fkvalue); CswNbtFieldTypeAttribute ValuePropTypeAttr = Attributes.FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Valueproptype); CswNbtFieldTypeAttribute ValuePropIdAttr = Attributes.FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Valuepropid); if (DesignNTPNode.AttributeProperty.ContainsKey(FkTypeAttr.Name)) { CswNbtNodePropText FkTypeProp = DesignNTPNode.AttributeProperty[FkTypeAttr.Name].AsText; CswNbtNodePropList FkValueProp = DesignNTPNode.AttributeProperty[FkValueAttr.Name].AsList; CswNbtNodePropText ValuePropTypeProp = DesignNTPNode.AttributeProperty[ValuePropTypeAttr.Name].AsText; CswNbtNodePropList ValuePropIdProp = DesignNTPNode.AttributeProperty[ValuePropIdAttr.Name].AsList; if (FkTypeProp.wasSubFieldModified(CswNbtFieldTypeRuleList.SubFieldName.Value) || FkValueProp.wasSubFieldModified(CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID) || ValuePropTypeProp.wasSubFieldModified(CswNbtFieldTypeRuleList.SubFieldName.Value) || ValuePropIdProp.wasSubFieldModified(CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID)) { //We're changing the relationship if (_isInvalidFkTarget(FkTypeProp.Text, CswConvert.ToInt32(FkValueProp.Value), ValuePropTypeProp.Text, CswConvert.ToInt32(ValuePropIdProp.Value))) { ValuePropTypeProp.Text = ""; ValuePropIdProp.Value = ""; } } } }
public void onBeforeWriteDesignNode(CswNbtObjClassDesignNodeTypeProp DesignNTPNode) { // Set values for FKType and RelatedPropType CswNbtNodePropText FKTypeWrapper = DesignNTPNode.AttributeProperty[AttributeName.FKType].AsText; CswNbtNodePropList RelationshipWrapper = DesignNTPNode.AttributeProperty[AttributeName.Relationship].AsList; if (false == FKTypeWrapper.wasAnySubFieldModified(false)) { if (false == RelationshipWrapper.Empty) { if (RelationshipWrapper.Text.EndsWith(CswNbtObjClassDesignNodeTypeProp.PropRefValue_OCP_Suffix)) { FKTypeWrapper.Text = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString(); } else { FKTypeWrapper.Text = CswEnumNbtViewPropIdType.NodeTypePropId.ToString(); } } else { FKTypeWrapper.Text = string.Empty; } } CswNbtNodePropText RelatedPropTypeWrapper = DesignNTPNode.AttributeProperty[AttributeName.RelatedPropType].AsText; CswNbtNodePropList RelatedPropWrapper = DesignNTPNode.AttributeProperty[AttributeName.RelatedProperty].AsList; if (false == RelatedPropTypeWrapper.wasAnySubFieldModified(false)) { if (false == RelatedPropWrapper.Empty) { if (RelatedPropWrapper.Text.EndsWith(CswNbtObjClassDesignNodeTypeProp.PropRefValue_OCP_Suffix)) { RelatedPropTypeWrapper.Text = CswEnumNbtViewPropIdType.ObjectClassPropId.ToString(); } else { RelatedPropTypeWrapper.Text = CswEnumNbtViewPropIdType.NodeTypePropId.ToString(); } } else { RelatedPropTypeWrapper.Text = string.Empty; } } }