use LookupControl3, fix double profile items in combobox, fix crashes

This commit is contained in:
Jonathan Jenne 2021-03-22 16:13:49 +01:00
parent f53f83e403
commit 271d38bd05
5 changed files with 122 additions and 106 deletions

View File

@ -59,71 +59,71 @@ Public Class ClassControls
PrepareDependingControl(sender) PrepareDependingControl(sender)
End Sub End Sub
Public Function AddVorschlag_ComboBox(indexname As String, y As Integer, conid As Integer, sql_Vorschlag As String, Multiselect As Boolean, DataType As String, Optional Vorgabe As String = "", Optional AddNewValues As Boolean = False, Optional PreventDuplicateValues As Boolean = False, Optional SQLSuggestion As Boolean = False) As Control 'Public Function AddVorschlag_ComboBox(indexname As String, y As Integer, conid As Integer, sql_Vorschlag As String, Multiselect As Boolean, DataType As String, Optional Vorgabe As String = "", Optional AddNewValues As Boolean = False, Optional PreventDuplicateValues As Boolean = False, Optional SQLSuggestion As Boolean = False) As Control
Try ' Try
Dim oSql As String = sql_Vorschlag ' Dim oSql As String = sql_Vorschlag
Dim oConnectionString As String ' Dim oConnectionString As String
Dim oControl As New DigitalData.Controls.LookupGrid.LookupControl2 With { ' Dim oControl As New DigitalData.Controls.LookupGrid.LookupControl3 With {
.MultiSelect = Multiselect, ' .MultiSelect = Multiselect,
.AllowAddNewValues = AddNewValues, ' .AllowAddNewValues = AddNewValues,
.PreventDuplicates = PreventDuplicateValues, ' .PreventDuplicates = PreventDuplicateValues,
.Location = New Point(11, y), ' .Location = New Point(11, y),
.Size = New Size(300, 27), ' .Size = New Size(300, 27),
.Name = "cmbMulti" & indexname, ' .Name = "cmbMulti" & indexname,
.Tag = New ControlMeta() With { ' .Tag = New ControlMeta() With {
.IndexName = indexname, ' .IndexName = indexname,
.IndexType = DataType ' .IndexType = DataType
} ' }
} ' }
oControl.Properties.AppearanceFocused.BackColor = Color.FromArgb(255, 214, 49) ' oControl.Properties.AppearanceFocused.BackColor = Color.FromArgb(255, 214, 49)
If Not String.IsNullOrEmpty(Vorgabe) Then ' If Not String.IsNullOrEmpty(Vorgabe) Then
Dim oDefaultValues As New List(Of String) ' Dim oDefaultValues As New List(Of String)
If Vorgabe.Contains(",") Then ' If Vorgabe.Contains(",") Then
oDefaultValues = Vorgabe. ' oDefaultValues = Vorgabe.
Split(",").ToList(). ' Split(",").ToList().
Select(Function(item) item.Trim()). ' Select(Function(item) item.Trim()).
ToList() ' ToList()
Else ' Else
oDefaultValues = Vorgabe. ' oDefaultValues = Vorgabe.
Split(ClassConstants.VECTORSEPARATOR).ToList(). ' Split(ClassConstants.VECTORSEPARATOR).ToList().
Select(Function(item) item.Trim()). ' Select(Function(item) item.Trim()).
ToList() ' ToList()
End If ' End If
oControl.SelectedValues = oDefaultValues ' oControl.SelectedValues = oDefaultValues
End If ' End If
AddHandler oControl.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged ' AddHandler oControl.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged
oConnectionString = ClassFormFunctions.GetConnectionString(conid) ' oConnectionString = ClassFormFunctions.GetConnectionString(conid)
If oConnectionString IsNot Nothing And oSql.Length > 0 And SQLSuggestion = True Then ' If oConnectionString IsNot Nothing And oSql.Length > 0 And SQLSuggestion = True Then
LOGGER.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30)) ' LOGGER.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30))
If ClassPatterns.HasComplexPatterns(oSql) Then ' If ClassPatterns.HasComplexPatterns(oSql) Then
LOGGER.Debug(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False) ' LOGGER.Debug(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False)
Else ' Else
oSql = ClassPatterns.ReplaceInternalValues(oSql) ' oSql = ClassPatterns.ReplaceInternalValues(oSql)
oSql = ClassPatterns.ReplaceUserValues(oSql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID) ' oSql = ClassPatterns.ReplaceUserValues(oSql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID)
Dim oDatatable = ClassDatabase.Return_Datatable_Combined(oSql, oConnectionString, False) ' Dim oDatatable = ClassDatabase.Return_Datatable_Combined(oSql, oConnectionString, False)
oControl.DataSource = oDatatable ' oControl.DataSource = oDatatable
End If ' End If
Else ' Else
LOGGER.Warn("Connection String for control [{0}] is empty!", oControl.Name) ' LOGGER.Warn("Connection String for control [{0}] is empty!", oControl.Name)
End If ' End If
Return oControl ' Return oControl
Catch ex As Exception ' Catch ex As Exception
LOGGER.Info(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message) ' LOGGER.Info(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message)
LOGGER.Error(ex) ' LOGGER.Error(ex)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in AddVorschlag_ComboBox:") ' MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in AddVorschlag_ComboBox:")
Return Nothing ' Return Nothing
End Try ' End Try
End Function '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) PrepareDependingControl(sender)
End Sub End Sub
@ -474,9 +474,9 @@ Public Class ClassControls
DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue
End If End If
End If End If
Case GetType(LookupControl2).Name Case GetType(LookupControl3).Name
LOGGER.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") 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 Case GetType(ComboBox).Name
LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, ComboBox).DataSource = oDatatable DirectCast(oFoundControl, ComboBox).DataSource = oDatatable

