//////////////////////////////////////////////////////////////////////// // METHOD: SetExtendedPropertyValues private bool SetExtendedPropertyValues(IJTXAuxRecord childRecord, ExtendedPropertyIdentifier exPropIdentifier) { int fieldIndex = GetFieldIndex(childRecord, exPropIdentifier); childRecord.set_Data(fieldIndex, exPropIdentifier.Value); childRecord.Store(); return(true); }
//////////////////////////////////////////////////////////////////////// // METHOD: GetFieldIndex private int GetFieldIndex(IJTXAuxRecord record, ExtendedPropertyIdentifier exPropIdentifier) { for (int i = 0; i < record.Count; i++) { string propertyName = record.get_PropName(i).ToUpper(); if (propertyName.Equals(exPropIdentifier.FieldName.ToUpper())) { return(i); } } throw new Exception("Unable to find field name " + exPropIdentifier.FieldName + " in " + exPropIdentifier.TableName); }
//////////////////////////////////////////////////////////////////////// // METHOD: CreateExtendedPropertyRecord private bool CreateExtendedPropertyRecord(IJTXJob job, ExtendedPropertyIdentifier child) { IJTXAuxProperties pAuxProps = (IJTXAuxProperties)job; IJTXAuxRecordContainer pAuxContainer = pAuxProps.GetRecordContainer(child.LongTableName); if (!string.IsNullOrEmpty(m_paramExtendedProperties) && pAuxContainer == null) { string msg = string.Format( "Unable to set extended property for child job {0}. Unable to find child job's extended property table: {1}", job.ID, child.LongTableName); m_ipDatabase.LogMessage(3, 2000, msg); } System.Array contNames = pAuxProps.ContainerNames; System.Collections.IEnumerator contNamesEnum = contNames.GetEnumerator(); contNamesEnum.Reset(); while (contNamesEnum.MoveNext()) { try { string strContainerName = (string)contNamesEnum.Current; if (!string.IsNullOrEmpty(m_paramExtendedProperties) && (strContainerName.ToUpper()).Equals(child.LongTableName.ToUpper())) { pAuxContainer = pAuxProps.GetRecordContainer(strContainerName); if (pAuxContainer.RelationshipType != esriRelCardinality.esriRelCardinalityOneToOne) { throw new Exception("The table relationship is not one-to-one."); } IJTXAuxRecord childRecord = pAuxContainer.GetRecords().get_Item(0);//pAuxContainer.CreateRecord(); SetExtendedPropertyValues(childRecord, child); JobUtilities.LogJobAction(m_ipDatabase, job, Constants.ACTTYPE_UPDATE_EXT_PROPS, "", null); } } catch (Exception ex) { string msg = string.Format( "Unable to create extended property {0} in record for jobid {1}. ERROR: {2}", child.FieldName, job.ID, ex.Message); m_ipDatabase.LogMessage(3, 2000, msg); } } return(true); }
//////////////////////////////////////////////////////////////////////// // METHOD: GetFieldIndex private int GetFieldIndex(IJTXAuxRecord record, ExtendedPropertyIdentifier exPropIdentifier) { for (int i = 0; i < record.Count; i++) { string propertyName = record.get_PropName(i).ToUpper(); if (propertyName.Equals(exPropIdentifier.FieldName.ToUpper())) { return i; } } throw new Exception("Unable to find field name " + exPropIdentifier.FieldName + " in " + exPropIdentifier.TableName); }
//////////////////////////////////////////////////////////////////////// // METHOD: SetExtendedPropertyValues private bool SetExtendedPropertyValues(IJTXAuxRecord childRecord, ExtendedPropertyIdentifier exPropIdentifier) { int fieldIndex = GetFieldIndex(childRecord, exPropIdentifier); childRecord.set_Data(fieldIndex, exPropIdentifier.Value); childRecord.Store(); return true; }