Imports System.ComponentModel Imports System.Drawing.Design Imports System.Globalization Imports FormsUtils Module ModuleFinalIndexProperties Public Class FinalIndexProperties <[ReadOnly](True)> Public Property GUID As Integer <[ReadOnly](True)> Public Property ConnectionId As Integer Public Property Description As String Public Property Active As Boolean Public Property Sequence As Integer = 0 Public Property ContinueOnIndifferentState As Boolean ''' ''' Eigenschaft, die den SQL Editor anzeigt ''' Public Property SQLCommand As SQLValue ' Eigenschaften für die verschiedenen Index-Typen Public Property StringValue As String Public Property BoolValue As Boolean Public Property FloatValue As Double Public Property DateValue As Date Public Property IntegerValue As Integer Public Property IndexName As String <[ReadOnly](True)> Public Property VectorIndex As Boolean Public Property AllowAddNewValues As Boolean Public Property VectorBehaviour As String Public Property PreventDuplicates As Boolean ' Eigenschaften für die Liste der Indicies Public Property Indicies As List(Of String) Public Property IndiciesType As List(Of Integer) Public Property VectorBehaviourType As List(Of String) Public Sub VectorIndexBooleanProvider(attrs As PropertyAttributes) MaybeSetReadOnlyIfNotVectorIndex(attrs) End Sub Public Sub IndexTypeBooleanProvider(attrs As PropertyAttributes) MaybeSetBrowsable(attrs, {FINALINDICES.INDEX_TYPE_BOOLEAN, FINALINDICES.INDEX_TYPE_VECTOR_BOOLEAN}) MaybeSetReadOnlyIfSQLHasNoValue(attrs) End Sub Public Sub IndexTypeStringProvider(attrs As PropertyAttributes) MaybeSetBrowsable(attrs, {FINALINDICES.INDEX_TYPE_STRING, FINALINDICES.INDEX_TYPE_VECTOR_STRING}) MaybeSetReadOnlyIfSQLHasNoValue(attrs) End Sub Public Sub IndexTypeFloatProvider(attrs As PropertyAttributes) MaybeSetBrowsable(attrs, {FINALINDICES.INDEX_TYPE_FLOAT}) MaybeSetReadOnlyIfSQLHasNoValue(attrs) End Sub Public Sub IndexTypeIntegerProvider(attrs As PropertyAttributes) MaybeSetBrowsable(attrs, {FINALINDICES.INDEX_TYPE_INTEGER, FINALINDICES.INDEX_TYPE_VECTOR_INTEGER_64}) MaybeSetReadOnlyIfSQLHasNoValue(attrs) End Sub Public Sub IndexTypeDateProvider(attrs As PropertyAttributes) MaybeSetBrowsable(attrs, {FINALINDICES.INDEX_TYPE_DATE, FINALINDICES.INDEX_TYPE_VECTOR_DATE}) MaybeSetReadOnlyIfSQLHasNoValue(attrs) End Sub Public Sub VectorIndexOnlyProvider(attrs As PropertyAttributes) MaybeSetBrowsable(attrs, {FINALINDICES.INDEX_TYPE_VECTOR_STRING}) End Sub Public Sub MaybeSetReadOnlyIfSQLHasNoValue(attrs As PropertyAttributes) Dim hasSQLValue As Boolean = (SQLCommand.Value <> String.Empty) If hasSQLValue Then attrs.IsReadOnly = True Else attrs.IsReadOnly = False End If End Sub Public Sub MaybeSetReadOnlyIfNotVectorIndex(attrs As PropertyAttributes) ' Get index (position in array) for selected index (windream) Dim oIndex As Integer = Indicies.IndexOf(IndexName) If oIndex < 0 Then attrs.IsReadOnly = True Exit Sub End If ' get type of windream index Dim oType As Integer = IndiciesType.Item(oIndex) Dim oVectoryTypes = { FINALINDICES.INDEX_TYPE_VECTOR_DATE, FINALINDICES.INDEX_TYPE_VECTOR_BOOLEAN, FINALINDICES.INDEX_TYPE_VECTOR_INTEGER_64, FINALINDICES.INDEX_TYPE_VECTOR_INTEGER, FINALINDICES.INDEX_TYPE_VECTOR_STRING, FINALINDICES.INDEX_TYPE_VECTOR_CURRENCY, FINALINDICES.INDEX_TYPE_VECTOR_FLOAT, FINALINDICES.INDEX_TYPE_VECTOR_DATETIME } ' if type of index is not a vector, set attribute to read only If oVectoryTypes.Contains(oType) Then attrs.IsReadOnly = False Else attrs.IsReadOnly = True End If End Sub Public Sub MaybeSetBrowsable(attrs As PropertyAttributes, indexType As Integer()) Dim i As Integer = Indicies.IndexOf(IndexName) ' IndexName wurde nicth gefunden oder ist leerer/ungültiger String If i < 0 Then attrs.IsBrowsable = False Exit Sub End If Dim type As Integer = IndiciesType.Item(i) If indexType.Contains(type) Then attrs.IsBrowsable = True Else attrs.IsBrowsable = False End If End Sub End Class End Module