/// <summary> /// Determines whether the specified field <paramref name="index" /> on the <paramref name="table" /> is editable by /// both ESRI and ArcFM. /// </summary> /// <param name="table">The object class.</param> /// <param name="index">The index.</param> /// <returns> /// <c>true</c> if the specified field index on the class is editable by both ESRI and ArcFM; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentNullException">table</exception> /// <exception cref="System.IndexOutOfRangeException"></exception> protected virtual bool IsEditable(IObjectClass table, int index) { if (table == null) { throw new ArgumentNullException("table"); } if (index < 0 || index > table.Fields.FieldCount - 1) { throw new IndexOutOfRangeException(); } IField field = table.Fields.Field[index]; if (field.Editable) { ISubtypes subtypes = (ISubtypes)table; if (!_FieldManagersByClassID.ContainsKey(table.ObjectClassID)) { _FieldManagersByClassID.Add(table.ObjectClassID, table.GetFieldManager(subtypes.DefaultSubtypeCode)); } IMMFieldManager fieldManager = _FieldManagersByClassID[table.ObjectClassID]; IMMFieldAdapter fieldAdapter = fieldManager.FieldByIndex(index); return(fieldAdapter.Editable); } return(false); }
/// <summary> /// Determines if the field manager contains the properties for the field strategy. /// </summary> /// <param name="pFieldManager">The field manager.</param> /// <returns> /// Any non-zero value returned here will equal true. This method is treated as boolean. /// </returns> public int Value(IMMFieldManager pFieldManager) { try { var valid = this.IsValid(pFieldManager); return(valid ? 1 : 0); } catch (Exception e) { Log.Error(e); } return(0); }
public void IMMConfigTopLevel_ChangeVisibility() { IFeatureClass testClass = base.GetTestClass(); Assert.IsNotNull(testClass); IMMConfigTopLevel configTopLevel = ConfigTopLevel.Instance; Assert.IsNotNull(configTopLevel); ISubtypes subtypes = (ISubtypes)testClass; IMMFieldManager fieldManager = testClass.GetFieldManager(subtypes.DefaultSubtypeCode); IMMFieldAdapter fieldAdapter = fieldManager.FieldByName(testClass.OIDFieldName); configTopLevel.ChangeVisibility(testClass, subtypes.DefaultSubtypeCode, false, testClass.OIDFieldName); Assert.IsFalse(fieldAdapter.Visible); }
/// <summary> /// Updates the field assigned the <paramref name="modelName" /> with the <paramref name="value" /> for the specified /// <paramref name="source" /> when the value is different than the original value. /// </summary> /// <param name="source">The row.</param> /// <param name="modelName">Name of the model.</param> /// <param name="value">The value.</param> /// <param name="throwException"> /// if set to <c>true</c> if an exception should be thrown when the model name is not /// assigned. /// </param> /// <param name="equalityComparer">if set to <c>true</c> when the changes need to be compared prior to updating.</param> /// <returns> /// Returns a <see cref="bool" /> representing <c>true</c> when the row updated; otherwise <c>false</c> /// </returns> /// <exception cref="ArgumentNullException">modelName</exception> /// <exception cref="IndexOutOfRangeException"></exception> /// <exception cref="MissingFieldModelNameException"></exception> public static bool Update(this IRow source, string modelName, object value, bool throwException, bool equalityComparer) { if (source == null) { return(false); } if (modelName == null) { throw new ArgumentNullException("modelName"); } int index = source.Table.GetFieldIndex(modelName, throwException); if (index == -1) { throw new IndexOutOfRangeException(); } IMMFieldManager fieldManager = source.GetFieldManager(); IMMFieldAdapter fieldAdapter = (fieldManager != null) ? fieldManager.FieldByIndex(index) : null; return(source.Update(index, value, equalityComparer, fieldAdapter)); }
/// <summary> /// Determines if the field manager contains the valid properties for the field strategy. /// </summary> /// <param name="fieldManager">The field manager.</param> /// <returns>Returns a <see cref="bool" /> representing <c>true</c> when valid; otherwise <c>false</c></returns> protected abstract bool IsValid(IMMFieldManager fieldManager);