}//validate() public XmlNode ToXml(XmlDocument XmlDoc) { XmlNode PropFilterNode = XmlDoc.CreateNode(XmlNodeType.Element, CswEnumNbtViewXmlNodeName.Filter.ToString(), ""); XmlAttribute FilterValueAttribute = XmlDoc.CreateAttribute("value"); FilterValueAttribute.Value = Value; PropFilterNode.Attributes.Append(FilterValueAttribute); XmlAttribute FilterModeAttribute = XmlDoc.CreateAttribute("filtermode"); FilterModeAttribute.Value = FilterMode.ToString(); PropFilterNode.Attributes.Append(FilterModeAttribute); XmlAttribute CaseSensitiveAttribute = XmlDoc.CreateAttribute("casesensitive"); CaseSensitiveAttribute.Value = CaseSensitive.ToString(); PropFilterNode.Attributes.Append(CaseSensitiveAttribute); XmlAttribute ShowAtRuntimeAttribute = XmlDoc.CreateAttribute("showatruntime"); ShowAtRuntimeAttribute.Value = ShowAtRuntime.ToString(); PropFilterNode.Attributes.Append(ShowAtRuntimeAttribute); XmlAttribute ArbitraryIdAttribute = XmlDoc.CreateAttribute("arbitraryid"); ArbitraryIdAttribute.Value = ArbitraryId.ToString(); PropFilterNode.Attributes.Append(ArbitraryIdAttribute); XmlAttribute SubfieldNameAttribute = XmlDoc.CreateAttribute("subfieldname"); SubfieldNameAttribute.Value = SubfieldName.ToString(); PropFilterNode.Attributes.Append(SubfieldNameAttribute); XmlAttribute ResultModeAttribute = XmlDoc.CreateAttribute("resultmode"); ResultModeAttribute.Value = ResultMode.ToString(); PropFilterNode.Attributes.Append(ResultModeAttribute); XmlAttribute ConjunctionAttribute = XmlDoc.CreateAttribute("conjunction"); ConjunctionAttribute.Value = Conjunction.ToString(); PropFilterNode.Attributes.Append(ConjunctionAttribute); return(PropFilterNode); }
} // update() private void _addJctRow( DataTable JctTable, CswNbtMetaDataNodeTypeProp Prop, string TableName, string ColumnName, CswEnumNbtSubFieldName SubFieldName = null ) { _CswNbtSchemaModTrnsctn.CswDataDictionary.setCurrentColumn( TableName, ColumnName ); DataRow NodeTypeNameRow = JctTable.NewRow(); NodeTypeNameRow["nodetypepropid"] = Prop.PropId; NodeTypeNameRow["datadictionaryid"] = _CswNbtSchemaModTrnsctn.CswDataDictionary.TableColId; if( null != SubFieldName ) { NodeTypeNameRow["subfieldname"] = SubFieldName.ToString(); } else if( null != Prop.getFieldTypeRule().SubFields.Default ) { NodeTypeNameRow["subfieldname"] = Prop.getFieldTypeRule().SubFields.Default.Name; } JctTable.Rows.Add( NodeTypeNameRow ); }
} // SetSubFieldValue /// <summary> /// Get the value for a subfield /// </summary> public object GetSubFieldValue(CswEnumNbtSubFieldName SubFieldName) { object ret = null; if (_SubFieldMethods.ContainsKey(SubFieldName) && null != _SubFieldMethods[SubFieldName].Item1) { // This calls the appropriate get; method in the CswNbtNodeProp* class ret = _SubFieldMethods[SubFieldName].Item1(); } else { throw new CswDniException(CswEnumErrorType.Error, "Invalid subfield configuration", PropName + " (field type: " + getFieldTypeValue() + ") does not contain a get method for subfield " + SubFieldName.ToString()); } return(ret); } // GetSubFieldValue
/// <summary> /// Set the value for a subfield, triggering the logic associated with that subfield on the fieldtype /// reference: http://stackoverflow.com/questions/289980/is-there-a-delegate-available-for-properties-in-c /// </summary> public void SetSubFieldValue(CswEnumNbtSubFieldName SubFieldName, object value) { if (_SubFieldMethods.ContainsKey(SubFieldName) && null != _SubFieldMethods[SubFieldName].Item2) { // This calls the appropriate set; method in the CswNbtNodeProp* class _SubFieldMethods[SubFieldName].Item2(value); } else { throw new CswDniException(CswEnumErrorType.Error, "Invalid subfield configuration", PropName + " (field type: " + getFieldTypeValue() + ") does not contain a set method for subfield " + SubFieldName.ToString()); } } // SetSubFieldValue