From 0a7cfbc35ebefe039842ece5a048114a441c7968 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 7 May 2021 12:20:18 +0200 Subject: [PATCH 1/3] remove Global Localizer object --- app/DD_PM_WINDREAM/frmValidator.vb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/DD_PM_WINDREAM/frmValidator.vb b/app/DD_PM_WINDREAM/frmValidator.vb index de1ff8d..803d0b3 100644 --- a/app/DD_PM_WINDREAM/frmValidator.vb +++ b/app/DD_PM_WINDREAM/frmValidator.vb @@ -93,8 +93,6 @@ Public Class frmValidator Catch ex As Exception LOGGER.Error(ex) End Try - - Localizer.Active = New LookupGridLocalizer() End Sub Private Sub frmValidation_Load(sender As Object, e As System.EventArgs) Handles Me.Load From 20dc259f9231212cc5dc1c9a4d67a0b1735b919c Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 7 May 2021 12:20:40 +0200 Subject: [PATCH 2/3] handle errors in sql queries for table columns --- app/DD_PM_WINDREAM/ClassControlCreator.vb | 102 +++++++++++++--------- 1 file changed, 62 insertions(+), 40 deletions(-) diff --git a/app/DD_PM_WINDREAM/ClassControlCreator.vb b/app/DD_PM_WINDREAM/ClassControlCreator.vb index cacfa07..7f4a73d 100644 --- a/app/DD_PM_WINDREAM/ClassControlCreator.vb +++ b/app/DD_PM_WINDREAM/ClassControlCreator.vb @@ -477,6 +477,10 @@ Public Class ClassControlCreator Try Dim oComboboxDataTable As DataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId) + If oComboboxDataTable Is Nothing Then + LOGGER.Warn("DataTable for SQL [{0}] is nothing. Possible error on SQL Query.") + End If + GridTables.Item(oControl.Name).Add(oRow.Item("SPALTENNAME"), oComboboxDataTable) 'GridTables.Add(oRow.Item("SPALTENNAME"), oComboboxDataTable) Catch ex As Exception @@ -503,50 +507,68 @@ Public Class ClassControlCreator Next AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs) - For Each oRow As DataRow In DT_MY_COLUMNS.Rows - If oRow.Item("SPALTENNAME") = e.Column.FieldName Then - If GridTables.Item(oControl.Name).ContainsKey(e.Column.FieldName) Then - Dim oComboboxDataTable As DataTable = GridTables.Item(oControl.Name).Item(e.Column.FieldName) - - If oRow.Item("ADVANCED_LOOKUP") Then - Dim oEditor = New RepositoryItemLookupControl3 With { - .DataSource = oComboboxDataTable, - .DisplayMember = oComboboxDataTable.Columns.Item(0).ColumnName, - .ValueMember = oComboboxDataTable.Columns.Item(0).ColumnName - } - - e.RepositoryItem = oEditor - Else - Dim oEditor = New RepositoryItemComboBox() - Dim oItems As New List(Of String) - - AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs) - If oItems.Contains(_sender.EditValue) Then - _e.Cancel = False - Else - _e.Cancel = True - End If - - End Sub - For Each oRow2 As DataRow In oComboboxDataTable.Rows - Dim oValue = oRow2.Item(0) - - Try - oValue &= $" | {oRow2.Item(1)}" - Catch ex As Exception - End Try - - oEditor.Items.Add(oValue) - oItems.Add(oValue) - Next - - e.RepositoryItem = oEditor + Try + For Each oRow As DataRow In DT_MY_COLUMNS.Rows + If oRow.Item("SPALTENNAME") = e.Column.FieldName Then + If GridTables.Item(oControl.Name).ContainsKey(e.Column.FieldName) Then + Dim oComboboxDataTable As DataTable = GridTables.Item(oControl.Name).Item(e.Column.FieldName) + + If oComboboxDataTable Is Nothing Then + Throw New ApplicationException($"ComboboxTable for Column {e.Column.FieldName} is empty.") + End If + + If oRow.Item("ADVANCED_LOOKUP") And oComboboxDataTable IsNot Nothing Then + Dim oEditor = New RepositoryItemLookupControl3 With { + .DataSource = oComboboxDataTable, + .DisplayMember = oComboboxDataTable.Columns.Item(0).ColumnName, + .ValueMember = oComboboxDataTable.Columns.Item(0).ColumnName + } + + + 'AddHandler oEditor.SelectedValuesChanged, Sub(_sender As Object, _e As List(Of String)) + ' oView.PostEditor() + ' End Sub + + e.RepositoryItem = oEditor + Else + Dim oEditor = New RepositoryItemComboBox() + Dim oItems As New List(Of String) + + AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs) + If oItems.Contains(_sender.EditValue) Then + _e.Cancel = False + Else + _e.Cancel = True + End If + + End Sub + For Each oRow2 As DataRow In oComboboxDataTable.Rows + Dim oValue = oRow2.Item(0) + + Try + oValue &= $" | {oRow2.Item(1)}" + Catch ex As Exception + End Try + + oEditor.Items.Add(oValue) + oItems.Add(oValue) + Next + + e.RepositoryItem = oEditor + End If End If End If - End If - Next + Next + Catch ex As Exception + LOGGER.Warn("Error in CustomRowCellEdit for [{0}]", e.CellValue) + LOGGER.Error(ex) + End Try End Sub + 'AddHandler oView.CellValueChanged, Sub(sender As Object, e As CellValueChangedEventArgs) + ' Console.WriteLine("") + ' End Sub + AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs) Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle) From 454b2b8010f769b17498039e793a551a22e8c33b Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 7 May 2021 12:24:00 +0200 Subject: [PATCH 3/3] Version 2.2.14 --- app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb b/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb index 60b0ab8..0b17a55 100644 --- a/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb +++ b/app/DD_PM_WINDREAM/My Project/AssemblyInfo.vb @@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - +