Move to LookupControl3 for Globix

This commit is contained in:
Jonathan Jenne
2021-03-22 15:58:20 +01:00
parent a34c29d8e2
commit 21bf3a7d32
7 changed files with 170 additions and 34 deletions

View File

@@ -67,10 +67,7 @@ Public Class GlobixControls
Try
Dim oSql As String = sql_Vorschlag
Dim oConnectionString As String
Dim oControl As New DigitalData.Controls.LookupGrid.LookupControl2 With {
.Multiselect = Multiselect,
.AllowAddNewValues = AddNewValues,
.PreventDuplicates = PreventDuplicateValues,
Dim oControl As New LookupControl3 With {
.Location = New Point(11, y),
.Size = New Size(300, 27),
.Name = "cmbMulti" & indexname,
@@ -79,6 +76,10 @@ Public Class GlobixControls
.IndexType = DataType
}
}
oControl.Properties.MultiSelect = Multiselect
oControl.Properties.AllowAddNewValues = AddNewValues
oControl.Properties.PreventDuplicates = PreventDuplicateValues
oControl.Properties.AppearanceFocused.BackColor = Color.LightGray
If Not String.IsNullOrEmpty(Vorgabe) Then
@@ -95,10 +96,10 @@ Public Class GlobixControls
Select(Function(item) item.Trim()).
ToList()
End If
oControl.SelectedValues = oDefaultValues
oControl.Properties.SelectedValues = oDefaultValues
End If
AddHandler oControl.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged
AddHandler oControl.Properties.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged
oConnectionString = My.Database.Get_ConnectionStringforID(conid)
@@ -109,7 +110,7 @@ Public Class GlobixControls
_Logger.Debug("sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False)
Else
Dim oDatatable = My.Database.GetDatatableWithConnection(oSql, oConnectionString)
oControl.DataSource = oDatatable
oControl.Properties.DataSource = oDatatable
End If
Else
_Logger.Warn("Connection String for control [{0}] is empty!", oControl.Name)
@@ -124,7 +125,7 @@ Public Class GlobixControls
End Try
End Function
Private Sub Lookup_SelectedValuesChanged(sender As LookupControl2, SelectedValues As List(Of String))
Private Sub Lookup_SelectedValuesChanged(sender As LookupControl3, SelectedValues As List(Of String))
PrepareDependingControl(sender)
End Sub
@@ -476,9 +477,9 @@ Public Class GlobixControls
DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue
End If
End If
Case GetType(LookupControl2).Name
Case GetType(LookupControl3).Name
_Logger.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable
DirectCast(oFoundControl, LookupControl3).Properties.DataSource = oDatatable
Case GetType(ComboBox).Name
_Logger.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, ComboBox).DataSource = oDatatable

View File

@@ -216,22 +216,22 @@ Public Class GlobixPatterns
_Logger.Error(ex)
_Logger.Warn("Control Value for CheckBox [{0}] could not be retrieved!", oFoundControl.Name)
End Try
ElseIf TypeOf oFoundControl Is LookupControl2 Then
ElseIf TypeOf oFoundControl Is LookupControl3 Then
Try
Dim oLookupControl = DirectCast(oFoundControl, LookupControl2)
Dim oLookupControl = DirectCast(oFoundControl, LookupControl3)
If oLookupControl.MultiSelect Then
If oLookupControl.Properties.MultiSelect Then
Select Case oFoundType
Case "INTEGER"
oValue = String.Join(",", oLookupControl.SelectedValues)
oValue = String.Join(",", oLookupControl.Properties.SelectedValues)
Case "VARCHAR"
Dim oWrapped = oLookupControl.SelectedValues
Dim oWrapped = oLookupControl.Properties.SelectedValues
oValue = String.Join(",", oWrapped)
Case Else
_Logger.Warn("Lookup Control with [{0}] is not supported!", oFoundType)
End Select
Else
oValue = NotNull(oLookupControl.SelectedValues.Item(0), "")
oValue = NotNull(oLookupControl.Properties.SelectedValues.Item(0), "")
End If
Catch ex As Exception
_Logger.Error(ex)

View File

@@ -574,9 +574,9 @@ Public Class frmGlobix_Index
DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue
End If
End If
Case GetType(LookupControl2).Name
Case GetType(LookupControl3).Name
_Logger.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable
DirectCast(oFoundControl, LookupControl3).Properties.DataSource = oDatatable
Case GetType(ComboBox).Name
_Logger.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, ComboBox).DataSource = oDatatable
@@ -587,7 +587,7 @@ Public Class frmGlobix_Index
_Logger.Error(ex)
End Try
End Sub
Private Function GetLookupData(pLookup As LookupControl2, pSQLCommand As String, pConnectionId As Integer)
Private Function GetLookupData(pLookup As LookupControl3, pSQLCommand As String, pConnectionId As Integer)
Dim oConnectionString = GetConnectionString(pConnectionId)
If oConnectionString IsNot Nothing And pSQLCommand.Length > 0 Then
@@ -1673,8 +1673,8 @@ Public Class frmGlobix_Index
End If
If oControl.Name.StartsWith("cmbMulti") Then
Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl2)
Dim values As List(Of String) = oLookup.SelectedValues
Dim oLookup = DirectCast(oControl, LookupControl3)
Dim values As List(Of String) = oLookup.Properties.SelectedValues
If values.Count = 0 Then
Dim oIndexName = Replace(oLookup.Name, "cmbMulti", "")