TaskFlow/app/DD_PM_WINDREAM/ModuleFinalIndexProperties.vb

180 lines
6.5 KiB
VB.net

Imports System.ComponentModel
Imports System.Drawing.Design
Imports System.Globalization
Imports FormsUtils
Module ModuleFinalIndexProperties
<TypeConverter(GetType(PropertiesDeluxeTypeConverter))>
Public Class FinalIndexProperties
<Category("Information")>
<[ReadOnly](True)>
Public Property GUID As Integer
<Category("Information")>
<[ReadOnly](True)>
Public Property ConnectionId As Integer
<Category("Sonstiges")>
Public Property Description As String
<Category("Sonstiges")>
Public Property Active As Boolean
<Category("Sonstiges")>
Public Property Sequence As Integer = 0
<Category("Sonstiges")>
Public Property ContinueOnIndifferentState As Boolean
''' <summary>
''' Eigenschaft, die den SQL Editor anzeigt
''' </summary>
<Category("Daten - SQL")>
Public Property SQLCommand As SQLValue
' Eigenschaften für die verschiedenen Index-Typen
<DisplayName("Value")>
<Category("Daten - Fester Wert")>
<PropertyAttributesProvider("IndexTypeStringProvider")>
Public Property StringValue As String
<DisplayName("Value")>
<Category("Daten - Fester Wert")>
<PropertyAttributesProvider("IndexTypeBooleanProvider")>
Public Property BoolValue As Boolean
<DisplayName("Value")>
<Category("Daten - Fester Wert")>
<PropertyAttributesProvider("IndexTypeFloatProvider")>
Public Property FloatValue As Double
<DisplayName("Value")>
<Category("Daten - Fester Wert")>
<PropertyAttributesProvider("IndexTypeDateProvider")>
Public Property DateValue As Date
<DisplayName("Value")>
<Category("Daten - Fester Wert")>
<PropertyAttributesProvider("IndexTypeIntegerProvider")>
Public Property IntegerValue As Integer
<Category("Index")>
<TypeConverter(GetType(IndexListConverter))>
Public Property IndexName As String
<Category("Index")>
<[ReadOnly](True)>
Public Property VectorIndex As Boolean
<Category("Index")>
<DisplayName("Allow Multivalues")>
<PropertyAttributesProvider("VectorIndexBooleanProvider")>
Public Property AllowAddNewValues As Boolean
<Category("Index")>
<DisplayName("IndexBehaviour")>
<TypeConverter(GetType(ClassVectorBehaviourListConverter))>
<PropertyAttributesProvider("VectorIndexOnlyProvider")>
Public Property VectorBehaviour As String
<Category("Index")>
<PropertyAttributesProvider("VectorIndexBooleanProvider")>
Public Property PreventDuplicates As Boolean
' Eigenschaften für die Liste der Indicies
<Browsable(False)>
Public Property Indicies As List(Of String)
<Browsable(False)>
Public Property IndiciesType As List(Of Integer)
<Browsable(False)>
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