diff --git a/Controls.LookupGrid/LookupControl2.vb b/Controls.LookupGrid/LookupControl2.vb index 5da0b852..95c502b4 100644 --- a/Controls.LookupGrid/LookupControl2.vb +++ b/Controls.LookupGrid/LookupControl2.vb @@ -22,7 +22,6 @@ Public Class LookupControl2 Return _SelectedValues End Get Set(value As List(Of String)) - _SelectedValues = value UpdateSelectedValues(value) End Set End Property @@ -31,21 +30,20 @@ Public Class LookupControl2 Return _ReadOnly End Get Set(value As Boolean) - SetButtonVisibility(Not value) + SetFormButtonEnabled(Not value) _ReadOnly = value End Set End Property Private ReadOnly _LookupFormButton As EditorButton + Private Const TAG_DROPDOWN = "openDropdown" Private Const TAG_BUTTON_LOOKUP_FORM = "openLookupForm" Private Const TEXT_NO_RECORDS = "Keine Datensätze ausgewählt" Private Const TEXT_ONE_RECORD = "Ein Datensatz ausgewählt" Private Const TEXT_N_RECORDS = "{0} Datensätze ausgewählt" - Private _SelectedValues As List(Of String) - Friend WithEvents fProperties As RepositoryItemGridLookUpEdit - Friend WithEvents fPropertiesView As DevExpress.XtraGrid.Views.Grid.GridView + Private _SelectedValues As New List(Of String) Private _ReadOnly As Boolean = False Shared Sub New() @@ -62,6 +60,7 @@ Public Class LookupControl2 .Tag = TAG_BUTTON_LOOKUP_FORM } + Properties.Buttons.Item(0).Tag = TAG_DROPDOWN Properties.Buttons.AddRange({_LookupFormButton}) AddHandler ButtonClick, AddressOf HandleButtonClick @@ -69,13 +68,23 @@ Public Class LookupControl2 AddHandler QueryPopUp, AddressOf HandleQueryPopup End Sub - Private Sub SetButtonVisibility(Visible As Boolean) + Private Sub SetFormButtonEnabled(Enabled As Boolean) Dim oButton As EditorButton = Properties.Buttons. Where(Function(b) b.Tag = TAG_BUTTON_LOOKUP_FORM). FirstOrDefault() If oButton IsNot Nothing Then - oButton.Visible = Visible + oButton.Enabled = Enabled + End If + End Sub + + Private Sub SetDropdownButtonEnabled(Enabled As Boolean) + Dim oButton As EditorButton = Properties.Buttons. + Where(Function(b) b.Tag = TAG_DROPDOWN). + FirstOrDefault() + + If oButton IsNot Nothing Then + oButton.Enabled = Enabled End If End Sub @@ -108,14 +117,7 @@ Public Class LookupControl2 If oResult = Windows.Forms.DialogResult.OK Then Dim oValues = oForm.SelectedValues - UpdateSelectedValues(oValues) - SelectedValues = oValues - ElseIf oResult = Windows.Forms.DialogResult.Cancel Then - Dim oValues = New List(Of String) - - UpdateSelectedValues(oValues) - SelectedValues = oValues End If End Using End Select @@ -126,6 +128,8 @@ Public Class LookupControl2 Exit Sub End If + Values.RemoveAll(Function(v) String.IsNullOrEmpty(v)) + If MultiSelect = True Then Properties.DataSource = Values @@ -142,6 +146,8 @@ Public Class LookupControl2 Text = Values.FirstOrDefault() EditValue = Nothing End If + + _SelectedValues = Values End Sub Private Function GetLookupForm() As frmLookupGrid @@ -170,31 +176,6 @@ Public Class LookupControl2 Return RepositoryItemLookupControl2.CustomEditName End Get End Property - - Private Sub InitializeComponent() - Me.fProperties = New DevExpress.XtraEditors.Repository.RepositoryItemGridLookUpEdit() - Me.fPropertiesView = New DevExpress.XtraGrid.Views.Grid.GridView() - CType(Me.fProperties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.fPropertiesView, System.ComponentModel.ISupportInitialize).BeginInit() - Me.SuspendLayout() - ' - 'fProperties - ' - Me.fProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) - Me.fProperties.Name = "fProperties" - Me.fProperties.PopupView = Me.fPropertiesView - ' - 'fPropertiesView - ' - Me.fPropertiesView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus - Me.fPropertiesView.Name = "fPropertiesView" - Me.fPropertiesView.OptionsSelection.EnableAppearanceFocusedCell = False - Me.fPropertiesView.OptionsView.ShowGroupPanel = False - CType(Me.fProperties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.fPropertiesView, System.ComponentModel.ISupportInitialize).EndInit() - Me.ResumeLayout(False) - - End Sub End Class diff --git a/Controls.LookupGrid/frmLookupGrid.Designer.vb b/Controls.LookupGrid/frmLookupGrid.Designer.vb index e969bbe8..b194e30b 100644 --- a/Controls.LookupGrid/frmLookupGrid.Designer.vb +++ b/Controls.LookupGrid/frmLookupGrid.Designer.vb @@ -69,6 +69,7 @@ Partial Class frmLookupGrid 'btnClear ' Me.btnClear.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnClear.DialogResult = System.Windows.Forms.DialogResult.OK Me.btnClear.Location = New System.Drawing.Point(236, 6) Me.btnClear.Name = "btnClear" Me.btnClear.Size = New System.Drawing.Size(136, 23) diff --git a/Controls.LookupGrid/frmLookupGrid.vb b/Controls.LookupGrid/frmLookupGrid.vb index a364640d..f6cf41f8 100644 --- a/Controls.LookupGrid/frmLookupGrid.vb +++ b/Controls.LookupGrid/frmLookupGrid.vb @@ -140,7 +140,7 @@ Public Class frmLookupGrid Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click SelectedValues = New List(Of String) - DialogResult = DialogResult.Cancel + DialogResult = DialogResult.OK Close() End Sub diff --git a/DDZUGFeRDService/ThreadRunner.vb b/DDZUGFeRDService/ThreadRunner.vb index 3d2601b4..45dbb8d5 100644 --- a/DDZUGFeRDService/ThreadRunner.vb +++ b/DDZUGFeRDService/ThreadRunner.vb @@ -163,11 +163,15 @@ Public Class ThreadRunner Dim tableName = row.Item("TABLE_NAME") Dim description = row.Item("DESCRIPTION") Dim isRequired = row.Item("IS_REQUIRED") + Dim isGrouped = row.Item("IS_GROUPED") + Dim groupScope = row.Item("GROUP_SCOPE") args.PropertyMap.Add(xmlPath, New XmlItemProperty() With { .Description = description, .TableName = tableName, - .IsRequired = isRequired + .IsRequired = isRequired, + .IsGrouped = isGrouped, + .GroupScope = groupScope }) Next diff --git a/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb index af954877..bcc54190 100644 --- a/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -288,21 +288,27 @@ Public Class ImportZUGFeRDFiles ToDictionary(Function(Item) Item.Key, Function(Item) Item.Value) + _logger.Debug("Found {0} default properties.", oDefaultProperties.Count) + ' PropertyMap items with `IsGrouped = True` are grouped by group scope Dim oGroupedProperties = args.PropertyMap. Where(Function(Item) Item.Value.IsGrouped = True). ToLookup(Function(Item) Item.Value.GroupScope, ' Lookup key is group scope Function(Item) Item) + _logger.Debug("Found {0} properties grouped in {1} group(s)", args.PropertyMap.Count - oDefaultProperties.Count, oGroupedProperties.Count) + ' Iterate through groups to get group scope and group items For Each oGroup In oGroupedProperties - Dim oGroupScope = oGroup.Key + Dim oGroupScope As String = oGroup.Key Dim oPropertyList As New Dictionary(Of XmlItemProperty, List(Of Object)) Dim oRowCount = 0 + _logger.Debug("Fetching Property values for group {0}.", oGroupScope) + ' get properties as a nested object, see `oPropertyList` For Each oProperty As KeyValuePair(Of String, XmlItemProperty) In oGroup - Dim oPropertyValues As List(Of Object) = PropertyValues.GetPropValues(oDocument, oProperty.Key) + Dim oPropertyValues As List(Of Object) = PropertyValues.GetPropValue(oDocument, oProperty.Key) oPropertyList.Add(oProperty.Value, oPropertyValues) @@ -312,6 +318,45 @@ Public Class ImportZUGFeRDFiles End If Next + ' check for rows that are empty in every column + ' this happens when a grouped row is not filled + ' e.g. a row in a invoice that is just a note + _logger.Debug("Done Fetching Property values.") + Dim oIndexesToRemove As New List(Of Integer) + + For oRowIndex = 0 To oRowCount - 1 + Dim oColumnIsEmpty = False + + For Each oRow In oPropertyList + Dim oValue As List(Of Object) = oRow.Value.Item(oRowIndex) + oColumnIsEmpty = oValue.Count = 0 + Next + + If oColumnIsEmpty Then + oIndexesToRemove.Add(oRowIndex) + End If + Next + + _logger.Debug("Removing {0} empty rows.", oIndexesToRemove) + + + ' order indexes to remove descending to avoid indexOutOfRange errors + If oIndexesToRemove.Count > 0 Then + oIndexesToRemove = oIndexesToRemove. + OrderByDescending(Function(oIndex) oIndex). + ToList() + End If + + ' now remove all empty rows. + For Each oIndex In oIndexesToRemove + For Each oRow In oPropertyList + oRow.Value.RemoveAt(oIndex) + Next + Next + + ' decrease row count by rows removed + oRowCount -= oIndexesToRemove.Count + ' Structure of oPropertyList ' [ # Propertyname # Row 1 # Row 2 ' PositionsMenge: [BilledQuantity1, BilledQuantity2, ...], @@ -319,23 +364,39 @@ Public Class ImportZUGFeRDFiles ' ... ' ] For oRowIndex = 0 To oRowCount - 1 + _logger.Debug("Processing row {0}", oRowIndex) + For Each oColumn As KeyValuePair(Of XmlItemProperty, List(Of Object)) In oPropertyList Dim oTableName As String = oColumn.Key.TableName Dim oPropertyDescription As String = oColumn.Key.Description Dim oPropertyValue = oColumn.Value.Item(oRowIndex) Dim oRowCounter = oRowIndex + 1 - If String.IsNullOrEmpty(oPropertyValue) Then + _logger.Debug("Processing property {0}.", oPropertyDescription) + + If TypeOf oPropertyValue Is List(Of Object) Then + Select Case oPropertyValue.Count + Case 0 + oPropertyValue = String.Empty + Case Else + Dim oList As List(Of Object) = DirectCast(oPropertyValue, List(Of Object)) + oPropertyValue = oList.Item(0) + End Select + End If + + If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then If oColumn.Key.IsRequired Then - _logger.Warn("Property {0} is empty or not found. Continuing with Empty String.", oPropertyDescription) + _logger.Warn("Property {0} is empty or not found but was required. Continuing with Empty String.", oPropertyDescription) oMissingProperties.Add(oPropertyDescription) Else _logger.Warn("Property {0} is empty or not found. Continuing with Empty String.", oPropertyDescription) End If - oPropertyDescription = String.Empty + oPropertyValue = String.Empty End If + _logger.Debug("Property {0} has value '{1}'", oPropertyDescription, oPropertyValue) + Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oFileGroupId}', '{oPropertyDescription}', '{oPropertyValue}', {oRowCounter})" _logger.Debug("Mapping Property {0} to value {1}. Will be inserted into table {2} with RowCounter {3}", oPropertyDescription, oPropertyValue, oTableName, oRowCounter) @@ -355,10 +416,22 @@ Public Class ImportZUGFeRDFiles ' Iterate through default properties For Each Item As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties - Dim oPropertyValue As String = PropertyValues.GetPropValue(oDocument, Item.Key) + Dim oPropertyValueList As List(Of Object) = PropertyValues.GetPropValue(oDocument, Item.Key) Dim oPropertyDescription As String = Item.Value.Description + Dim oPropertyValue As Object = Nothing - If String.IsNullOrEmpty(oPropertyValue) Then + If IsNothing(oPropertyValueList) Then + oPropertyValue = Nothing + ElseIf TypeOf oPropertyValueList Is List(Of Object) Then + Select Case oPropertyValueList.Count + Case 0 + oPropertyValue = Nothing + Case Else + oPropertyValue = oPropertyValueList.First() + End Select + End If + + If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then If Item.Value.IsRequired Then _logger.Warn("Property {0} is empty but marked as required! Skipping.", oPropertyDescription) oMissingProperties.Add(oPropertyDescription) diff --git a/Jobs/EDMI/ZUGFeRD/PropertyValues.vb b/Jobs/EDMI/ZUGFeRD/PropertyValues.vb index 369081bc..b90aec42 100644 --- a/Jobs/EDMI/ZUGFeRD/PropertyValues.vb +++ b/Jobs/EDMI/ZUGFeRD/PropertyValues.vb @@ -6,22 +6,11 @@ Public Class PropertyValues Private Shared _indexPattern = "\((\d+)\)" Private Shared _indexRegex As New Regex(_indexPattern) - Public Shared Function GetPropValues(Obj As Object, PropertyName As String) - Dim oResult As Object = GetPropValue(Obj, PropertyName) - - ' Wrap the result of `GetPropValue` in a list if a single Value is returned - If TypeOf oResult Is List(Of Object) Then - Return oResult - Else - Return New List(Of Object) From {oResult} - End If - End Function - - Public Shared Function GetPropValue(Obj As Object, PropertyName As String) + Public Shared Function GetPropValue(Obj As Object, PropertyName As String) As List(Of Object) Dim oNameParts As String() = PropertyName.Split("."c) If IsNothing(Obj) Then - Return Nothing + Return New List(Of Object) End If If oNameParts.Length = 1 Then @@ -42,11 +31,11 @@ Public Class PropertyValues Dim oInfo As PropertyInfo = oType.GetProperty(oPartName) If IsNothing(oInfo) Then - Return Nothing + Return New List(Of Object) End If If IsNothing(oInfo.GetValue(Obj, Nothing)) Then - Return Nothing + Return New List(Of Object) End If Obj = oInfo.GetValue(Obj, Nothing) @@ -78,7 +67,7 @@ Public Class PropertyValues End If Next - Return Obj + Return New List(Of Object) From {Obj} End Function Private Shared Function GetIndex(Prop As String) As Integer diff --git a/LookupControlGui/Form1.Designer.vb b/LookupControlGui/Form1.Designer.vb index 20e29cfc..825a143a 100644 --- a/LookupControlGui/Form1.Designer.vb +++ b/LookupControlGui/Form1.Designer.vb @@ -32,11 +32,43 @@ Partial Class Form1 Dim SerializableAppearanceObject6 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() Dim SerializableAppearanceObject7 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() Dim SerializableAppearanceObject8 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1)) + Dim EditorButtonImageOptions3 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions() + Dim SerializableAppearanceObject9 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject10 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject11 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject12 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim EditorButtonImageOptions4 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions() + Dim SerializableAppearanceObject13 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject14 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject15 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject16 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim EditorButtonImageOptions5 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions() + Dim SerializableAppearanceObject17 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject18 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject19 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject20 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim EditorButtonImageOptions6 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions() + Dim SerializableAppearanceObject21 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject22 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject23 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() + Dim SerializableAppearanceObject24 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() Me.Button1 = New System.Windows.Forms.Button() Me.LookupControl = New DigitalData.Controls.LookupGrid.LookupControl2() Me.LookupControl21View = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.Label1 = New System.Windows.Forms.Label() + Me.LookupControl21 = New DigitalData.Controls.LookupGrid.LookupControl2() + Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.Label2 = New System.Windows.Forms.Label() + Me.LookupControl22 = New DigitalData.Controls.LookupGrid.LookupControl2() + Me.GridView2 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.Label3 = New System.Windows.Forms.Label() CType(Me.LookupControl.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LookupControl21View, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LookupControl21.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LookupControl22.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridView2, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Button1 @@ -58,7 +90,7 @@ Partial Class Form1 Me.LookupControl.PreventDuplicates = False Me.LookupControl.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", "openDropdown", Nothing, DevExpress.Utils.ToolTipAnchor.[Default]), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions2, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject5, SerializableAppearanceObject6, SerializableAppearanceObject7, SerializableAppearanceObject8, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])}) Me.LookupControl.Properties.PopupView = Me.LookupControl21View - Me.LookupControl.SelectedValues = Nothing + Me.LookupControl.SelectedValues = CType(resources.GetObject("LookupControl.SelectedValues"), System.Collections.Generic.List(Of String)) Me.LookupControl.Size = New System.Drawing.Size(342, 20) Me.LookupControl.TabIndex = 3 ' @@ -69,21 +101,109 @@ Partial Class Form1 Me.LookupControl21View.OptionsSelection.EnableAppearanceFocusedCell = False Me.LookupControl21View.OptionsView.ShowGroupPanel = False ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(390, 15) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(91, 13) + Me.Label1.TabIndex = 4 + Me.Label1.Text = "Multiselect = True" + ' + 'LookupControl21 + ' + Me.LookupControl21.AllowAddNewValues = False + Me.LookupControl21.DataSource = Nothing + Me.LookupControl21.Location = New System.Drawing.Point(393, 89) + Me.LookupControl21.MultiSelect = True + Me.LookupControl21.Name = "LookupControl21" + Me.LookupControl21.PreventDuplicates = False + Me.LookupControl21.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, True, True, False, EditorButtonImageOptions3, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject9, SerializableAppearanceObject10, SerializableAppearanceObject11, SerializableAppearanceObject12, "", "openDropdown", Nothing, DevExpress.Utils.ToolTipAnchor.[Default]), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions4, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject13, SerializableAppearanceObject14, SerializableAppearanceObject15, SerializableAppearanceObject16, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])}) + Me.LookupControl21.Properties.PopupView = Me.GridView1 + Me.LookupControl21.SelectedValues = CType(resources.GetObject("LookupControl21.SelectedValues"), System.Collections.Generic.List(Of String)) + Me.LookupControl21.Size = New System.Drawing.Size(342, 20) + Me.LookupControl21.TabIndex = 3 + ' + 'GridView1 + ' + Me.GridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus + Me.GridView1.Name = "GridView1" + Me.GridView1.OptionsSelection.EnableAppearanceFocusedCell = False + Me.GridView1.OptionsView.ShowGroupPanel = False + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(390, 73) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(88, 13) + Me.Label2.TabIndex = 4 + Me.Label2.Text = "ReadOnly = True" + ' + 'LookupControl22 + ' + Me.LookupControl22.AllowAddNewValues = False + Me.LookupControl22.DataSource = Nothing + Me.LookupControl22.Location = New System.Drawing.Point(393, 147) + Me.LookupControl22.MultiSelect = False + Me.LookupControl22.Name = "LookupControl22" + Me.LookupControl22.PreventDuplicates = False + Me.LookupControl22.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, True, True, False, EditorButtonImageOptions5, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject17, SerializableAppearanceObject18, SerializableAppearanceObject19, SerializableAppearanceObject20, "", "openDropdown", Nothing, DevExpress.Utils.ToolTipAnchor.[Default]), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions6, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject21, SerializableAppearanceObject22, SerializableAppearanceObject23, SerializableAppearanceObject24, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])}) + Me.LookupControl22.Properties.DataSource = CType(resources.GetObject("LookupControl22.Properties.DataSource"), Object) + Me.LookupControl22.Properties.NullText = "Keine Datensätze ausgewählt" + Me.LookupControl22.Properties.PopupView = Me.GridView2 + Me.LookupControl22.SelectedValues = CType(resources.GetObject("LookupControl22.SelectedValues"), System.Collections.Generic.List(Of String)) + Me.LookupControl22.Size = New System.Drawing.Size(342, 20) + Me.LookupControl22.TabIndex = 3 + ' + 'GridView2 + ' + Me.GridView2.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus + Me.GridView2.Name = "GridView2" + Me.GridView2.OptionsSelection.EnableAppearanceFocusedCell = False + Me.GridView2.OptionsView.ShowGroupPanel = False + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(390, 131) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(96, 13) + Me.Label3.TabIndex = 4 + Me.Label3.Text = "MultiSelect = False" + ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.LookupControl22) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.LookupControl21) Me.Controls.Add(Me.LookupControl) Me.Controls.Add(Me.Button1) Me.Name = "Form1" Me.Text = "Form1" CType(Me.LookupControl.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LookupControl21View, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LookupControl21.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LookupControl22.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridView2, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) + Me.PerformLayout() End Sub Friend WithEvents Button1 As Button Friend WithEvents LookupControl As DigitalData.Controls.LookupGrid.LookupControl2 Friend WithEvents LookupControl21View As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents Label1 As Label + Friend WithEvents LookupControl21 As DigitalData.Controls.LookupGrid.LookupControl2 + Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents Label2 As Label + Friend WithEvents LookupControl22 As DigitalData.Controls.LookupGrid.LookupControl2 + Friend WithEvents GridView2 As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents Label3 As Label End Class diff --git a/LookupControlGui/Form1.resx b/LookupControlGui/Form1.resx index 1af7de15..fe049d32 100644 --- a/LookupControlGui/Form1.resx +++ b/LookupControlGui/Form1.resx @@ -117,4 +117,40 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0 + ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs= + + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0 + ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs= + + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0 + ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs= + + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0 + ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs= + + \ No newline at end of file diff --git a/LookupControlGui/Form1.vb b/LookupControlGui/Form1.vb index ed7e82bb..036687f9 100644 --- a/LookupControlGui/Form1.vb +++ b/LookupControlGui/Form1.vb @@ -2,13 +2,22 @@ Private _Datasource As New List(Of String) From {"Foo", "bar", "baz", "quux"} Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Dim oDatatable = GetDatatable() Dim oSelectedValues = _Datasource.Take(1).ToList() LookupControl.DataSource = oDatatable LookupControl.SelectedValues = oSelectedValues - LookupControl.ReadOnly = True + LookupControl.ReadOnly = False + + LookupControl21.DataSource = oDatatable + LookupControl21.SelectedValues = oSelectedValues + LookupControl21.ReadOnly = True + + LookupControl22.DataSource = oDatatable + LookupControl22.SelectedValues = oSelectedValues + LookupControl22.ReadOnly = False + + LookupControl22.SelectedValues = New List(Of String) From {"", Nothing, "LOL"} End Sub Private Function GetDatatable() As DataTable @@ -27,8 +36,4 @@ Return oDatatable End Function - - Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - LookupControl.ReadOnly = Not LookupControl.ReadOnly - End Sub End Class