View File

@ -1,6 +1,7 @@
Imports System.Text.RegularExpressions Imports System.Text.RegularExpressions
Imports DevExpress.XtraEditors Imports DevExpress.XtraEditors
Imports DigitalData.Controls.LookupGrid Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIs.GlobalIndexer
Imports WINDREAMLib Imports WINDREAMLib
''' <summary> ''' <summary>
@ -184,7 +185,7 @@ Public Class ClassPatterns
Continue For Continue For
End If End If
Dim oMeta = TryCast(oControl.Tag, ClassControls.ControlMeta) Dim oMeta = TryCast(oControl.Tag, ControlCreator.ControlMeta)
LOGGER.Debug("Metadata IndexName: [{0}]", oMeta.IndexName) LOGGER.Debug("Metadata IndexName: [{0}]", oMeta.IndexName)
LOGGER.Debug("Metadata IndexType: [{0}]", oMeta.IndexType) LOGGER.Debug("Metadata IndexType: [{0}]", oMeta.IndexType)
@ -223,26 +224,26 @@ Public Class ClassPatterns
LOGGER.Error(ex) LOGGER.Error(ex)
LOGGER.Warn("Control Value for CheckBox [{0}] could not be retrieved!", oFoundControl.Name) LOGGER.Warn("Control Value for CheckBox [{0}] could not be retrieved!", oFoundControl.Name)
End Try End Try
ElseIf TypeOf oFoundControl Is LookupControl2 Then ElseIf TypeOf oFoundControl Is LookupControl3 Then
Try Try
Dim oLookupControl = DirectCast(oFoundControl, LookupControl2) Dim oLookupControl = DirectCast(oFoundControl, LookupControl3)
If oLookupControl.MultiSelect Then If oLookupControl.Properties.MultiSelect Then
Select Case oFoundType Select Case oFoundType
Case "INTEGER" Case "INTEGER"
oValue = String.Join(",", oLookupControl.SelectedValues) oValue = String.Join(",", oLookupControl.Properties.SelectedValues)
Case "VARCHAR" Case "VARCHAR"
Dim oWrapped = oLookupControl.SelectedValues Dim oWrapped = oLookupControl.Properties.SelectedValues
oValue = String.Join(",", oWrapped) oValue = String.Join(",", oWrapped)
Case Else Case Else
LOGGER.Warn("Lookup Control with [{0}] is not supported!", oFoundType) LOGGER.Warn("Lookup Control with [{0}] is not supported!", oFoundType)
End Select End Select
Else Else
oValue = NotNull(oLookupControl.SelectedValues.Item(0), "") oValue = NotNull(oLookupControl.Properties.SelectedValues.Item(0), "")
End If End If
Catch ex As Exception Catch ex As Exception
LOGGER.Error(ex) LOGGER.Error(ex)
LOGGER.Warn("Control Value for LookupControl2 [{0}] could not be retrieved!", oFoundControl.Name) LOGGER.Warn("Control Value for LookupControl3 [{0}] could not be retrieved!", oFoundControl.Name)
End Try End Try
Else Else
LOGGER.Debug("Unknown Control type for type [{0}], setting value to empty string.", oFoundControl.Name) LOGGER.Debug("Unknown Control type for type [{0}], setting value to empty string.", oFoundControl.Name)

