public void onSetFk(CswNbtObjClassDesignNodeTypeProp DesignNTPNode)
        {
            Collection <CswNbtFieldTypeAttribute> Attributes = getAttributes();
            CswNbtFieldTypeAttribute FkTypeAttr = Attributes.FirstOrDefault(a => a.Column == CswEnumNbtPropertyAttributeColumn.Fktype);

            if (DesignNTPNode.AttributeProperty.ContainsKey(FkTypeAttr.Name))
            {
                CswNbtNodePropWrapper FkTypeProp = DesignNTPNode.AttributeProperty[FkTypeAttr.Name];
                if (null != FkTypeProp && FkTypeProp.wasAnySubFieldModified(false))
                {
                    CswNbtNodePropMetaDataList FkProp = FkTypeProp.AsMetaDataList;
                    CswNbtViewId ViewId = DesignNTPNode.AttributeProperty[AttributeName.UnitView].AsViewReference.ViewId;
                    CswNbtView   View   = _CswNbtFieldResources.CswNbtResources.ViewSelect.restoreView(ViewId);
                    if (CswEnumNbtViewRelatedIdType.Unknown != FkProp.Type && Int32.MinValue != FkProp.Id)
                    {
                        //We have valid values that are different that what is currently set
                        CswNbtFieldTypeRuleDefaultImpl.setDefaultView(_CswNbtFieldResources.CswNbtResources.MetaData, DesignNTPNode, View, FkProp.Type, FkProp.Id, false);
                    }
                    else
                    {
                        //Make sure a default view is set
                        CswEnumNbtViewRelatedIdType TargetType = DesignNTPNode.AttributeProperty[AttributeName.UnitTarget].AsMetaDataList.Type;
                        Int32 TargetId = DesignNTPNode.AttributeProperty[AttributeName.UnitTarget].AsMetaDataList.Id;
                        if (CswEnumNbtViewRelatedIdType.Unknown != TargetType && Int32.MinValue != TargetId)
                        {
                            CswNbtFieldTypeRuleDefaultImpl.setDefaultView(_CswNbtFieldResources.CswNbtResources.MetaData, DesignNTPNode, View, TargetType, TargetId, true);
                        }
                    }
                }
            } // if( DesignNTPNode.AttributeProperty.ContainsKey( FkTypeAttr.Name ) )
        }     // onSetFk()
Exemplo n.º 2
0
        public void onSetFk(CswNbtObjClassDesignNodeTypeProp DesignNTPNode)
        {
            CswNbtNodePropMetaDataList  FkProp   = DesignNTPNode.AttributeProperty[AttributeName.Target].AsMetaDataList;
            CswNbtNodePropViewReference ViewProp = DesignNTPNode.AttributeProperty[AttributeName.View].AsViewReference;

            if (null != FkProp &&
                null != ViewProp &&
                (FkProp.wasSubFieldModified(CswNbtFieldTypeRuleMetaDataList.SubFieldName.Type) ||
                 FkProp.wasSubFieldModified(CswNbtFieldTypeRuleMetaDataList.SubFieldName.Id)) &&
                CswEnumNbtViewRelatedIdType.Unknown != FkProp.Type &&
                Int32.MinValue != FkProp.Id)
            {
                CswNbtView View = _CswNbtFieldResources.CswNbtResources.ViewSelect.restoreView(ViewProp.ViewId);
                // don't override if view was also modified (case 31812)
                // but still override if the view is empty, to handle brand new properties (case 31858)
                if (View.IsEmpty() || false == ViewProp.wasSubFieldModified(CswNbtFieldTypeRuleViewReference.SubFieldName.ViewID))
                {
                    //We have valid values that are different that what is currently set
                    CswNbtFieldTypeRuleDefaultImpl.setDefaultView(_CswNbtFieldResources.CswNbtResources.MetaData, DesignNTPNode, View, FkProp.Type, FkProp.Id, false);
                }
            }
        } // onSetFk()