Replace Profile Combobox with SearchLookupEdit

This commit is contained in:
Jonathan Jenne
2022-01-19 14:33:16 +01:00
parent 8227971743
commit ea3f898172
2 changed files with 89 additions and 62 deletions

View File

@@ -11,6 +11,7 @@ Imports DigitalData.GUIs.GlobalIndexer
Imports DevExpress.XtraEditors.Controls
Imports Limilabs.Mail
Imports Limilabs.Mail.Headers
Imports DevExpress.XtraEditors
Public Class frmIndex
#Region "+++++ Variablen ++++++"
@@ -455,7 +456,7 @@ Public Class frmIndex
End If
End If
If oControl.Name.StartsWith("chk") Then
Dim chk As CheckBox = oControl
Dim chk As CheckEdit = oControl
Indexwert_Postprocessing(Replace(chk.Name, "chk", ""), chk.Checked)
oResult = True
End If
@@ -1667,20 +1668,22 @@ Public Class frmIndex
checkItemPreselection.Checked = True
If CURRENT_LASTDOKART <> "" Then
Dim oFoundDocType = ComboboxDoctype.Properties.Items.
Dim oFoundDocType = ComboboxDoctype.Properties.DataSource.
Cast(Of DocType)().
Where(Function(dt) dt.Name = CURRENT_LASTDOKART).
FirstOrDefault()
If oFoundDocType IsNot Nothing Then
ComboboxDoctype.SelectedItem = oFoundDocType
ComboboxDoctype.EditValue = oFoundDocType
End If
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART)
End If
End If
If ComboboxDoctype.SelectedItem Is Nothing And DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then
If ComboboxDoctype.EditValue Is Nothing And DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then
For Each oRoW As DataRow In DTTBGI_REGEX_DOCTYPE.Rows
Dim oOnlyFilename = Path.GetFileName(CURRENT_WORKFILE)
If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then
@@ -1689,13 +1692,13 @@ Public Class frmIndex
_Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename)
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(oRoW.Item("DOCTYPE"))
Dim oFoundDocType = ComboboxDoctype.Properties.Items.
Cast(Of DocType)().
Dim oDoctypes As List(Of DocType) = ComboboxDoctype.Properties.DataSource
Dim oFoundDocType As DocType = oDoctypes.
Where(Function(dt) dt.Guid = oRoW.Item("DOCTYPE_ID")).
FirstOrDefault()
If oFoundDocType IsNot Nothing Then
ComboboxDoctype.SelectedItem = oFoundDocType
ComboboxDoctype.EditValue = oFoundDocType
Exit For
End If
End If
@@ -1717,24 +1720,23 @@ Public Class frmIndex
'cmbDokumentart.AutoCompleteSource = AutoCompleteSource.ListItems
'cmbDokumentart.SelectedIndex = -1
ComboboxDoctype.Properties.Items.Clear()
Dim oDocTypeList As New List(Of DocType)
For Each oRow As DataRow In oDoctypes.Rows
Dim oDocType = New DocType With {.Guid = oRow.Item("DOCTYPE_ID"), .Name = oRow.Item("DOCTYPE")}
ComboboxDoctype.Properties.Items.Add(oDocType)
oDocTypeList.Add(oDocType)
Next
ComboboxDoctype.SelectedIndex = -1
ComboboxDoctype.Properties.DataSource = oDocTypeList
' ComboboxDoctype.SelectedIndex = -1
Catch ex As Exception
ShowErrorMessage(ex, "Refresh_Dokart")
End Try
End Sub
Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboboxDoctype.SelectedIndexChanged
If ComboboxDoctype.SelectedIndex <> -1 And FormLoaded = True Then
Dim oSelectedItem As DocType = ComboboxDoctype.SelectedItem
Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboboxDoctype.EditValueChanged
If ComboboxDoctype.EditValue IsNot Nothing And FormLoaded = True Then
Dim oSelectedItem As DocType = ComboboxDoctype.EditValue
CURRENT_DOKART_ID = oSelectedItem.Guid
@@ -1763,7 +1765,7 @@ Public Class frmIndex
End If
MsgBox(oMessage, MsgBoxStyle.Information, Text)
ComboboxDoctype.SelectedIndex = -1
ComboboxDoctype.EditValue = Nothing
Else
WDDirect = oDocType.Item("WINDREAM_DIRECT")
CURRENT_DOKART_DUPLICATE_HANDLING = oDocType.Item("DUPLICATE_HANDLING")
@@ -1855,7 +1857,7 @@ Public Class frmIndex
Select Case oDataType
Case ClassConstants.INDEX_TYPE_BOOLEAN
Dim chk As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, DefaultValue, oRow.Item("COMMENT").ToString)
Dim chk As CheckEdit = oControls.AddCheckBox(oControlName, oControlPosition, DefaultValue, oRow.Item("COMMENT").ToString)
If Not IsNothing(chk) Then
pnlIndex.Controls.Add(chk)
End If
@@ -2042,9 +2044,9 @@ Public Class frmIndex
oLookupControl.Properties.ValueMember = oDatatable.Columns.Item(0).ColumnName
oLookupControl.Properties.DisplayMember = oDatatable.Columns.Item(0).ColumnName
End If
Case GetType(ComboBox).Name
Case GetType(Windows.Forms.ComboBox).Name
LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, ComboBox).DataSource = oDatatable
DirectCast(oFoundControl, Windows.Forms.ComboBox).DataSource = oDatatable
Case Else
LOGGER.Debug("Could not set depending control result for [{0}]", oFoundControl.GetType.Name)
End Select
@@ -2176,7 +2178,7 @@ Public Class frmIndex
If oSqlResult <> String.Empty Then
_Logger.Debug("oSqlResult after Replace [" & oSqlResult & "]")
End If
' Ergebnis: Es wurden alle einfachen Platzhalter ersetzt, jetzt haben wir einen SQL Befehl,
' Ergebnis: Es wurden alle einfachen Platzhalter ersetz't, jetzt haben wir einen SQL Befehl,
' der nur noch vektorfelder-platzhalter enthält
' 2. Schritt: Vektorfelder ersetzen
@@ -2259,7 +2261,7 @@ Public Class frmIndex
_Logger.Debug("Manuelle Indexe geladen")
If MyDataset.VWDDINDEX_MAN.Rows.Count > 0 Then
Dim oDokart As DocType = ComboboxDoctype.SelectedItem
Dim oDokart As DocType = ComboboxDoctype.EditValue
CURRENT_DOKART_ID = oDokart.Guid
If CheckWrite_IndexeMan(oDokart.Guid) = True Then