View File

@ -31,7 +31,7 @@ Partial Class frmIndex
Dim SerializableAppearanceObject4 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() Dim SerializableAppearanceObject4 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
Me.pnlIndex = New System.Windows.Forms.Panel() Me.pnlIndex = New System.Windows.Forms.Panel()
Me.ComboBoxEdit1 = New DevExpress.XtraEditors.ComboBoxEdit() Me.ComboboxDoctype = New DevExpress.XtraEditors.ComboBoxEdit()
Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl()
Me.BarToggleSwitchItem1 = New DevExpress.XtraBars.BarToggleSwitchItem() Me.BarToggleSwitchItem1 = New DevExpress.XtraBars.BarToggleSwitchItem()
Me.BarToggleSwitchItem2 = New DevExpress.XtraBars.BarToggleSwitchItem() Me.BarToggleSwitchItem2 = New DevExpress.XtraBars.BarToggleSwitchItem()
@ -68,7 +68,7 @@ Partial Class frmIndex
Me.SplitContainer1.Panel1.SuspendLayout() Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout() Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout() Me.SplitContainer1.SuspendLayout()
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.ComboboxDoctype.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel2.SuspendLayout() Me.Panel2.SuspendLayout()
CType(Me.checkMultiindex.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.checkMultiindex.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
@ -87,7 +87,7 @@ Partial Class frmIndex
'SplitContainer1.Panel1 'SplitContainer1.Panel1
' '
Me.SplitContainer1.Panel1.Controls.Add(Me.pnlIndex) Me.SplitContainer1.Panel1.Controls.Add(Me.pnlIndex)
Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBoxEdit1) Me.SplitContainer1.Panel1.Controls.Add(Me.ComboboxDoctype)
Me.SplitContainer1.Panel1.Controls.Add(Me.Panel2) Me.SplitContainer1.Panel1.Controls.Add(Me.Panel2)
' '
'SplitContainer1.Panel2 'SplitContainer1.Panel2
@ -100,17 +100,17 @@ Partial Class frmIndex
Me.pnlIndex.BackColor = System.Drawing.SystemColors.ControlLight Me.pnlIndex.BackColor = System.Drawing.SystemColors.ControlLight
Me.pnlIndex.Name = "pnlIndex" Me.pnlIndex.Name = "pnlIndex"
' '
'ComboBoxEdit1 'ComboboxDoctype
' '
resources.ApplyResources(Me.ComboBoxEdit1, "ComboBoxEdit1") resources.ApplyResources(Me.ComboboxDoctype, "ComboboxDoctype")
Me.ComboBoxEdit1.MenuManager = Me.RibbonControl1 Me.ComboboxDoctype.MenuManager = Me.RibbonControl1
Me.ComboBoxEdit1.Name = "ComboBoxEdit1" Me.ComboboxDoctype.Name = "ComboboxDoctype"
SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer)) SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer))
SerializableAppearanceObject1.Options.UseBackColor = True SerializableAppearanceObject1.Options.UseBackColor = True
Me.ComboBoxEdit1.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines), resources.GetString("ComboBoxEdit1.Properties.Buttons1"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons2"), Integer), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons3"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons4"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons5"), Boolean), EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, resources.GetString("ComboBoxEdit1.Properties.Buttons6"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons7"), Object), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons8"), DevExpress.Utils.SuperToolTip), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons9"), DevExpress.Utils.ToolTipAnchor))}) Me.ComboboxDoctype.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines), resources.GetString("ComboBoxEdit1.Properties.Buttons1"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons2"), Integer), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons3"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons4"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons5"), Boolean), EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, resources.GetString("ComboBoxEdit1.Properties.Buttons6"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons7"), Object), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons8"), DevExpress.Utils.SuperToolTip), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons9"), DevExpress.Utils.ToolTipAnchor))})
Me.ComboBoxEdit1.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat Me.ComboboxDoctype.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat
Me.ComboBoxEdit1.Properties.NullText = resources.GetString("ComboBoxEdit1.Properties.NullText") Me.ComboboxDoctype.Properties.NullText = resources.GetString("ComboBoxEdit1.Properties.NullText")
Me.ComboBoxEdit1.Properties.Padding = New System.Windows.Forms.Padding(5) Me.ComboboxDoctype.Properties.Padding = New System.Windows.Forms.Padding(5)
' '
'RibbonControl1 'RibbonControl1
' '
@ -349,7 +349,7 @@ Partial Class frmIndex
Me.SplitContainer1.Panel2.ResumeLayout(False) Me.SplitContainer1.Panel2.ResumeLayout(False)
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer1.ResumeLayout(False) Me.SplitContainer1.ResumeLayout(False)
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.ComboboxDoctype.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.Panel2.ResumeLayout(False) Me.Panel2.ResumeLayout(False)
CType(Me.checkMultiindex.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.checkMultiindex.Properties, System.ComponentModel.ISupportInitialize).EndInit()
@ -403,5 +403,5 @@ Partial Class frmIndex
Friend WithEvents btnOK As DevExpress.XtraEditors.SimpleButton Friend WithEvents btnOK As DevExpress.XtraEditors.SimpleButton
Friend WithEvents checkMultiindex As DevExpress.XtraEditors.CheckEdit Friend WithEvents checkMultiindex As DevExpress.XtraEditors.CheckEdit
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
Friend WithEvents ComboBoxEdit1 As DevExpress.XtraEditors.ComboBoxEdit Friend WithEvents ComboboxDoctype As DevExpress.XtraEditors.ComboBoxEdit
End Class End Class

