public override void Errors(List <Error> list, EsriTable table) { // This controller must be assigned to a FeatureClass FeatureClass featureClass = table as FeatureClass; if (table.GetType() != typeof(FeatureClass)) { list.Add(new ErrorObject(this, table, "A geometric network controller is ONLY supported in FeatureClasses", ErrorType.Error)); } // GeometricNetwork Name if (string.IsNullOrEmpty(this._geometricNetworkName)) { list.Add(new ErrorObject(this, table, "The controller property 'GeometricNetworkName' can not be empty", ErrorType.Error)); } else { GeometricNetwork geometricNetwork = DiagrammerEnvironment.Default.SchemaModel.FindGeometricNetwork(this._geometricNetworkName); if (geometricNetwork == null) { string message = string.Format("The geometric network [{0}] referenced in the controller does not exist", this._geometricNetworkName); list.Add(new ErrorObject(this, table, message, ErrorType.Error)); } } // Enabled Field Cannot be NULL/Empty if (string.IsNullOrEmpty(this._enabledFieldName)) { list.Add(new ErrorObject(this, table, "The controller property 'EnabledFieldName' can not be empty", ErrorType.Error)); } else { if (featureClass != null) { Field field = featureClass.FindField(this._enabledFieldName); if (field == null) { string message = string.Format("The geometric network controller cannot find 'enabled field' [{0}] in the featureclass [{1}]", this._enabledFieldName, featureClass.Name); list.Add(new ErrorObject(this, table, message, ErrorType.Error)); } else { if (field.FieldType != esriFieldType.esriFieldTypeSmallInteger) { string message = string.Format("The geometric network controller references an 'enabled field' [{0}] in the featureclass [{1}] that is not a 'Short Integer'", this._enabledFieldName, featureClass.Name); list.Add(new ErrorObject(this, table, message, ErrorType.Error)); } } } } // Ancillary Role / Ancillary Role Field switch (this._networkClassAncillaryRole) { case esriNetworkClassAncillaryRole.esriNCARNone: if (!string.IsNullOrEmpty(this._ancillaryRoleFieldName)) { string message = string.Format("The ancillary role field name should be empty if the role (in a geometric network controller) is set to none."); list.Add(new ErrorObject(this, table, message, ErrorType.Error)); } break; case esriNetworkClassAncillaryRole.esriNCARSourceSink: if (string.IsNullOrEmpty(this._ancillaryRoleFieldName)) { string message = string.Format("The ancillary role field name can not be empty for this role in a geometric network controller"); list.Add(new ErrorObject(this, table, message, ErrorType.Error)); } else { if (featureClass != null) { Field field = featureClass.FindField(this._ancillaryRoleFieldName); if (field == null) { string message = string.Format("The geometric network controller cannot find 'ancillary role field' [{0}] in the featureclass [{1}]", this._ancillaryRoleFieldName, featureClass.Name); list.Add(new ErrorObject(this, table, message, ErrorType.Error)); } else { if (field.FieldType != esriFieldType.esriFieldTypeSmallInteger) { string message = string.Format("The geometric network controller references an 'ancillary role field' [{0}] in the featureclass [{1}] that is not a 'Short Integer'", this._ancillaryRoleFieldName, featureClass.Name); list.Add(new ErrorObject(this, table, message, ErrorType.Error)); } } } } break; } }