add new lookupgrid
This commit is contained in:
parent
edc2402f5e
commit
c8e23e3ca0
@ -154,6 +154,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDMonorepo\Controls.DocumentViewer\bin\Debug\DigitalData.Controls.DocumentViewer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Controls.LookupGrid">
|
||||
<HintPath>..\..\DDMonorepo\Controls.LookupGrid\bin\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Config">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@ -531,140 +531,153 @@ Public Class frmIndex
|
||||
Else
|
||||
Dim table As DataTable = NewDataset.Tables(0)
|
||||
|
||||
If table.Rows.Count > 0 Then
|
||||
Dim columnCount = 1
|
||||
'If table.Rows.Count > 0 Then
|
||||
' Dim columnCount = 1
|
||||
|
||||
' Alle bis auf die erste Spalte der Tabelle entfernen
|
||||
While (table.Columns.Count > columnCount)
|
||||
table.Columns.RemoveAt(columnCount)
|
||||
End While
|
||||
'table.Columns.Item(0).ReadOnly = True
|
||||
' ' Alle bis auf die erste Spalte der Tabelle entfernen
|
||||
' While (table.Columns.Count > columnCount)
|
||||
' table.Columns.RemoveAt(columnCount)
|
||||
' End While
|
||||
' 'table.Columns.Item(0).ReadOnly = True
|
||||
|
||||
If Multiselect Then
|
||||
' Neue Spalte für Selektion einfügen
|
||||
Dim selectedColumn As New DataColumn() With {
|
||||
.ColumnName = "SELECTED",
|
||||
.DataType = GetType(Boolean),
|
||||
.DefaultValue = False
|
||||
}
|
||||
table.Columns.Add(selectedColumn)
|
||||
' Spalte an erste Stelle verschieben
|
||||
selectedColumn.SetOrdinal(0)
|
||||
End If
|
||||
|
||||
Const LOOKUP_NO_RECORDS As String = "Keine Datensätze ausgewählt"
|
||||
Const LOOKUP_N_RECORDS As String = "{0} Datensätze ausgewählt"
|
||||
Const LOOKUP_CONTROL_HEIGHT As Integer = 24
|
||||
|
||||
Dim lookupButton As New Button()
|
||||
lookupButton.Name = "btnLookup" & indexname
|
||||
lookupButton.Location = New Point(311, y - 1)
|
||||
lookupButton.Size = New Size(LOOKUP_CONTROL_HEIGHT, LOOKUP_CONTROL_HEIGHT)
|
||||
lookupButton.Image = My.Resources.gear_32xSM
|
||||
|
||||
pnlIndex.Controls.Add(lookupButton)
|
||||
|
||||
If Multiselect Then
|
||||
Dim listbox As New ListBox()
|
||||
Dim gridLookup As New DevExpress.XtraEditors.GridLookUpEdit()
|
||||
|
||||
gridLookup.Name = "cmbMulti" & indexname
|
||||
gridLookup.Font = New Font(gridLookup.Font.FontFamily, 10)
|
||||
gridLookup.Location = New Point(11, y)
|
||||
gridLookup.Size = New Size(300, LOOKUP_CONTROL_HEIGHT)
|
||||
|
||||
' TODO: Hier noch die Vorbelegung für Vektor Indexe einfügen
|
||||
gridLookup.Properties.PopupFormSize = New Size(gridLookup.Properties.PopupFormSize.Width, 100)
|
||||
gridLookup.Properties.NullText = LOOKUP_NO_RECORDS
|
||||
If Vorgabe.Length > 0 Then
|
||||
gridLookup.Properties.DataSource = New List(Of String) From {Vorgabe}
|
||||
gridLookup.Properties.NullText = String.Format(LOOKUP_N_RECORDS, 1)
|
||||
Else
|
||||
gridLookup.Properties.DataSource = Nothing
|
||||
gridLookup.Properties.NullText = LOOKUP_NO_RECORDS
|
||||
End If
|
||||
|
||||
|
||||
' Da das gridLookup ein Readonly Control sein soll,
|
||||
' sich aber trotzdem öffnen lassen soll, müssen wir so das setzen eines neuen Werts verhindern
|
||||
AddHandler gridLookup.EditValueChanging, Sub(sender As Object, e As ChangingEventArgs)
|
||||
e.Cancel = True
|
||||
End Sub
|
||||
|
||||
With gridLookup.Properties.View
|
||||
.OptionsBehavior.ReadOnly = True
|
||||
.OptionsBehavior.Editable = False
|
||||
.OptionsView.ShowColumnHeaders = False
|
||||
End With
|
||||
|
||||
AddHandler lookupButton.Click, Sub()
|
||||
Dim frm As New frmLookupGrid()
|
||||
frm.MultiSelect = True
|
||||
frm.DataSource = table
|
||||
frm.AddNewValues = AddNewValues
|
||||
frm.PreventDuplicates = PreventDuplicateValues
|
||||
frm.StartPosition = FormStartPosition.Manual
|
||||
frm.SelectedValues = gridLookup.Properties.DataSource
|
||||
frm.Location = pnlIndex.PointToScreen(New Point(340, y))
|
||||
|
||||
Dim result = frm.ShowDialog()
|
||||
|
||||
If result = DialogResult.OK Then
|
||||
Dim values As List(Of String) = frm.SelectedValues
|
||||
gridLookup.Properties.DataSource = values
|
||||
gridLookup.Properties.NullText = IIf(values.Count = 0, LOOKUP_NO_RECORDS, String.Format(LOOKUP_N_RECORDS, values.Count))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
pnlIndex.Controls.Add(gridLookup)
|
||||
Else
|
||||
Dim textBox As New TextBox()
|
||||
|
||||
textBox.Name = "cmbSingle" & indexname
|
||||
textBox.Font = New Font(textBox.Font.FontFamily, 9)
|
||||
textBox.Location = New Point(11, y)
|
||||
textBox.Size = New Size(300, LOOKUP_CONTROL_HEIGHT)
|
||||
textBox.ReadOnly = True
|
||||
textBox.Text = Vorgabe
|
||||
|
||||
AddHandler lookupButton.Click, Sub()
|
||||
Dim frm As New frmLookupGrid()
|
||||
frm.FormBorderStyle = FormBorderStyle.SizableToolWindow
|
||||
frm.MultiSelect = False
|
||||
frm.DataSource = table
|
||||
frm.AddNewValues = AddNewValues
|
||||
frm.StartPosition = FormStartPosition.Manual
|
||||
frm.SelectedValues = New List(Of String) From {textBox.Text}
|
||||
frm.Location = pnlIndex.PointToScreen(New Point(340, y))
|
||||
|
||||
Dim result = frm.ShowDialog()
|
||||
|
||||
If result = DialogResult.OK Then
|
||||
Dim value = frm.SelectedValues.FirstOrDefault()
|
||||
textBox.Text = value
|
||||
End If
|
||||
End Sub
|
||||
|
||||
pnlIndex.Controls.Add(textBox)
|
||||
End If
|
||||
|
||||
' Für ergebnisse die kleiner/gleich MAX_COMBOBOX_ITEMS sind
|
||||
' die normale ComboBox verwenden
|
||||
' 'Die Standardcombobox anlegen
|
||||
' newCMB = addCombobox(indexname, y)
|
||||
' newCMB.DataSource = table
|
||||
' newCMB.DisplayMember = table.Columns(0).ColumnName
|
||||
' newCMB.AutoCompleteSource = AutoCompleteSource.ListItems
|
||||
' newCMB.AutoCompleteMode = AutoCompleteMode.Suggest
|
||||
' newCMB.DropDownHeight = (newCMB.ItemHeight + 0.2) * 25
|
||||
' If Vorgabe <> "" Then
|
||||
' newCMB.SelectedIndex = newCMB.FindStringExact(Vorgabe)
|
||||
' newCMB.Text = Vorgabe
|
||||
' Get_NextComboBoxResults(newCMB)
|
||||
' If Multiselect Then
|
||||
' ' Neue Spalte für Selektion einfügen
|
||||
' Dim selectedColumn As New DataColumn() With {
|
||||
' .ColumnName = "SELECTED",
|
||||
' .DataType = GetType(Boolean),
|
||||
' .DefaultValue = False
|
||||
' }
|
||||
' table.Columns.Add(selectedColumn)
|
||||
' ' Spalte an erste Stelle verschieben
|
||||
' selectedColumn.SetOrdinal(0)
|
||||
' End If
|
||||
Else
|
||||
|
||||
End If
|
||||
' Const LOOKUP_NO_RECORDS As String = "Keine Datensätze ausgewählt"
|
||||
' Const LOOKUP_N_RECORDS As String = "{0} Datensätze ausgewählt"
|
||||
' Const LOOKUP_CONTROL_HEIGHT As Integer = 24
|
||||
|
||||
' Dim lookupButton As New Button()
|
||||
' lookupButton.Name = "btnLookup" & indexname
|
||||
' lookupButton.Location = New Point(311, y - 1)
|
||||
' lookupButton.Size = New Size(LOOKUP_CONTROL_HEIGHT, LOOKUP_CONTROL_HEIGHT)
|
||||
' lookupButton.Image = My.Resources.gear_32xSM
|
||||
|
||||
' pnlIndex.Controls.Add(lookupButton)
|
||||
|
||||
' If Multiselect Then
|
||||
' Dim listbox As New ListBox()
|
||||
' Dim gridLookup As New DevExpress.XtraEditors.GridLookUpEdit()
|
||||
|
||||
' gridLookup.Name = "cmbMulti" & indexname
|
||||
' gridLookup.Font = New Font(gridLookup.Font.FontFamily, 10)
|
||||
' gridLookup.Location = New Point(11, y)
|
||||
' gridLookup.Size = New Size(300, LOOKUP_CONTROL_HEIGHT)
|
||||
|
||||
' ' TODO: Hier noch die Vorbelegung für Vektor Indexe einfügen
|
||||
' gridLookup.Properties.PopupFormSize = New Size(gridLookup.Properties.PopupFormSize.Width, 100)
|
||||
' gridLookup.Properties.NullText = LOOKUP_NO_RECORDS
|
||||
' If Vorgabe.Length > 0 Then
|
||||
' gridLookup.Properties.DataSource = New List(Of String) From {Vorgabe}
|
||||
' gridLookup.Properties.NullText = String.Format(LOOKUP_N_RECORDS, 1)
|
||||
' Else
|
||||
' gridLookup.Properties.DataSource = Nothing
|
||||
' gridLookup.Properties.NullText = LOOKUP_NO_RECORDS
|
||||
' End If
|
||||
|
||||
|
||||
' ' Da das gridLookup ein Readonly Control sein soll,
|
||||
' ' sich aber trotzdem öffnen lassen soll, müssen wir so das setzen eines neuen Werts verhindern
|
||||
' AddHandler gridLookup.EditValueChanging, Sub(sender As Object, e As ChangingEventArgs)
|
||||
' e.Cancel = True
|
||||
' End Sub
|
||||
|
||||
' With gridLookup.Properties.View
|
||||
' .OptionsBehavior.ReadOnly = True
|
||||
' .OptionsBehavior.Editable = False
|
||||
' .OptionsView.ShowColumnHeaders = False
|
||||
' End With
|
||||
|
||||
' AddHandler lookupButton.Click, Sub()
|
||||
' Dim frm As New frmLookupGrid()
|
||||
' frm.MultiSelect = True
|
||||
' frm.DataSource = table
|
||||
' frm.AddNewValues = AddNewValues
|
||||
' frm.PreventDuplicates = PreventDuplicateValues
|
||||
' frm.StartPosition = FormStartPosition.Manual
|
||||
' frm.SelectedValues = gridLookup.Properties.DataSource
|
||||
' frm.Location = pnlIndex.PointToScreen(New Point(340, y))
|
||||
|
||||
' Dim result = frm.ShowDialog()
|
||||
|
||||
' If result = DialogResult.OK Then
|
||||
' Dim values As List(Of String) = frm.SelectedValues
|
||||
' gridLookup.Properties.DataSource = values
|
||||
' gridLookup.Properties.NullText = IIf(values.Count = 0, LOOKUP_NO_RECORDS, String.Format(LOOKUP_N_RECORDS, values.Count))
|
||||
' End If
|
||||
' End Sub
|
||||
|
||||
' pnlIndex.Controls.Add(gridLookup)
|
||||
' Else
|
||||
' Dim textBox As New TextBox()
|
||||
|
||||
' textBox.Name = "cmbSingle" & indexname
|
||||
' textBox.Font = New Font(textBox.Font.FontFamily, 9)
|
||||
' textBox.Location = New Point(11, y)
|
||||
' textBox.Size = New Size(300, LOOKUP_CONTROL_HEIGHT)
|
||||
' textBox.ReadOnly = True
|
||||
' textBox.Text = Vorgabe
|
||||
|
||||
' AddHandler lookupButton.Click, Sub()
|
||||
' Dim frm As New frmLookupGrid()
|
||||
' frm.FormBorderStyle = FormBorderStyle.SizableToolWindow
|
||||
' frm.MultiSelect = False
|
||||
' frm.DataSource = table
|
||||
' frm.AddNewValues = AddNewValues
|
||||
' frm.StartPosition = FormStartPosition.Manual
|
||||
' frm.SelectedValues = New List(Of String) From {textBox.Text}
|
||||
' frm.Location = pnlIndex.PointToScreen(New Point(340, y))
|
||||
|
||||
' Dim result = frm.ShowDialog()
|
||||
|
||||
' If result = DialogResult.OK Then
|
||||
' Dim value = frm.SelectedValues.FirstOrDefault()
|
||||
' textBox.Text = value
|
||||
' End If
|
||||
' End Sub
|
||||
|
||||
' pnlIndex.Controls.Add(textBox)
|
||||
' End If
|
||||
|
||||
' ' Für ergebnisse die kleiner/gleich MAX_COMBOBOX_ITEMS sind
|
||||
' ' die normale ComboBox verwenden
|
||||
' ' 'Die Standardcombobox anlegen
|
||||
' ' newCMB = addCombobox(indexname, y)
|
||||
' ' newCMB.DataSource = table
|
||||
' ' newCMB.DisplayMember = table.Columns(0).ColumnName
|
||||
' ' newCMB.AutoCompleteSource = AutoCompleteSource.ListItems
|
||||
' ' newCMB.AutoCompleteMode = AutoCompleteMode.Suggest
|
||||
' ' newCMB.DropDownHeight = (newCMB.ItemHeight + 0.2) * 25
|
||||
' ' If Vorgabe <> "" Then
|
||||
' ' newCMB.SelectedIndex = newCMB.FindStringExact(Vorgabe)
|
||||
' ' newCMB.Text = Vorgabe
|
||||
' ' Get_NextComboBoxResults(newCMB)
|
||||
' ' End If
|
||||
'Else
|
||||
|
||||
'End If
|
||||
|
||||
Dim oControl As New DigitalData.Controls.LookupGrid.LookupControl2 With {
|
||||
.DataSource = table,
|
||||
.MultiSelect = Multiselect,
|
||||
.AllowAddNewValues = AddNewValues,
|
||||
.PreventDuplicates = PreventDuplicateValues,
|
||||
.Location = New Point(11, y),
|
||||
.Size = New Size(300, 27),
|
||||
.Name = "cmbMulti" & indexname
|
||||
}
|
||||
|
||||
pnlIndex.Controls.Add(oControl)
|
||||
|
||||
If connectionString.Contains("Initial Catalog=") Then
|
||||
Try
|
||||
adapter.Dispose()
|
||||
@ -928,41 +941,27 @@ Public Class frmIndex
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If ctrl.Name.StartsWith("cmbMulti") Then
|
||||
Dim cmbMulti As DevExpress.XtraEditors.GridLookUpEdit = ctrl
|
||||
Dim values As List(Of String) = cmbMulti.Properties.DataSource
|
||||
Dim oLookup = DirectCast(ctrl, DigitalData.Controls.LookupGrid.LookupControl2)
|
||||
Dim values As List(Of String) = oLookup.SelectedValues
|
||||
|
||||
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(cmbMulti.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)
|
||||
|
||||
If optional_index = False Then
|
||||
MsgBox("Bitte wählen Sie einen Wert aus der Combobox.", MsgBoxStyle.Exclamation)
|
||||
cmbMulti.Focus()
|
||||
oLookup.Focus()
|
||||
Return False
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(cmbMulti.Name, "cmbMulti", ""), "")
|
||||
Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), "")
|
||||
result = True
|
||||
End If
|
||||
Else
|
||||
Dim vectorValue = String.Join(ClassConstants.VECTORSEPARATOR, values)
|
||||
Indexwert_Postprocessing(Replace(cmbMulti.Name, "cmbMulti", ""), vectorValue)
|
||||
Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), vectorValue)
|
||||
result = True
|
||||
End If
|
||||
|
||||
'If cmbMulti.Text = "" Then
|
||||
' Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(cmbMulti.Name, "cmbMulti", "") & "'", MyConnectionString, True)
|
||||
|
||||
' If optional_index = False Then
|
||||
' MsgBox("Bitte wählen Sie einen Wert aus der Combobox.", MsgBoxStyle.Exclamation)
|
||||
' cmbMulti.Focus()
|
||||
' Return False
|
||||
' Else
|
||||
' Indexwert_Postprocessing(Replace(cmbMulti.Name, "cmbMulti", ""), "")
|
||||
' result = True
|
||||
' End If
|
||||
'Else
|
||||
' Indexwert_Postprocessing(Replace(cmbMulti.Name, "cmbMulti", ""), cmbMulti.Text)
|
||||
' result = True
|
||||
'End If
|
||||
ElseIf ctrl.Name.StartsWith("cmbSingle") Then
|
||||
Dim cmbSingle As TextBox = ctrl
|
||||
|
||||
|
||||
@ -114,6 +114,7 @@
|
||||
<File Id="Config" Name="DigitalData.Modules.Config.dll" Source="DigitalData.Modules.Config.dll" KeyPath="no" />
|
||||
<File Id="DLLLicenseManager" Name="DLLLicenseManager.dll" Source="P:\Visual Studio Projekte\Bibliotheken\DLLLicenseManager.dll" KeyPath="no" />
|
||||
<File Id="DocumentViewer" Name="DigitalData.Controls.DocumentViewer.dll" Source="DigitalData.Controls.DocumentViewer.dll" KeyPath="no" />
|
||||
<File Id="LookupGrid" Name="DigitalData.Controls.LookupGrid.dll" Source="DigitalData.Controls.LookupGrid.dll" KeyPath="no" />
|
||||
</Component>
|
||||
|
||||
<Component Id="GDPictureLibs" Guid="9ea5ab43-58ff-4813-9a8b-f854784f0275">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user