View File

@ -156,10 +156,10 @@
<data name="&gt;&gt;pnlIndex.ZOrder" xml:space="preserve"> <data name="&gt;&gt;pnlIndex.ZOrder" xml:space="preserve">
<value>0</value> <value>0</value>
</data> </data>
<data name="ComboBoxEdit1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> <data name="ComboboxDoctype.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value> <value>Top</value>
</data> </data>
<data name="ComboBoxEdit1.Location" type="System.Drawing.Point, System.Drawing"> <data name="ComboboxDoctype.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value> <value>0, 0</value>
</data> </data>
<data name="BarToggleSwitchItem1.Caption" xml:space="preserve"> <data name="BarToggleSwitchItem1.Caption" xml:space="preserve">
@ -466,22 +466,22 @@
<data name="ComboBoxEdit1.Properties.NullText" xml:space="preserve"> <data name="ComboBoxEdit1.Properties.NullText" xml:space="preserve">
<value>Bitte wählen Sie ein Profil</value> <value>Bitte wählen Sie ein Profil</value>
</data> </data>
<data name="ComboBoxEdit1.Size" type="System.Drawing.Size, System.Drawing"> <data name="ComboboxDoctype.Size" type="System.Drawing.Size, System.Drawing">
<value>636, 30</value> <value>636, 30</value>
</data> </data>
<data name="ComboBoxEdit1.TabIndex" type="System.Int32, mscorlib"> <data name="ComboboxDoctype.TabIndex" type="System.Int32, mscorlib">
<value>3</value> <value>3</value>
</data> </data>
<data name="&gt;&gt;ComboBoxEdit1.Name" xml:space="preserve"> <data name="&gt;&gt;ComboboxDoctype.Name" xml:space="preserve">
<value>ComboBoxEdit1</value> <value>ComboboxDoctype</value>
</data> </data>
<data name="&gt;&gt;ComboBoxEdit1.Type" xml:space="preserve"> <data name="&gt;&gt;ComboboxDoctype.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value> <value>DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data> </data>
<data name="&gt;&gt;ComboBoxEdit1.Parent" xml:space="preserve"> <data name="&gt;&gt;ComboboxDoctype.Parent" xml:space="preserve">
<value>SplitContainer1.Panel1</value> <value>SplitContainer1.Panel1</value>
</data> </data>
<data name="&gt;&gt;ComboBoxEdit1.ZOrder" xml:space="preserve"> <data name="&gt;&gt;ComboboxDoctype.ZOrder" xml:space="preserve">
<value>1</value> <value>1</value>
</data> </data>
<data name="checkMultiindex.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="checkMultiindex.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">

