jj 20_01_16
This commit is contained in:
@@ -165,7 +165,7 @@
|
||||
Public Shared Function UpdateControl(control As Control, properties As Object)
|
||||
Try
|
||||
' Nach Typ den Update Befehl anpassen
|
||||
Dim CurrentType As String = control.GetType.Name
|
||||
Dim type As String = control.GetType.Name
|
||||
|
||||
Dim SQL As String
|
||||
Dim NAME As String
|
||||
@@ -181,6 +181,21 @@
|
||||
Dim SHOW_COLUMN As Integer
|
||||
Dim STATIC_LIST As String
|
||||
|
||||
' So sollte diese Funktion später mal aussehen :(
|
||||
'Select Case type
|
||||
' Case "TextBox"
|
||||
' NAME = properties.Name
|
||||
' MULTILINE = ClassConverter.BoolToInt(properties.Multiline)
|
||||
' COL_NAME = ClassConverter.ToStringOrDefault(properties.ColumnTitle)
|
||||
' DEFAULTVALUE = ClassConverter.ToStringOrDefault(properties.DefaultValue)
|
||||
' SHOW_COLUMN = ClassConverter.BoolToInt(properties.ShowColumn)
|
||||
' FORMAT_TYPE = properties.Format.ToString()
|
||||
' REQUIRED = ClassConverter.BoolToInt(properties.IsRequired)
|
||||
' READ_ONLY = ClassConverter.BoolToInt(properties.IsReadOnly)
|
||||
' SQLCommand = ClassConverter.SQLValueToString(properties.SQLCommand)
|
||||
'End Select
|
||||
|
||||
|
||||
NAME = properties.Name
|
||||
|
||||
If propExists(properties, "Multiline") Then
|
||||
@@ -195,34 +210,36 @@
|
||||
COL_NAME = String.Empty
|
||||
End If
|
||||
|
||||
If CurrentType = "RadioButton" AndAlso propExistsWithType(properties, "DefaultValue", GetType(Boolean)) Then
|
||||
If type = "RadioButton" Then
|
||||
DEFAULTVALUE = properties.DefaultValue
|
||||
ElseIf CurrentType = "CheckBox" AndAlso propExistsWithType(properties, "DefaultValue", GetType(Boolean)) Then
|
||||
ElseIf type = "CheckBox" Then
|
||||
DEFAULTVALUE = properties.DefaultValue
|
||||
ElseIf propExists(properties, "DefaultValue") Then
|
||||
ElseIf type = "CheckBox" Then
|
||||
DEFAULTVALUE = properties.DefaultValue
|
||||
Else
|
||||
DEFAULTVALUE = ""
|
||||
ElseIf type = "ComboBox" Then
|
||||
DEFAULTVALUE = properties.DefaultValue
|
||||
ElseIf type = "DateEdit" Then
|
||||
DEFAULTVALUE = ClassConverter.ToDateTimePickerOptionsOrDefault(properties.DefaultValue)
|
||||
End If
|
||||
|
||||
If CurrentType = "TextBox" OrElse
|
||||
CurrentType = "ComboBox" OrElse
|
||||
CurrentType = "CheckBox" OrElse
|
||||
CurrentType = "RadioButton" OrElse
|
||||
CurrentType = "CheckedListBoxControl" OrElse
|
||||
CurrentType = "ListBoxControl" Then
|
||||
If type = "TextBox" OrElse
|
||||
type = "ComboBox" OrElse
|
||||
type = "CheckBox" OrElse
|
||||
type = "RadioButton" OrElse
|
||||
type = "CheckedListBoxControl" OrElse
|
||||
type = "ListBoxControl" Then
|
||||
|
||||
SHOW_COLUMN = BoolToInt(properties.ShowColumn)
|
||||
Else
|
||||
SHOW_COLUMN = BoolToInt(True)
|
||||
End If
|
||||
|
||||
If CurrentType = "TextBox" AndAlso propExists(properties, "Format") Then
|
||||
If type = "TextBox" AndAlso propExists(properties, "Format") Then
|
||||
FORMAT_TYPE = properties.Format.ToString
|
||||
ElseIf CurrentType = "ComboBox" AndAlso propExists(properties, "Format") Then
|
||||
ElseIf type = "ComboBox" AndAlso propExists(properties, "Format") Then
|
||||
FORMAT_TYPE = properties.Format.ToString
|
||||
Else
|
||||
FORMAT_TYPE = EnumFormat.String.ToString
|
||||
FORMAT_TYPE = EnumFormatOptions.String.ToString
|
||||
End If
|
||||
|
||||
If propExists(properties, "IsRequired") Then
|
||||
|
||||
@@ -242,11 +242,11 @@ Module ClassControlProperties
|
||||
|
||||
<CategoryAttribute("Ansichtseinstellungen")>
|
||||
<DescriptionAttribute("Gibt das Format des Textes an.")>
|
||||
Public Property Format() As EnumFormat
|
||||
Public Property Format() As EnumFormatOptions
|
||||
Get
|
||||
Return _format
|
||||
End Get
|
||||
Set(value As EnumFormat)
|
||||
Set(value As EnumFormatOptions)
|
||||
_format = value
|
||||
End Set
|
||||
End Property
|
||||
@@ -267,15 +267,15 @@ Module ClassControlProperties
|
||||
|
||||
Private _master_data_id As Integer
|
||||
Private _static_list As String
|
||||
Private _format As EnumFormat
|
||||
Private _format As EnumFormatOptions
|
||||
|
||||
<CategoryAttribute("Ansichtseinstellungen")>
|
||||
<DescriptionAttribute("Gibt das Format des Textes an.")>
|
||||
Public Property Format() As EnumFormat
|
||||
Public Property Format() As EnumFormatOptions
|
||||
Get
|
||||
Return _format
|
||||
End Get
|
||||
Set(value As EnumFormat)
|
||||
Set(value As EnumFormatOptions)
|
||||
_format = value
|
||||
End Set
|
||||
End Property
|
||||
@@ -304,6 +304,20 @@ Module ClassControlProperties
|
||||
End Class
|
||||
Public Class DateTimePickerProperties
|
||||
Inherits InputControlProperties
|
||||
|
||||
Private _default_value As EnumDateTimePickerDefaultValueOptions = EnumDateTimePickerDefaultValueOptions.Empty
|
||||
|
||||
<CategoryAttribute("Sonstige Einstellungen")>
|
||||
<DescriptionAttribute("Gibt den Standardwert dieses Elements an.")>
|
||||
Public Overloads Property DefaultValue() As EnumDateTimePickerDefaultValueOptions
|
||||
Get
|
||||
Return _default_value
|
||||
End Get
|
||||
Set(value As EnumDateTimePickerDefaultValueOptions)
|
||||
_default_value = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Class
|
||||
Public Class CheckBoxProperties
|
||||
Inherits InputControlProperties
|
||||
|
||||
@@ -345,11 +345,25 @@ Public Class ClassControlValues
|
||||
End If
|
||||
Case GetType(DevExpress.XtraEditors.DateEdit)
|
||||
Dim datepicker As DevExpress.XtraEditors.DateEdit = DirectCast(control, DevExpress.XtraEditors.DateEdit)
|
||||
If IsDBNull(autoValue) OrElse autoValue = "" OrElse autoValue = "False" Then
|
||||
autoValue = Now
|
||||
|
||||
Dim result As EnumDateTimePickerDefaultValueOptions = EnumDateTimePickerDefaultValueOptions.Empty
|
||||
Dim success = [Enum].TryParse(Of EnumDateTimePickerDefaultValueOptions)(autoValue, result)
|
||||
|
||||
If success Then
|
||||
If result = EnumDateTimePickerDefaultValueOptions.Empty Then
|
||||
' DBNull.Value leert das DateEdit control.
|
||||
autoValue = DBNull.Value
|
||||
ElseIf result = EnumDateTimePickerDefaultValueOptions.CurrentDate Then
|
||||
autoValue = Now
|
||||
End If
|
||||
Else
|
||||
'Wenn der DefaultWert nicht gelesen werden konnte, DateEdit leeren
|
||||
autoValue = DBNull.Value
|
||||
End If
|
||||
|
||||
datepicker.DateTime = autoValue
|
||||
' Mit EditValue kann man auch den angezeigten Wert leeren
|
||||
'datepicker.DateTime = autoValue
|
||||
datepicker.EditValue = autoValue
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in LoadDefaultValue:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
Public Class ClassControlValuesConverter
|
||||
Public Shared Function ToBooleanOrDefault(value As Object, Optional defaultValue As Boolean = False)
|
||||
Try
|
||||
If IsDBNull(value) OrElse value = "" Then
|
||||
Return defaultValue
|
||||
Else
|
||||
Return Convert.ToBoolean(value)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return defaultValue
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function ToStringOrDefault(value As Object, Optional defaultValue As String = "")
|
||||
Try
|
||||
If IsDBNull(value) OrElse String.IsNullOrEmpty(value) Then
|
||||
Return defaultValue
|
||||
Else
|
||||
Return Convert.ToString(value)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return defaultValue
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Function ToIntOrDefault(value As Object, Optional defaultValue As Integer = 0)
|
||||
Try
|
||||
If IsDBNull(value) Then
|
||||
Return defaultValue
|
||||
Else
|
||||
Return Convert.ToInt16(value)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return defaultValue
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
88
app/DD-Record-Organiser/ClassConverter.vb
Normal file
88
app/DD-Record-Organiser/ClassConverter.vb
Normal file
@@ -0,0 +1,88 @@
|
||||
Public Class ClassConverter
|
||||
|
||||
' ------------- STRING TO TYPE -------------
|
||||
|
||||
Public Shared Function ToBooleanOrDefault(value As Object, Optional defaultValue As Boolean = False)
|
||||
Try
|
||||
If IsDBNull(value) OrElse value = "" Then
|
||||
Return defaultValue
|
||||
Else
|
||||
Return Convert.ToBoolean(value)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return defaultValue
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function ToStringOrDefault(value As Object, Optional defaultValue As String = "")
|
||||
Try
|
||||
If IsDBNull(value) OrElse String.IsNullOrEmpty(value) Then
|
||||
Return defaultValue
|
||||
Else
|
||||
Return Convert.ToString(value)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return defaultValue
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Function ToIntOrDefault(value As Object, Optional defaultValue As Integer = 0)
|
||||
Try
|
||||
If IsDBNull(value) Then
|
||||
Return defaultValue
|
||||
Else
|
||||
Return Convert.ToInt16(value)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return defaultValue
|
||||
End Try
|
||||
End Function
|
||||
|
||||
' ------------- TYPE TO TYPE -------------
|
||||
|
||||
Public Shared Function BoolToInt(bool As Boolean)
|
||||
Return IIf(bool, 1, 0)
|
||||
End Function
|
||||
|
||||
Public Shared Function IntToBoolOrDefault(int As Integer, Optional defaultValue As Boolean = False)
|
||||
If int = 0 Then
|
||||
Return False
|
||||
ElseIf int = 1 Then
|
||||
Return True
|
||||
Else
|
||||
Return defaultValue
|
||||
End If
|
||||
End Function
|
||||
|
||||
' ------------- STRING TO ENUM -------------
|
||||
|
||||
Public Shared Function ToDateTimePickerOptionsOrDefault(value As String)
|
||||
Try
|
||||
If IsDBNull(value) OrElse String.IsNullOrEmpty(value) Then
|
||||
Return EnumDateTimePickerDefaultValueOptions.Empty
|
||||
Else
|
||||
Dim result As EnumDateTimePickerDefaultValueOptions
|
||||
Dim success = [Enum].TryParse(Of EnumDateTimePickerDefaultValueOptions)(value, result)
|
||||
|
||||
If success Then
|
||||
Return result
|
||||
Else
|
||||
Return EnumDateTimePickerDefaultValueOptions.Empty
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return EnumDateTimePickerDefaultValueOptions.Empty
|
||||
End Try
|
||||
End Function
|
||||
|
||||
' ------------- TYPE TO STRING -------------
|
||||
|
||||
Public Shared Function SQLValueToString(value As SQLValue) As String
|
||||
Dim cmd As String = value.Value
|
||||
If cmd.Contains("'") Then
|
||||
cmd = cmd.Replace("'", "''")
|
||||
End If
|
||||
Return cmd
|
||||
End Function
|
||||
End Class
|
||||
@@ -248,7 +248,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="ClassControlLoader.vb" />
|
||||
<Compile Include="ClassControlValueCache.vb" />
|
||||
<Compile Include="ClassControlValuesConverter.vb" />
|
||||
<Compile Include="ClassConverter.vb" />
|
||||
<Compile Include="ClassFolderWatcher.vb" />
|
||||
<Compile Include="ClassJumpRecord.vb" />
|
||||
<Compile Include="ClassLicence.vb" />
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
Module ModuleHelperMethods
|
||||
|
||||
Public Enum EnumFormat
|
||||
Public Enum EnumFormatOptions
|
||||
[String] = 0
|
||||
Currency = 1
|
||||
[Decimal] = 2
|
||||
End Enum
|
||||
|
||||
Public Enum EnumDateTimePickerDefaultValueOptions
|
||||
CurrentDate = 0
|
||||
Empty = 1
|
||||
End Enum
|
||||
|
||||
Public Function BoolToInt(bool As Boolean) As Integer
|
||||
' Wandelt einen Boolean Wert in einen Int um
|
||||
Return IIf(bool, 1, 0)
|
||||
|
||||
@@ -23,6 +23,26 @@
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub LoadControlPropertiesNeu(ctrl As Control)
|
||||
Try
|
||||
'TODO: LoadControlProperties Neuschreiben!!!
|
||||
Dim sql As String = String.Format("SELECT * FROM VWPMO_CONTROL_SCREEN WHERE CONTROL_ID = {0}", ctrl.Tag)
|
||||
Dim dt As DataTable = ClassDatabase.Execute_Scalar(sql)
|
||||
Dim props As Object = Nothing
|
||||
Dim row As DataRow = Nothing
|
||||
|
||||
If dt.Rows.Count <> 1 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
row = dt.Rows(0)
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in loadcontrolproperties" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
' ADDED 25.11
|
||||
' Lade Control Eigenschaften und zeige diese an
|
||||
' Wird von frmLevelDesigner aufgerufen
|
||||
@@ -52,48 +72,32 @@
|
||||
props.Caption = row.Item("CTRLSCR_CAPTION")
|
||||
Case "Textbox"
|
||||
props = New TextBoxProperties()
|
||||
If Not IsDBNull(row.Item("CONTROL_DEF_VALUE")) Then
|
||||
props.DefaultValue = row.Item("CONTROL_DEF_VALUE")
|
||||
Else
|
||||
props.DefaultValue = ""
|
||||
End If
|
||||
props.DefaultValue = ClassConverter.ToStringOrDefault(row.Item("CONTROL_DEF_VALUE"))
|
||||
|
||||
If Not IsDBNull(row.Item("CONTROL_FORMAT_TYPE")) Then
|
||||
props.Format = DirectCast([Enum].Parse(GetType(EnumFormat), row.Item("CONTROL_FORMAT_TYPE")), Integer)
|
||||
props.Format = DirectCast([Enum].Parse(GetType(EnumFormatOptions), row.Item("CONTROL_FORMAT_TYPE")), Integer)
|
||||
Else
|
||||
props.Format = "String"
|
||||
End If
|
||||
Case "Combobox"
|
||||
props = New ComboBoxProperties()
|
||||
props.MasterDataId = row.Item("CTRLSCR_MASTER_DATA_ID")
|
||||
If Not IsDBNull(row.Item("CONTROL_DEF_VALUE")) Then
|
||||
props.DefaultValue = row.Item("CONTROL_DEF_VALUE")
|
||||
Else
|
||||
props.DefaultValue = ""
|
||||
End If
|
||||
props.DefaultValue = ClassConverter.ToStringOrDefault(row.Item("CONTROL_DEF_VALUE"))
|
||||
|
||||
If Not IsDBNull(row.Item("CONTROL_FORMAT_TYPE")) Then
|
||||
props.Format = DirectCast([Enum].Parse(GetType(EnumFormat), row.Item("CONTROL_FORMAT_TYPE")), Integer)
|
||||
props.Format = DirectCast([Enum].Parse(GetType(EnumFormatOptions), row.Item("CONTROL_FORMAT_TYPE")), Integer)
|
||||
Else
|
||||
props.Format = "String"
|
||||
End If
|
||||
|
||||
If Not IsDBNull(row.Item("CONTROL_STATIC_LIST")) Then
|
||||
props.StaticList = row.Item("CONTROL_STATIC_LIST")
|
||||
Else
|
||||
props.StaticList = ""
|
||||
End If
|
||||
props.StaticList = ClassConverter.ToStringOrDefault(row.Item("CONTROL_STATIC_LIST"))
|
||||
Case "Checkbox"
|
||||
props = New CheckBoxProperties()
|
||||
props.Caption = row.Item("CTRLSCR_CAPTION")
|
||||
|
||||
If IsDBNull(row.Item("CONTROL_DEF_VALUE")) Or row.Item("CONTROL_DEF_VALUE") = String.Empty Then
|
||||
props.DefaultValue = False
|
||||
Else
|
||||
props.DefaultValue = row.Item("CONTROL_DEF_VALUE")
|
||||
End If
|
||||
props.DefaultValue = ClassConverter.ToBooleanOrDefault(row.Item("CONTROL_DEF_VALUE"))
|
||||
Case "Datepicker"
|
||||
props = New DateTimePickerProperties()
|
||||
props.DefaultValue = ClassConverter.ToDateTimePickerOptionsOrDefault(row.Item("CONTROL_DEF_VALUE"))
|
||||
Case "Datagridview"
|
||||
props = New DataGridViewProperties()
|
||||
Case "Groupbox"
|
||||
@@ -105,33 +109,17 @@
|
||||
Case "RadioButton"
|
||||
props = New RadioButtonProperties()
|
||||
props.Caption = row.Item("CTRLSCR_CAPTION")
|
||||
|
||||
props.DefaultValue = ClassControlValuesConverter.ToBooleanOrDefault(row.Item("CONTROL_DEF_VALUE"))
|
||||
'If Not IsDBNull(row.Item("CONTROL_DEF_VALUE")) Then
|
||||
' props.DefaultValue = row.Item("CONTROL_DEF_VALUE")
|
||||
'Else
|
||||
' props.DefaultValue = False
|
||||
'End If
|
||||
props.DefaultValue = ClassConverter.ToBooleanOrDefault(row.Item("CONTROL_DEF_VALUE"))
|
||||
Case "F_AddAppointment"
|
||||
props = New FunctionAddAppointment()
|
||||
Case "F_AddFormData"
|
||||
props = New FunctionAddFormData()
|
||||
Case "CheckedListBox"
|
||||
props = New ComboBoxProperties()
|
||||
|
||||
If Not IsDBNull(row.Item("CONTROL_STATIC_LIST")) Then
|
||||
props.StaticList = row.Item("CONTROL_STATIC_LIST")
|
||||
Else
|
||||
props.StaticList = ""
|
||||
End If
|
||||
props.StaticList = ClassConverter.ToStringOrDefault(row.Item("CONTROL_STATIC_LIST"))
|
||||
Case "ListBox"
|
||||
props = New ComboBoxProperties()
|
||||
|
||||
If Not IsDBNull(row.Item("CONTROL_STATIC_LIST")) Then
|
||||
props.StaticList = row.Item("CONTROL_STATIC_LIST")
|
||||
Else
|
||||
props.StaticList = ""
|
||||
End If
|
||||
props.StaticList = ClassConverter.ToStringOrDefault(row.Item("CONTROL_STATIC_LIST"))
|
||||
Case Else
|
||||
MsgBox("Unknown control type " & type, MsgBoxStyle.Exclamation, "Error in LoadControlProperties:")
|
||||
End Select
|
||||
|
||||
Reference in New Issue
Block a user