private void _designObjectClasses() { if( null == _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.DesignNodeTypeClass ) ) { CswNbtMetaDataObjectClass NodeTypeOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswEnumNbtObjectClass.DesignNodeTypeClass, "wrench.png", true ); CswNbtMetaDataObjectClass PropOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswEnumNbtObjectClass.DesignNodeTypePropClass, "wrench.png", true ); CswNbtMetaDataObjectClass TabOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswEnumNbtObjectClass.DesignNodeTypeTabClass, "wrench.png", true ); // DesignNodeType { CswNbtMetaDataObjectClassProp AuditLevelOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.AuditLevel, FieldType = CswEnumNbtFieldType.List, ListOptions = new CswCommaDelimitedString() { CswEnumAuditLevel.NoAudit.ToString(), CswEnumAuditLevel.PlainAudit.ToString() }.ToString(), IsRequired = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.Category, FieldType = CswEnumNbtFieldType.Text } ); CswNbtMetaDataObjectClassProp DeferSearchToOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.DeferSearchTo, FieldType = CswEnumNbtFieldType.Relationship, IsRequired = false, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = PropOC.ObjectClassId } ); CswNbtMetaDataObjectClassProp SearchableOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.Searchable, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true } ); CswNbtMetaDataObjectClassProp HasLabelOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.HasLabel, FieldType = CswEnumNbtFieldType.Logical, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.IconFileName, FieldType = CswEnumNbtFieldType.ImageList, Extended = false.ToString(), TextAreaRows = 16, TextAreaColumns = 16, IsRequired = true } ); CswNbtMetaDataObjectClassProp LockedOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.Locked, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true } ); CswNbtMetaDataObjectClassProp EnabledOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.Enabled, FieldType = CswEnumNbtFieldType.Logical, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.NameTemplateText, FieldType = CswEnumNbtFieldType.Text } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.NameTemplateValue, FieldType = CswEnumNbtFieldType.Text, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.NameTemplateAdd, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = PropOC.ObjectClassId } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.NodeTypeName, FieldType = CswEnumNbtFieldType.Text, IsRequired = true } ); //_CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) //{ // PropName = CswNbtObjClassDesignNodeType.PropertyName.ObjectClassName, // FieldType = CswEnumNbtFieldType.Text, // ServerManaged = true //} ); CswNbtMetaDataObjectClassProp ObjectClassValueOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( NodeTypeOC ) { PropName = CswNbtObjClassDesignNodeType.PropertyName.ObjectClass, FieldType = CswEnumNbtFieldType.List, ReadOnly = true, IsRequired = true } ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( AuditLevelOCP, CswEnumAuditLevel.NoAudit.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( SearchableOCP, CswConvert.TristateToDbVal( CswEnumTristate.True ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( HasLabelOCP, CswConvert.TristateToDbVal( CswEnumTristate.False ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( LockedOCP, CswConvert.TristateToDbVal( CswEnumTristate.False ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( EnabledOCP, CswConvert.TristateToDbVal( CswEnumTristate.True ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( ObjectClassValueOCP, CswConvert.ToDbVal( _CswNbtSchemaModTrnsctn.MetaData.getObjectClassId( CswEnumNbtObjectClass.GenericClass ) ), CswNbtFieldTypeRuleList.SubFieldName.Value ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( ObjectClassValueOCP, CswConvert.ToDbVal( CswEnumNbtObjectClass.GenericClass.ToString() ), CswNbtFieldTypeRuleList.SubFieldName.Text ); } // DesignNodeTypeProp { CswNbtMetaDataObjectClassProp AuditLevelOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.AuditLevel, FieldType = CswEnumNbtFieldType.List, ListOptions = new CswCommaDelimitedString() { CswEnumAuditLevel.NoAudit.ToString(), CswEnumAuditLevel.PlainAudit.ToString() }.ToString(), IsRequired = true } ); CswNbtMetaDataObjectClassProp CompoundUniqueOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.CompoundUnique, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true } ); CswNbtMetaDataObjectClassProp DisplayConditionFilterOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.DisplayConditionFilterMode, FieldType = CswEnumNbtFieldType.List } ); CswNbtMetaDataObjectClassProp DisplayConditionPropertyOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.DisplayConditionProperty, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = PropOC.ObjectClassId } ); CswNbtMetaDataObjectClassProp DisplayConditionSubfieldOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.DisplayConditionSubfield, FieldType = CswEnumNbtFieldType.List } ); CswNbtMetaDataObjectClassProp DisplayConditionValueOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.DisplayConditionValue, FieldType = CswEnumNbtFieldType.Text } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.FieldType, FieldType = CswEnumNbtFieldType.List, ReadOnly = true, IsRequired = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.HelpText, FieldType = CswEnumNbtFieldType.Memo } ); CswNbtMetaDataObjectClassProp NodeTypeOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.NodeTypeValue, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = NodeTypeOC.ObjectClassId, ReadOnly = true, IsRequired = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.ObjectClassPropName, FieldType = CswEnumNbtFieldType.List, ServerManaged = true } ); CswNbtMetaDataObjectClassProp PropNameOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.PropName, FieldType = CswEnumNbtFieldType.Text } ); CswNbtMetaDataObjectClassProp ReadOnlyOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.ReadOnly, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true } ); CswNbtMetaDataObjectClassProp RequiredOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.Required, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true } ); CswNbtMetaDataObjectClassProp ServerManagedOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.ServerManaged, FieldType = CswEnumNbtFieldType.Logical, ServerManaged = true } ); CswNbtMetaDataObjectClassProp UniqueOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.Unique, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true } ); CswNbtMetaDataObjectClassProp UseNumberingOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.UseNumbering, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true } ); CswNbtMetaDataObjectClassProp QuestionNoOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.QuestionNo, FieldType = CswEnumNbtFieldType.Number, ServerManaged = true } ); CswNbtMetaDataObjectClassProp SubQuestionNoOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( PropOC ) { PropName = CswNbtObjClassDesignNodeTypeProp.PropertyName.SubQuestionNo, FieldType = CswEnumNbtFieldType.Number, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( AuditLevelOCP, CswEnumAuditLevel.NoAudit.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( CompoundUniqueOCP, CswConvert.TristateToDbVal( CswEnumTristate.False ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( UseNumberingOCP, CswConvert.TristateToDbVal( CswEnumTristate.False ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( ReadOnlyOCP, CswConvert.TristateToDbVal( CswEnumTristate.False ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( RequiredOCP, CswConvert.TristateToDbVal( CswEnumTristate.False ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( ServerManagedOCP, CswConvert.TristateToDbVal( CswEnumTristate.False ) ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( UniqueOCP, CswConvert.TristateToDbVal( CswEnumTristate.False ) ); //// Display condition view includes all properties on the same nodetype //CswNbtView DispCondView = _CswNbtSchemaModTrnsctn.makeView(); //CswNbtViewRelationship PropRel1 = DispCondView.AddViewRelationship( PropOC, false ); //CswNbtViewRelationship TypeRel2 = DispCondView.AddViewRelationship( PropRel1, CswEnumNbtViewPropOwnerType.First, NodeTypeOCP, false ); //CswNbtViewRelationship PropRel3 = DispCondView.AddViewRelationship( TypeRel2, CswEnumNbtViewPropOwnerType.Second, NodeTypeOCP, false ); //_CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionPropertyOCP, CswEnumNbtObjectClassPropAttributes.viewxml, DispCondView.ToXml().InnerXml ); // Display condition filters rely on a property being selected _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionSubfieldOCP, CswEnumNbtObjectClassPropAttributes.filterpropid, DisplayConditionPropertyOCP.ObjectClassPropId ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionFilterOCP, CswEnumNbtObjectClassPropAttributes.filterpropid, DisplayConditionPropertyOCP.ObjectClassPropId ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionValueOCP, CswEnumNbtObjectClassPropAttributes.filterpropid, DisplayConditionPropertyOCP.ObjectClassPropId ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionSubfieldOCP, CswEnumNbtObjectClassPropAttributes.filtersubfield, CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionFilterOCP, CswEnumNbtObjectClassPropAttributes.filtersubfield, CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionValueOCP, CswEnumNbtObjectClassPropAttributes.filtersubfield, CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionSubfieldOCP, CswEnumNbtObjectClassPropAttributes.filtermode, CswEnumNbtFilterMode.NotNull.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionFilterOCP, CswEnumNbtObjectClassPropAttributes.filtermode, CswEnumNbtFilterMode.NotNull.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( DisplayConditionValueOCP, CswEnumNbtObjectClassPropAttributes.filtermode, CswEnumNbtFilterMode.NotNull.ToString() ); // QuestionNo and SubQuestionNo depend on UseNumbering _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuestionNoOCP, CswEnumNbtObjectClassPropAttributes.filterpropid, UseNumberingOCP.ObjectClassPropId ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuestionNoOCP, CswEnumNbtObjectClassPropAttributes.filtersubfield, CswNbtFieldTypeRuleLogical.SubFieldName.Checked.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuestionNoOCP, CswEnumNbtObjectClassPropAttributes.filtermode, CswEnumNbtFilterMode.Equals.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( QuestionNoOCP, CswEnumNbtObjectClassPropAttributes.filtervalue, CswEnumTristate.True.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( SubQuestionNoOCP, CswEnumNbtObjectClassPropAttributes.filterpropid, UseNumberingOCP.ObjectClassPropId ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( SubQuestionNoOCP, CswEnumNbtObjectClassPropAttributes.filtersubfield, CswNbtFieldTypeRuleLogical.SubFieldName.Checked.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( SubQuestionNoOCP, CswEnumNbtObjectClassPropAttributes.filtermode, CswEnumNbtFilterMode.Equals.ToString() ); _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( SubQuestionNoOCP, CswEnumNbtObjectClassPropAttributes.filtervalue, CswEnumTristate.True.ToString() ); } // DesignNodeTypeTab { CswNbtMetaDataObjectClassProp IncludeOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( TabOC ) { PropName = CswNbtObjClassDesignNodeTypeTab.PropertyName.IncludeInReport, FieldType = CswEnumNbtFieldType.Logical, IsRequired = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( TabOC ) { PropName = CswNbtObjClassDesignNodeTypeTab.PropertyName.NodeTypeValue, FieldType = CswEnumNbtFieldType.Relationship, IsFk = true, FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(), FkValue = NodeTypeOC.ObjectClassId, ReadOnly = true, IsRequired = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( TabOC ) { PropName = CswNbtObjClassDesignNodeTypeTab.PropertyName.Order, FieldType = CswEnumNbtFieldType.Number } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( TabOC ) { PropName = CswNbtObjClassDesignNodeTypeTab.PropertyName.TabName, FieldType = CswEnumNbtFieldType.Text, IsRequired = true } ); _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( TabOC ) { PropName = CswNbtObjClassDesignNodeTypeTab.PropertyName.ServerManaged, FieldType = CswEnumNbtFieldType.Logical, ServerManaged = true } ); _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( IncludeOCP, CswConvert.TristateToDbVal( CswEnumTristate.True ) ); } } } // _designObjectClasses()
}//ctor public void update(Int32 NodeTypeId, CswPrimaryKey RelationalId, DataTable PropsTable) { if (CswTools.IsPrimaryKey(RelationalId)) { CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(NodeTypeId); string TableName = NodeType.TableName; if (TableName != "nodes") { string PkColumnName = _CswNbtResources.getPrimeKeyColName(TableName); CswTableUpdate CswTableUpdate = null; DataTable DataTable = null; DataRow DataRow = null; // horrible special case for Design // We need to use CswNbtMetaDataResources objects, or else we have dirty-write problems if (NodeType.TableName.StartsWith("nodetype")) { switch (NodeType.TableName) { case "nodetypes": CswTableUpdate = _CswNbtResources.MetaData._CswNbtMetaDataResources.NodeTypeTableUpdate; CswNbtMetaDataNodeType relatedNT = _CswNbtResources.MetaData.getNodeType(RelationalId.PrimaryKey, null, true); DataTable = relatedNT._DataRow.Table; DataRow = relatedNT._DataRow; break; case "nodetype_tabset": CswTableUpdate = _CswNbtResources.MetaData._CswNbtMetaDataResources.NodeTypeTabTableUpdate; CswNbtMetaDataNodeTypeTab relatedNTT = _CswNbtResources.MetaData.getNodeTypeTab(RelationalId.PrimaryKey, true); DataTable = relatedNTT._DataRow.Table; DataRow = relatedNTT._DataRow; break; case "nodetype_props": CswTableUpdate = _CswNbtResources.MetaData._CswNbtMetaDataResources.NodeTypePropTableUpdate; CswNbtMetaDataNodeTypeProp relatedNTP = _CswNbtResources.MetaData.getNodeTypeProp(RelationalId.PrimaryKey, null, true); DataTable = relatedNTP._DataRow.Table; DataRow = relatedNTP._DataRow; break; } } // if( NodeType.TableName.StartsWith( "nodetype" ) ) if (null == DataTable || null == CswTableUpdate) { CswTableUpdate = _CswNbtResources.makeCswTableUpdate("CswNbtNodePropCollDataRelational_update", TableName); DataTable = CswTableUpdate.getTable(null, PkColumnName, RelationalId.PrimaryKey, string.Empty, false); DataRow = DataTable.Rows[0]; } if (null != DataRow) { CswTableSelect MappingSelect = _CswNbtResources.makeCswTableSelect("PropCollDataRelational_mapping", "jct_dd_ntp"); DataTable MappingTable = MappingSelect.getTable("where nodetypepropid in (select nodetypepropid from nodetype_props where nodetypeid =" + NodeTypeId.ToString() + ")"); foreach (DataRow CurrentRow in PropsTable.Rows) { CswNbtMetaDataNodeTypeProp thisNTP = NodeType.getNodeTypeProp(CswConvert.ToInt32(CurrentRow["nodetypepropid"])); if (null != thisNTP) { foreach (CswNbtSubField CurrentSubField in thisNTP.getFieldTypeRule().SubFields) { DataRow MappingRow = MappingTable.Rows.Cast <DataRow>() .FirstOrDefault(r => CswConvert.ToInt32(r["nodetypepropid"]) == thisNTP.PropId && r["subfieldname"].ToString() == CurrentSubField.Name.ToString()); if (null != MappingRow) { _CswNbtResources.DataDictionary.setCurrentColumn(CswConvert.ToInt32(MappingRow["datadictionaryid"])); if (_CswNbtResources.DataDictionary.ColumnName != string.Empty) { if (CurrentRow[CurrentSubField.Column.ToString()].ToString() == string.Empty) { DataRow[_CswNbtResources.DataDictionary.ColumnName] = DBNull.Value; } else if (_CswNbtResources.DataDictionary.ColumnName == CswEnumNbtPropertyAttributeColumn.Defaultvalueid) { // Special case for Default Value: we need to sync the jctnodepropid row, not the value DataRow[_CswNbtResources.DataDictionary.ColumnName] = CurrentRow["jctnodepropid"]; } else { object value = CurrentRow[CurrentSubField.Column.ToString()]; // Special case for Multi: translate "Single" and "Multiple" to 0 and 1 resp. if (_CswNbtResources.DataDictionary.ColumnName == CswEnumNbtPropertyAttributeColumn.Multi) { if (value.ToString() == CswEnumNbtPropertySelectMode.Single.ToString()) { value = 1; } else { value = 0; } } // Special case for booleans and tristates else if (thisNTP.getFieldTypeValue() == CswEnumNbtFieldType.Logical) { value = CswConvert.TristateToDbVal(CswConvert.ToTristate(CurrentRow[CurrentSubField.Column.ToString()])); } // Special case for relationships and locations, if the related entity is also relational else if (CurrentSubField.Name == CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID && (thisNTP.getFieldTypeValue() == CswEnumNbtFieldType.Relationship || thisNTP.getFieldTypeValue() == CswEnumNbtFieldType.Location)) { CswNbtNode RelatedNode = _CswNbtResources.Nodes[new CswPrimaryKey("nodes", CswConvert.ToInt32(value))]; if (null != RelatedNode && RelatedNode.getNodeType().DoRelationalSync) { // Remap the foreign key reference to the relational primary key value = RelatedNode.RelationalId.PrimaryKey; } } DataRow[_CswNbtResources.DataDictionary.ColumnName] = value; //CurrentRow[CurrentSubField.Column.ToString()]; } } // if( _CswNbtResources.DataDictionary.ColumnName != string.Empty ) } // if( null != MappingRow ) } // foreach( CswNbtSubField CurrentSubField in thisNTP.getFieldTypeRule().SubFields ) } // if( null != thisNTP ) } // foreach( DataRow CurrentRow in PropsTable.Rows ) CswTableUpdate.update(DataTable); } // if( null != DataRow ) } // if( TableName != "nodes" ) } // if( CswTools.IsPrimaryKey( RelationalId ) ) } //update()