View File

@ -7,6 +7,7 @@ Imports System.Security.Principal
Imports System.DirectoryServices Imports System.DirectoryServices
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports DigitalData.Controls.LookupGrid Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIs.GlobalIndexer
Public Class frmIndex Public Class frmIndex
#Region "+++++ Variablen ++++++" #Region "+++++ Variablen ++++++"
@ -355,8 +356,8 @@ Public Class frmIndex
End If End If
If oControl.Name.StartsWith("cmbMulti") Then If oControl.Name.StartsWith("cmbMulti") Then
Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl2) Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3)
Dim values As List(Of String) = oLookup.SelectedValues Dim values As List(Of String) = oLookup.Properties.SelectedValues
If values.Count = 0 Then If values.Count = 0 Then
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'", MyConnectionString, True) Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'", MyConnectionString, True)
@ -1569,13 +1570,13 @@ Public Class frmIndex
checkItemPreselection.Checked = True checkItemPreselection.Checked = True
If CURRENT_LASTDOKART <> "" Then If CURRENT_LASTDOKART <> "" Then
Dim oFoundDocType = ComboBoxEdit1.Properties.Items. Dim oFoundDocType = ComboboxDoctype.Properties.Items.
Cast(Of DocType)(). Cast(Of DocType)().
Where(Function(dt) dt.Name = CURRENT_LASTDOKART). Where(Function(dt) dt.Name = CURRENT_LASTDOKART).
FirstOrDefault() FirstOrDefault()
If oFoundDocType IsNot Nothing Then If oFoundDocType IsNot Nothing Then
ComboBoxEdit1.SelectedItem = oFoundDocType ComboboxDoctype.SelectedItem = oFoundDocType
End If End If
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART) 'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART)
@ -1590,13 +1591,13 @@ Public Class frmIndex
_Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename) _Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename)
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(oRoW.Item("DOCTYPE")) 'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(oRoW.Item("DOCTYPE"))
Dim oFoundDocType = ComboBoxEdit1.Properties.Items. Dim oFoundDocType = ComboboxDoctype.Properties.Items.
Cast(Of DocType)(). Cast(Of DocType)().
Where(Function(dt) dt.Name = CURRENT_LASTDOKART). Where(Function(dt) dt.Name = CURRENT_LASTDOKART).
FirstOrDefault() FirstOrDefault()
If oFoundDocType IsNot Nothing Then If oFoundDocType IsNot Nothing Then
ComboBoxEdit1.SelectedItem = oFoundDocType ComboboxDoctype.SelectedItem = oFoundDocType
End If End If
Exit For Exit For
@ -1620,20 +1621,26 @@ Public Class frmIndex
'cmbDokumentart.AutoCompleteSource = AutoCompleteSource.ListItems 'cmbDokumentart.AutoCompleteSource = AutoCompleteSource.ListItems
'cmbDokumentart.SelectedIndex = -1 'cmbDokumentart.SelectedIndex = -1
ComboboxDoctype.Properties.Items.Clear()
For Each oRow As DataRow In oDoctypes.Rows For Each oRow As DataRow In oDoctypes.Rows
ComboBoxEdit1.Properties.Items.Add(New DocType With { ComboboxDoctype.Properties.Items.Add(New DocType With {
.Guid = oRow.Item("DOCTYPE_ID"), .Guid = oRow.Item("DOCTYPE_ID"),
.Name = oRow.Item("DOCTYPE") .Name = oRow.Item("DOCTYPE")
}) })
Next Next
ComboboxDoctype.SelectedIndex = -1
Catch ex As Exception Catch ex As Exception
ShowErrorMessage(ex, "Refresh_Dokart") ShowErrorMessage(ex, "Refresh_Dokart")
End Try End Try
End Sub End Sub
Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxEdit1.SelectedIndexChanged Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboboxDoctype.SelectedIndexChanged
If ComboBoxEdit1.SelectedIndex <> -1 And FormLoaded = True Then If ComboboxDoctype.SelectedIndex <> -1 And FormLoaded = True Then
Dim oSelectedItem As DocType = ComboBoxEdit1.SelectedItem Dim oSelectedItem As DocType = ComboboxDoctype.SelectedItem
CURRENT_DOKART_ID = oSelectedItem.Guid CURRENT_DOKART_ID = oSelectedItem.Guid
@ -1728,8 +1735,8 @@ Public Class frmIndex
' ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDokumentart.Text & " definiert") ' ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDokumentart.Text & " definiert")
'_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDokumentart.Text & " definiert") '_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDokumentart.Text & " definiert")
ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert") ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboboxDoctype.Text & " definiert")
_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert") _Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboboxDoctype.Text & " definiert")
End If End If
For Each oRow As DataRow In DT_INDEXEMAN.Rows For Each oRow As DataRow In DT_INDEXEMAN.Rows
@ -1823,7 +1830,7 @@ Public Class frmIndex
End Try End Try
End Sub 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 = ClassFormFunctions.GetConnectionString(pConnectionId) Dim oConnectionString = ClassFormFunctions.GetConnectionString(pConnectionId)
If oConnectionString IsNot Nothing And pSQLCommand.Length > 0 Then If oConnectionString IsNot Nothing And pSQLCommand.Length > 0 Then
@ -1851,7 +1858,7 @@ Public Class frmIndex
End If End If
Try Try
Dim oMeta = DirectCast(Control.Tag, ClassControls.ControlMeta) Dim oMeta = DirectCast(Control.Tag, ControlCreator.ControlMeta)
Dim oIndexName As String = oMeta.IndexName Dim oIndexName As String = oMeta.IndexName
Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%'" Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%'"
Dim oDatatable As DataTable = ClassDatabase.Return_Datatable(oSQL) Dim oDatatable As DataTable = ClassDatabase.Return_Datatable(oSQL)
@ -1897,7 +1904,7 @@ Public Class frmIndex
Continue For Continue For
End If End If
Dim oMeta = DirectCast(oControl.Tag, ClassControls.ControlMeta) Dim oMeta = DirectCast(oControl.Tag, ControlCreator.ControlMeta)
Dim oIndex As String = oMeta.IndexName Dim oIndex As String = oMeta.IndexName
If oIndex = IndexName Then If oIndex = IndexName Then
@ -1908,10 +1915,12 @@ Public Class frmIndex
If oFoundControl Is Nothing Then If oFoundControl Is Nothing Then
LOGGER.Warn("Depending Control for Index [{0}] not found!", IndexName) LOGGER.Warn("Depending Control for Index [{0}] not found!", IndexName)
Exit Sub
End If End If
If oDatatable Is Nothing Then If oDatatable Is Nothing Then
LOGGER.Warn("Error in SQL Command: {0}", SqlCommand) LOGGER.Warn("Error in SQL Command: {0}", SqlCommand)
Exit Sub
End If End If
Select Case oFoundControl.GetType.Name Select Case oFoundControl.GetType.Name
@ -1926,9 +1935,15 @@ Public Class frmIndex
DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue
End If End If
End If End If
Case GetType(LookupControl2).Name Case GetType(LookupControl3).Name
LOGGER.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") LOGGER.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable Dim oLookupControl = DirectCast(oFoundControl, LookupControl3)
oLookupControl.Properties.DataSource = oDatatable
If oDatatable.Columns.Count > 0 Then
oLookupControl.Properties.ValueMember = oDatatable.Columns.Item(0).ColumnName
oLookupControl.Properties.DisplayMember = oDatatable.Columns.Item(0).ColumnName
End If
Case GetType(ComboBox).Name Case GetType(ComboBox).Name
LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
DirectCast(oFoundControl, ComboBox).DataSource = oDatatable DirectCast(oFoundControl, ComboBox).DataSource = oDatatable
@ -2146,7 +2161,7 @@ Public Class frmIndex
_Logger.Debug("Manuelle Indexe geladen") _Logger.Debug("Manuelle Indexe geladen")
If MyDataset.VWDDINDEX_MAN.Rows.Count > 0 Then If MyDataset.VWDDINDEX_MAN.Rows.Count > 0 Then
Dim oDokart As DocType = ComboBoxEdit1.SelectedItem Dim oDokart As DocType = ComboboxDoctype.SelectedItem
CURRENT_DOKART_ID = oDokart.Guid CURRENT_DOKART_ID = oDokart.Guid
If CheckWrite_IndexeMan(oDokart.Guid) = True Then If CheckWrite_IndexeMan(oDokart.Guid) = True Then