From e44a42faea47c96312084b0ee1577ed713bfd371 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 2 Jun 2023 10:47:24 +0200 Subject: [PATCH] Clean up, fix missing TextEdit --- app/TaskFlow/ClassControlCreator.vb | 97 ++++++++-------- app/TaskFlow/ClassFormat.vb | 78 ------------- app/TaskFlow/ClassIDBData.vb | 1 - app/TaskFlow/clsPatterns.vb | 7 +- app/TaskFlow/frmAdministration.vb | 26 ++--- app/TaskFlow/frmFormDesigner.vb | 43 ++++---- app/TaskFlow/frmMassValidator.vb | 64 ++++------- app/TaskFlow/frmValidator.vb | 164 +++++++++++----------------- 8 files changed, 177 insertions(+), 303 deletions(-) diff --git a/app/TaskFlow/ClassControlCreator.vb b/app/TaskFlow/ClassControlCreator.vb index edeacf6..92e5ac8 100644 --- a/app/TaskFlow/ClassControlCreator.vb +++ b/app/TaskFlow/ClassControlCreator.vb @@ -64,13 +64,14 @@ Public Class ClassControlCreator Public Const CONTROL_TYPE_DATETIME = "DATETIME" - Public Shared Property Logger As Logger + Public ReadOnly Property Logger As Logger + Public ReadOnly Property LogConfig As LogConfig ''' ''' Saves the column data for each grid and each column in that grid ''' - Public Shared Property GridTables As New Dictionary(Of Integer, Dictionary(Of String, RepositoryItem)) - Public Shared Property GridColumns As New Dictionary(Of Integer, DataTable) + Public Property GridTables As New Dictionary(Of Integer, Dictionary(Of String, RepositoryItem)) + Public Property GridColumns As New Dictionary(Of Integer, DataTable) ''' ''' Standard Eigenschaften für alle Controls @@ -91,7 +92,12 @@ Public Class ClassControlCreator Public BackColor As Color = Color.White End Class - Private Shared Function TransformDataRow(row As DataRow) As ControlDBProps + Public Sub New(pLogConfig As LogConfig) + LogConfig = pLogConfig + Logger = pLogConfig.GetLogger() + End Sub + + Private Function TransformDataRow(row As DataRow) As ControlDBProps Dim x As Integer = row.Item("X_LOC") Dim y As Integer = row.Item("Y_LOC") Dim style As FontStyle = NotNull(row.Item("FONT_STYLE"), DEFAULT_FONT_STYLE) @@ -116,7 +122,7 @@ Public Class ClassControlCreator } End Function - Public Shared Function CreateBaseControl(ctrl As Control, OControlRow As DataRow, designMode As Boolean) As Control + Public Function CreateBaseControl(ctrl As Control, OControlRow As DataRow, designMode As Boolean) As Control Try Dim props As ControlDBProps = TransformDataRow(OControlRow) @@ -149,7 +155,7 @@ Public Class ClassControlCreator ' ----------------------- NEW CONTROLS ----------------------- - 'Public Shared Function CreateNewTextBox(location As Point) As TextBox + 'Public Function CreateNewTextBox(location As Point) As TextBox ' Dim control As New TextBox With { ' .Name = $"{PREFIX_TEXTBOX}_{clsTools.ShortGuid()}", ' .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), @@ -162,7 +168,7 @@ Public Class ClassControlCreator ' Return control 'End Function - Public Shared Function CreateNewTextBox(location As Point) As TextEdit + Public Function CreateNewTextBox(location As Point) As TextEdit Dim control As New TextEdit With { .Name = $"{PREFIX_TEXTBOX}_{clsTools.ShortGuid()}", .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), @@ -175,7 +181,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateNewLabel(location As Point) As Label + Public Function CreateNewLabel(location As Point) As Label Dim control As New Label With { .Name = $"{PREFIX_LABEL}_{clsTools.ShortGuid}", .Text = DEFAULT_TEXT, @@ -187,7 +193,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateNewCheckbox(location As Point) As CheckBox + Public Function CreateNewCheckbox(location As Point) As CheckBox Dim control As New CheckBox With { .Name = $"{PREFIX_CHECKBOX}_{clsTools.ShortGuid}", .AutoSize = True, @@ -200,8 +206,8 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateNewCombobox(location As Point) As ComboBox - Dim control As New ComboBox With { + Public Function CreateNewCombobox(location As Point) As Windows.Forms.ComboBox + Dim control As New Windows.Forms.ComboBox With { .Name = $"{PREFIX_COMBOBOX}_{clsTools.ShortGuid}", .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), .Cursor = Cursors.Hand, @@ -211,7 +217,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateNewDatetimepicker(location As Point) As DateTimePicker + Public Function CreateNewDatetimepicker(location As Point) As DateTimePicker Dim control As New DateTimePicker With { .Name = $"{PREFIX_DATETIMEPICKER}_{clsTools.ShortGuid}", .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), @@ -223,7 +229,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateNewDatagridview(location As Point) As DataGridView + Public Function CreateNewDatagridview(location As Point) As DataGridView Dim control As New DataGridView With { .Name = $"{PREFIX_DATAGRIDVIEW}_{clsTools.ShortGuid}", .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT_TABLE), @@ -243,7 +249,7 @@ Public Class ClassControlCreator Return control End Function - Friend Shared Function CreateNewLookupControl(location As Point) As LookupControl3 + Friend Function CreateNewLookupControl(location As Point) As LookupControl3 Dim control As New LookupControl3 With { .Name = $"{PREFIX_LOOKUP}_{clsTools.ShortGuid}", .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), @@ -253,7 +259,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateNewTable(location As Point) As GridControl + Public Function CreateNewTable(location As Point) As GridControl Dim oControl As New GridControl With { .Name = $"{PREFIX_TABLE}_{clsTools.ShortGuid}", .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT_TABLE), @@ -273,7 +279,7 @@ Public Class ClassControlCreator Return oControl End Function - Public Shared Function CreateNewLine(location As Point) As LineLabel + Public Function CreateNewLine(location As Point) As LineLabel Dim control As New LineLabel With { .Name = $"{PREFIX_LINE}_{clsTools.ShortGuid}", .Text = "---------------------------------", @@ -283,7 +289,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateNewButton(location As Point) As Button + Public Function CreateNewButton(location As Point) As Button Dim control As New Button With { .Name = $"{PREFIX_BUTTON}_{clsTools.ShortGuid}", .Size = New Size(108, 28), @@ -296,7 +302,7 @@ Public Class ClassControlCreator ' ----------------------- EXISITING CONTROLS ----------------------- - 'Public Shared Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As TextBox + 'Public Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As TextBox ' Try ' Dim control As TextBox = CreateBaseControl(New TextBox(), oControlRow, designMode) @@ -327,7 +333,7 @@ Public Class ClassControlCreator 'End Function - Public Shared Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As BaseEdit + Public Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As BaseEdit Try Dim oHeight = oControlRow.ItemEx("HEIGHT", 0) Dim oWidth = oControlRow.ItemEx("WIDTH", 0) @@ -388,7 +394,7 @@ Public Class ClassControlCreator End Try End Function - Public Shared Function CreateExistingLabel(row As DataRow, designMode As Boolean) As Label + Public Function CreateExistingLabel(row As DataRow, designMode As Boolean) As Label Dim control As Label = CreateBaseControl(New Label(), row, designMode) Try control.Text = row.Item("CTRL_CAPTION_LANG") @@ -401,7 +407,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateExistingButton(row As DataRow, designMode As Boolean) As Button + Public Function CreateExistingButton(row As DataRow, designMode As Boolean) As Button Dim oControl As Button = CreateBaseControl(New Button(), row, designMode) Dim ctrl_image As Bitmap = Nothing @@ -430,7 +436,7 @@ Public Class ClassControlCreator Return oControl End Function - Public Shared Function CreateExistingCombobox(row As DataRow, designMode As Boolean) As Windows.Forms.ComboBox + Public Function CreateExistingCombobox(row As DataRow, designMode As Boolean) As Windows.Forms.ComboBox Dim control As Windows.Forms.ComboBox = CreateBaseControl(New Windows.Forms.ComboBox(), row, designMode) control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT")) @@ -447,7 +453,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateExistingDatepicker(row As DataRow, designMode As Boolean) As DateTimePicker + Public Function CreateExistingDatepicker(row As DataRow, designMode As Boolean) As DateTimePicker Dim control As DateTimePicker = CreateBaseControl(New DateTimePicker(), row, designMode) control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT")) @@ -461,7 +467,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateExisingCheckbox(row As DataRow, designMode As Boolean) As CheckBox + Public Function CreateExisingCheckbox(row As DataRow, designMode As Boolean) As CheckBox Dim oCheckBox As CheckBox = CreateBaseControl(New CheckBox(), row, designMode) oCheckBox.AutoSize = True @@ -480,7 +486,7 @@ Public Class ClassControlCreator Return oCheckBox End Function - Public Shared Function CreateExistingDataGridView(row As DataRow, designMode As Boolean) As DataGridView + Public Function CreateExistingDataGridView(row As DataRow, designMode As Boolean) As DataGridView Dim control As DataGridView = CreateBaseControl(New DataGridView(), row, designMode) control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT")) @@ -504,7 +510,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateExistingLookupControl(row As DataRow, designMode As Boolean) As LookupControl3 + Public Function CreateExistingLookupControl(row As DataRow, designMode As Boolean) As LookupControl3 Dim control As LookupControl3 = CreateBaseControl(New LookupControl3(), row, designMode) control.Properties.Name = control.Name control.Width = row.Item("WIDTH") @@ -517,7 +523,7 @@ Public Class ClassControlCreator Return control End Function - Public Shared Function CreateExistingGridControl(row As DataRow, DT_MY_COLUMNS As DataTable, designMode As Boolean) As GridControl + Public Function CreateExistingGridControl(row As DataRow, DT_MY_COLUMNS As DataTable, designMode As Boolean) As GridControl Dim oControl As GridControl = CreateBaseControl(New GridControl(), row, designMode) Dim oControlId = DirectCast(oControl.Tag, ControlMetadata).Guid Dim oDatatable As New DataTable @@ -830,9 +836,9 @@ Public Class ClassControlCreator Return oControl End Function - Private Shared newRowModified As Boolean = False + Private newRowModified As Boolean = False - Private Shared Sub View_ShowingEditor(sender As Object, e As CancelEventArgs) + Private Sub View_ShowingEditor(sender As Object, e As CancelEventArgs) Dim view As GridView = TryCast(sender, GridView) Logger.Debug("Showing editor.") If view.IsNewItemRow(view.FocusedRowHandle) AndAlso Not newRowModified Then @@ -841,7 +847,7 @@ Public Class ClassControlCreator End If End Sub - Private Shared Sub View_ShownEditor(sender As Object, e As EventArgs) + Private Sub View_ShownEditor(sender As Object, e As EventArgs) Dim view As GridView = TryCast(sender, GridView) If view.IsNewItemRow(view.FocusedRowHandle) Then Logger.Debug("Attaching Modified Handler.") @@ -852,7 +858,7 @@ Public Class ClassControlCreator End If End Sub - Private Shared Sub View_ValidateRow(sender As Object, e As ValidateRowEventArgs) + Private Sub View_ValidateRow(sender As Object, e As ValidateRowEventArgs) Dim view As GridView = TryCast(sender, GridView) If view.IsNewItemRow(e.RowHandle) AndAlso Not newRowModified Then Logger.Debug("Deleting unused row") @@ -863,7 +869,7 @@ Public Class ClassControlCreator newRowModified = False End Sub - Private Shared Sub View_ValidatingEditor(sender As Object, e As BaseContainerValidateEditorEventArgs) + Private Sub View_ValidatingEditor(sender As Object, e As BaseContainerValidateEditorEventArgs) Dim oValue As String = NotNull(e.Value, "") If oValue.Contains(" | ") Then @@ -872,11 +878,11 @@ Public Class ClassControlCreator End If End Sub - Private Shared Sub View_InvalidRowException(sender As Object, e As InvalidRowExceptionEventArgs) + Private Sub View_InvalidRowException(sender As Object, e As InvalidRowExceptionEventArgs) e.ExceptionMode = ExceptionMode.NoAction End Sub - Public Shared Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel + Public Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel Dim control As LineLabel = CreateBaseControl(New LineLabel(), row, designMode) control.Text = "------------------------------" control.BorderStyle = BorderStyle.None @@ -904,7 +910,7 @@ Public Class ClassControlCreator End Sub End Class - Public Shared Function GET_CONTROL_PROPERTIES(DT_CONTROL As DataTable, ControlName As String) + Public Function GET_CONTROL_PROPERTIES(DT_CONTROL As DataTable, ControlName As String) Try CURRENT_CONTROL_ID = 0 CURR_CON_ID = 0 @@ -938,7 +944,7 @@ Public Class ClassControlCreator End Try End Function - Public Shared Function GET_CONTROL_PROPERTY(DT_CONTROL As DataTable, ControlGUID As Integer, ColNAME As String) + Public Function GET_CONTROL_PROPERTY(DT_CONTROL As DataTable, ControlGUID As Integer, ColNAME As String) Try CURRENT_CONTROL_ID = 0 CURR_CON_ID = 0 @@ -965,7 +971,8 @@ Public Class ClassControlCreator End Try End Function - Public Shared Function GET_DEPENDING_CONTROLS(DT_CONTROLS As DataTable, ControlName As String) + + Public Function GetDependingControls(DT_CONTROLS As DataTable, ControlName As String) As Boolean Try Dim dt As New DataTable dt = DT_CONTROLS @@ -981,13 +988,12 @@ Public Class ClassControlCreator Catch ex As Exception Logger.Error(ex) Logger.Info("Unexpected Error in GET_DEPENDING_CONTROLS (" & ControlName & "):" & ex.Message) - Return 0 + Return False End Try End Function - Public Shared Function GET_CONNECTION_INFO(CON_ID As Integer) + Public Function GET_CONNECTION_INFO(CON_ID As Integer) As DataRow() Try - Dim dt As New DataTable dt = BASEDATA_DT_TBDD_CONNECTION ' Define the filter @@ -1004,10 +1010,9 @@ Public Class ClassControlCreator Logger.Info("Unexpected Error in GET_CONNECTION_INFO (" & CON_ID.ToString & "):" & ex.Message) Return Nothing End Try - End Function - Public Shared Sub GridTables_CacheDatatableForColumn(pControlId As Object, pColumnName As Object, pSqlStatement As Object, pConnectionId As Integer, pAdvancedLookup As Boolean) + Public Sub GridTables_CacheDatatableForColumn(pControlId As Object, pColumnName As Object, pSqlStatement As Object, pConnectionId As Integer, pAdvancedLookup As Boolean) Try 'Dim oTable As DataTable = ClassDatabase.Return_Datatable_ConId(pSqlStatement, pConnectionId) Dim oTable As DataTable = DatabaseFallback.GetDatatable(New GetDatatableOptions(pSqlStatement, DatabaseType.ECM) With { @@ -1032,7 +1037,7 @@ Public Class ClassControlCreator End Try End Sub - Public Shared Function GridTables_GetRepositoryItemForColumn(pColumnName As String, pDataTable As DataTable, pIsAdvancedLookup As Boolean) As RepositoryItem + Public Function GridTables_GetRepositoryItemForColumn(pColumnName As String, pDataTable As DataTable, pIsAdvancedLookup As Boolean) As RepositoryItem If pIsAdvancedLookup Then Dim oEditor = New RepositoryItemLookupControl3 @@ -1075,7 +1080,7 @@ Public Class ClassControlCreator End If End Function - Public Shared Sub GridTables_HandleControlValueChange(pControlPanel As XtraScrollableControl, pColumnsWithSqlAndControlPlaceholders As DataTable) + Public Sub GridTables_HandleControlValueChange(pControlPanel As XtraScrollableControl, pColumnsWithSqlAndControlPlaceholders As DataTable) If Not IsNothing(pColumnsWithSqlAndControlPlaceholders) AndAlso pColumnsWithSqlAndControlPlaceholders.Rows.Count > 0 Then For Each oRow As DataRow In pColumnsWithSqlAndControlPlaceholders.Rows Try @@ -1117,7 +1122,7 @@ Public Class ClassControlCreator End If End Sub - Private Shared Function GridTables_TestEditorExistsByControlAndColumn(oControlId As Integer, pColumn As String) As Boolean + Private Function GridTables_TestEditorExistsByControlAndColumn(oControlId As Integer, pColumn As String) As Boolean If GridTables.ContainsKey(oControlId) Then Dim oContainsKey = GridTables.Item(oControlId).ContainsKey(pColumn) If oContainsKey AndAlso GridTables.Item(oControlId).Item(pColumn) IsNot Nothing Then @@ -1130,7 +1135,7 @@ Public Class ClassControlCreator End If End Function - Private Shared Function GridTables_ValidateColumn(pView As GridView, pColumnDefinition As DataTable, ColumnName As String, pValue As Object, ByRef pIsValid As Boolean, ByRef pErrorText As String) As Boolean + Private Function GridTables_ValidateColumn(pView As GridView, pColumnDefinition As DataTable, ColumnName As String, pValue As Object, ByRef pIsValid As Boolean, ByRef pErrorText As String) As Boolean Dim oColumn As DataRow = (From r As DataRow In pColumnDefinition.Rows Where r.Item("SPALTENNAME") = ColumnName Select r).FirstOrDefault() diff --git a/app/TaskFlow/ClassFormat.vb b/app/TaskFlow/ClassFormat.vb index be528ba..5b84ce4 100644 --- a/app/TaskFlow/ClassFormat.vb +++ b/app/TaskFlow/ClassFormat.vb @@ -29,84 +29,6 @@ Public Class ClassFormat End Select End Function - Public Shared Function GetFormattedValue(pControlName As String, pValueObject As Object, pFormatString As String) As String - Try - If pFormatString <> String.Empty Then - ' https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tostring?view=net-7.0#system-datetime-tostring(system-string) - - Select Case pFormatString - Case ClassControlCreator.CONTROL_TYPE_CURRENCY ' 16,325.63 € - If TypeOf pValueObject Is Double Then - Dim oFormattedValue As Double = pValueObject - Return oFormattedValue.ToString(CURRENCY_FORMAT) - - ElseIf TypeOf pValueObject Is String Then - Dim oFormattedValue As Double - Double.TryParse(pValueObject, oFormattedValue) - Return oFormattedValue.ToString(CURRENCY_FORMAT) - - Else - Return Nothing - - End If - - Case ClassControlCreator.CONTROL_TYPE_DOUBLE ' 16325,63 - If TypeOf pValueObject Is Double Then - Dim oFormattedValue As Double = pValueObject - Return oFormattedValue.ToString(DECIMAL_FORMAT) - - ElseIf TypeOf pValueObject Is String Then - Dim oFormattedValue As Double - Double.TryParse(pValueObject, oFormattedValue) - Return oFormattedValue.ToString(DECIMAL_FORMAT) - - Else - Return Nothing - End If - - Case ClassControlCreator.CONTROL_TYPE_DATE ' 15.06.2008 - Dim oFormattedValue As DateTime - - If TypeOf pValueObject Is DateTime Then - oFormattedValue = pValueObject - Return oFormattedValue.ToString(DATE_FORMAT) - - ElseIf TypeOf pValueObject Is String Then - DateTime.TryParse(pValueObject, oFormattedValue) - Return oFormattedValue.ToString(DATE_FORMAT) - - Else - Return Nothing - End If - - Case ClassControlCreator.CONTROL_TYPE_DATETIME ' 15.06.2008 9:15:07 - Dim oFormattedValue As DateTime - - If TypeOf pValueObject Is DateTime Then - oFormattedValue = pValueObject - Return oFormattedValue.ToString(DATETIME_FORMAT) - ElseIf TypeOf pValueObject Is String Then - DateTime.TryParse(pValueObject, oFormattedValue) - Return oFormattedValue.ToString(DATETIME_FORMAT) - Else - Return Nothing - End If - - Case Else ' Unknown Format String - LOGGER.Warn("Format String [{0}] for Control [{1}] is not valid!", pFormatString, pControlName) - Return Nothing - - End Select - Else - Return Nothing - End If - Catch ex As Exception - LOGGER.Warn($"Unexpected error while formatting Value for Control [{0}]", pControlName) - LOGGER.Error(ex) - Return Nothing - End Try - End Function - ''' ''' Converts a string according to the type information, using the invariant culture ''' diff --git a/app/TaskFlow/ClassIDBData.vb b/app/TaskFlow/ClassIDBData.vb index 9bcc9a4..51c5742 100644 --- a/app/TaskFlow/ClassIDBData.vb +++ b/app/TaskFlow/ClassIDBData.vb @@ -133,7 +133,6 @@ End Function Public Function Delete_Term_Object_From_Metadata(oAttributeName As String, oTerm2Delete As String) As Object Try - Dim oAttributeValue Dim oID_IS_FOREIGN As Integer oID_IS_FOREIGN = 0 If IDB_USES_WMFILESTORE Then diff --git a/app/TaskFlow/clsPatterns.vb b/app/TaskFlow/clsPatterns.vb index 6690a7a..c83d068 100644 --- a/app/TaskFlow/clsPatterns.vb +++ b/app/TaskFlow/clsPatterns.vb @@ -4,6 +4,8 @@ Imports DigitalData.Controls.LookupGrid Imports DevExpress.XtraGrid Imports DevExpress.XtraGrid.Views.Grid Imports DevExpress.XtraGrid.Columns +Imports DevExpress.XtraEditors +Imports DigitalData.Modules.Language ''' ''' Defines common Functions for Checking for and replacing placeholders. ''' This Class also includes a child class `Pattern` for passing around Patterns. @@ -209,6 +211,9 @@ Public Class clsPatterns Case GetType(TextBox) oReplaceValue = oControl.Text + Case GetType(TextEdit) + oReplaceValue = Utils.NotNull(DirectCast(oControl, TextEdit).EditValue, String.Empty) + Case GetType(LookupControl3) Dim oLookupControl3 As LookupControl3 = oControl If oLookupControl3.Properties.SelectedValues.Count = 1 Then @@ -217,7 +222,7 @@ Public Class clsPatterns oReplaceValue = ERROR_REPLACE_VALUE End If - Case GetType(ComboBox) + Case GetType(Windows.Forms.ComboBox) oReplaceValue = oControl.Text Case GetType(CheckBox) diff --git a/app/TaskFlow/frmAdministration.vb b/app/TaskFlow/frmAdministration.vb index f1417ab..9835ed0 100644 --- a/app/TaskFlow/frmAdministration.vb +++ b/app/TaskFlow/frmAdministration.vb @@ -197,7 +197,7 @@ Public Class frmAdministration If tabctrl_Profilkonfig.SelectedIndex = 1 Then CURRENT_OBJECTTYPE = cmbObjekttypen.Text If TabControl2.SelectedIndex = 1 Then - Refresh_Final_indexe() + Refresh_Final_Indexes() End If End If Catch ex As Exception @@ -406,7 +406,7 @@ Public Class frmAdministration EditMode_Profile("Unlock") End Sub - Private Sub Refresh_Final_indexe() + Private Sub Refresh_Final_Indexes() _Logger.Debug("Loading Final Index Data") Try @@ -434,7 +434,7 @@ Public Class frmAdministration RibbonPageGroup4.Enabled = False Case 1 CURRENT_OBJECTTYPE = cmbObjekttypen.Text - Refresh_Final_indexe() + Refresh_Final_Indexes() CancelFinalIndexInsert() End Select @@ -628,7 +628,7 @@ Public Class frmAdministration Save_Profile() End If If UNSAVED_CHANGES_FI Then - Save_FI() + Save_Final_Indexes() End If e.Cancel = True Else @@ -721,7 +721,7 @@ Public Class frmAdministration pgFinalIndexes.Refresh() If oShouldRefreshGrid Then - Refresh_Final_indexe() + Refresh_Final_Indexes() End If Catch ex As Exception _Logger.Error(ex) @@ -1016,7 +1016,7 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem15_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem15.ItemClick - Refresh_Final_indexe() + Refresh_Final_Indexes() End Sub Private Sub BarButtonItem16_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem16.ItemClick @@ -1033,7 +1033,7 @@ Public Class frmAdministration If Not IsNothing(row) Then If MsgBox("Wollen Sie den Index wirklich löschen?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question) = MsgBoxResult.Yes Then TBPM_PROFILE_FINAL_INDEXINGTableAdapter.DeleteFinalIndex(row.Item("GUID")) - Refresh_Final_indexe() + Refresh_Final_Indexes() MsgBox("Index erfolgreich gelöscht!", MsgBoxStyle.Information, "Hinweis:") End If @@ -1041,11 +1041,10 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem18_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem18.ItemClick - Save_FI() - - Refresh_Final_indexe() + Save_Final_Indexes() + Refresh_Final_Indexes() End Sub - Private Sub Save_FI() + Private Sub Save_Final_Indexes() Try 'Dim obj As FinalIndexProperties = PropertyGrid1.SelectedObject Dim obj As FinalIndexProperties = pgFinalIndexes.SelectedObject @@ -1248,7 +1247,7 @@ Public Class frmAdministration End If If UNSAVED_CHANGES_FI Then - Save_FI() + Save_Final_Indexes() End If Return True @@ -1302,7 +1301,7 @@ Public Class frmAdministration tsbStaticInfo.Caption = "" Indexe_eintragen() If tabctrl_Profilkonfig.SelectedIndex = 1 And TBPM_PROFILEBindingSource.Position <> -1 Then - Refresh_Final_indexe() + Refresh_Final_Indexes() End If End Sub Private Sub GroupBox2_Enter(sender As Object, e As EventArgs) Handles GroupBox2.Enter @@ -1341,7 +1340,6 @@ Public Class frmAdministration End Function Private Sub BarButtonItem22_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem22.ItemClick - Dim oUpdate As String Dim oCtrlSeriesSQL As Button Dim oCtrlSeriesType As ComboBox Dim oCtrlSeriesArgument As TextBox diff --git a/app/TaskFlow/frmFormDesigner.vb b/app/TaskFlow/frmFormDesigner.vb index f6f6ec1..5b09222 100644 --- a/app/TaskFlow/frmFormDesigner.vb +++ b/app/TaskFlow/frmFormDesigner.vb @@ -21,7 +21,9 @@ Public Class frmFormDesigner ' Control Variables Private CurrentControl As Control = Nothing + Private _Logger = LOGCONFIG.GetLogger() + Private ControlCreator As ClassControlCreator ' Movement Variables Private Mouse_IsPressed As Boolean @@ -56,8 +58,7 @@ Public Class frmFormDesigner Private Sub frmFormDesigner_Load(sender As Object, e As EventArgs) Handles Me.Load Try - - ClassControlCreator.Logger = LOGCONFIG.GetLoggerFor("ControlCreator") + ControlCreator = New ClassControlCreator(LOGCONFIG) BarButtonItem3.Caption = "Designer locked" BarButtonItem3.ItemAppearance.Normal.BackColor = Color.Red Designer_Locked = True @@ -258,33 +259,33 @@ Public Class frmFormDesigner ' Jetzt die Control spezifischen Eigenschaften zuweisen Select Case row.Item("CTRL_TYPE") Case ClassControlCreator.PREFIX_TEXTBOX - Dim txt = ClassControlCreator.CreateExistingTextbox(row, True) + Dim txt = ControlCreator.CreateExistingTextbox(row, True) pnldesigner.Controls.Add(txt) SetMovementHandlers(txt) Case ClassControlCreator.PREFIX_LABEL - Dim lbl = ClassControlCreator.CreateExistingLabel(row, True) + Dim lbl = ControlCreator.CreateExistingLabel(row, True) pnldesigner.Controls.Add(lbl) SetMovementHandlers(lbl) Case "CMB" - Dim cmb = ClassControlCreator.CreateExistingCombobox(row, True) + Dim cmb = ControlCreator.CreateExistingCombobox(row, True) pnldesigner.Controls.Add(cmb) SetMovementHandlers(cmb) Case "DTP" - Dim dtp = ClassControlCreator.CreateExistingDatepicker(row, True) + Dim dtp = ControlCreator.CreateExistingDatepicker(row, True) pnldesigner.Controls.Add(dtp) SetMovementHandlers(dtp) Case "CHK" - Dim chk = ClassControlCreator.CreateExisingCheckbox(row, True) + Dim chk = ControlCreator.CreateExisingCheckbox(row, True) pnldesigner.Controls.Add(chk) SetMovementHandlers(chk) Case "DGV" - Dim dgv = ClassControlCreator.CreateExistingDataGridView(row, True) + Dim dgv = ControlCreator.CreateExistingDataGridView(row, True) pnldesigner.Controls.Add(dgv) SetMovementHandlers(dgv) @@ -296,7 +297,7 @@ Public Class frmFormDesigner Dim oDTColumnsPerDevExGrid As DataTable = DatabaseFallback.GetDatatableECM(oSQL) ', "FDesignLaodControls") - Dim table = ClassControlCreator.CreateExistingGridControl(row, oDTColumnsPerDevExGrid, True) + Dim table = ControlCreator.CreateExistingGridControl(row, oDTColumnsPerDevExGrid, True) AddHandler table.MouseClick, AddressOf gridControl_MouseClick ' AddHandler table.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick @@ -305,16 +306,16 @@ Public Class frmFormDesigner SetMovementHandlers(table) Case "LOOKUP" - Dim lookup = ClassControlCreator.CreateExistingLookupControl(row, True) + Dim lookup = ControlCreator.CreateExistingLookupControl(row, True) pnldesigner.Controls.Add(lookup) SetMovementHandlers(lookup) Case "LINE" - Dim line = ClassControlCreator.CreateExistingLine(row, True) + Dim line = ControlCreator.CreateExistingLine(row, True) pnldesigner.Controls.Add(line) SetMovementHandlers(line) Case "BUTTON" - Dim oButton = ClassControlCreator.CreateExistingButton(row, True) + Dim oButton = ControlCreator.CreateExistingButton(row, True) pnldesigner.Controls.Add(oButton) SetMovementHandlers(oButton) End Select @@ -1104,7 +1105,7 @@ Public Class frmFormDesigner Try Select Case ControlSelected Case ClassControlCreator.PREFIX_LABEL - Dim label = ClassControlCreator.CreateNewLabel(cursorPosition) + Dim label = ControlCreator.CreateNewLabel(cursorPosition) SetMovementHandlers(label) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, label.Name, "LBL", label.Text, label.Location.X, label.Location.Y, USER_USERNAME, label.Size.Height, label.Size.Width) @@ -1119,7 +1120,7 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(label) Case ClassControlCreator.PREFIX_TEXTBOX - Dim txt = ClassControlCreator.CreateNewTextBox(cursorPosition) + Dim txt = ControlCreator.CreateNewTextBox(cursorPosition) SetMovementHandlers(txt) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, txt.Name, "TXT", txt.Name, txt.Location.X, txt.Location.Y, USER_USERNAME, txt.Size.Height, txt.Size.Width) @@ -1133,7 +1134,7 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(txt) Case ClassControlCreator.PREFIX_COMBOBOX - Dim cmb = ClassControlCreator.CreateNewCombobox(cursorPosition) + Dim cmb = ControlCreator.CreateNewCombobox(cursorPosition) SetMovementHandlers(cmb) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, cmb.Name, "CMB", cmb.Name, cmb.Location.X, cmb.Location.Y, USER_USERNAME, cmb.Size.Height, cmb.Size.Width) @@ -1147,7 +1148,7 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(cmb) Case ClassControlCreator.PREFIX_DATETIMEPICKER - Dim dtp = ClassControlCreator.CreateNewDatetimepicker(cursorPosition) + Dim dtp = ControlCreator.CreateNewDatetimepicker(cursorPosition) SetMovementHandlers(dtp) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, dtp.Name, "DTP", dtp.Name, dtp.Location.X, dtp.Location.Y, USER_USERNAME, dtp.Size.Height, dtp.Size.Width) @@ -1161,7 +1162,7 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(dtp) Case ClassControlCreator.PREFIX_CHECKBOX - Dim chk = ClassControlCreator.CreateNewCheckbox(cursorPosition) + Dim chk = ControlCreator.CreateNewCheckbox(cursorPosition) SetMovementHandlers(chk) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, chk.Name, "CHK", chk.Text, chk.Location.X, chk.Location.Y, USER_USERNAME, chk.Size.Height, chk.Size.Width) @@ -1175,7 +1176,7 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(chk) Case ClassControlCreator.PREFIX_LOOKUP - Dim lc As LookupControl3 = ClassControlCreator.CreateNewLookupControl(cursorPosition) + Dim lc As LookupControl3 = ControlCreator.CreateNewLookupControl(cursorPosition) SetMovementHandlers(lc) @@ -1190,7 +1191,7 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(lc) Case ClassControlCreator.PREFIX_TABLE - Dim tb = ClassControlCreator.CreateNewTable(cursorPosition) + Dim tb = ControlCreator.CreateNewTable(cursorPosition) SetMovementHandlers(tb) AddHandler tb.MouseClick, AddressOf gridControl_MouseClick @@ -1210,7 +1211,7 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(tb) Case ClassControlCreator.PREFIX_LINE - Dim line = ClassControlCreator.CreateNewLine(cursorPosition) + Dim line = ControlCreator.CreateNewLine(cursorPosition) SetMovementHandlers(line) @@ -1225,7 +1226,7 @@ Public Class frmFormDesigner pnldesigner.Controls.Add(line) Case ClassControlCreator.PREFIX_BUTTON - Dim oButton = ClassControlCreator.CreateNewButton(cursorPosition) + Dim oButton = ControlCreator.CreateNewButton(cursorPosition) SetMovementHandlers(oButton) diff --git a/app/TaskFlow/frmMassValidator.vb b/app/TaskFlow/frmMassValidator.vb index 1f4ad84..f1a34c4 100644 --- a/app/TaskFlow/frmMassValidator.vb +++ b/app/TaskFlow/frmMassValidator.vb @@ -25,6 +25,7 @@ Public Class frmMassValidator Private CTRLS_Loaded As Boolean = False Private FORM_Shown As Boolean = False Private _dependingControl_in_action As Boolean = False + Private ControlCreator As ClassControlCreator Private oErrorMessage As String Private _windream As New ClassWindream_allgemein @@ -43,6 +44,7 @@ Public Class frmMassValidator '_windreamPM = New ClassPMWindream() '_windreamPM.Create_Session() + ControlCreator = New ClassControlCreator(LOGCONFIG) LOGGER.Debug("windream initialized frmMassValidator") @@ -146,7 +148,7 @@ Public Class frmMassValidator Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper Case ClassControlCreator.PREFIX_TEXTBOX LOGGER.Debug("Versuch TXT zu laden") - Dim txt As TextEdit = ClassControlCreator.CreateExistingTextbox(oControlRow, False) + Dim txt As TextEdit = ControlCreator.CreateExistingTextbox(oControlRow, False) AddHandler txt.GotFocus, AddressOf OnTextBoxFocus AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus @@ -155,19 +157,19 @@ Public Class frmMassValidator oControl = txt Case "LBL" LOGGER.Debug("Versuch LBL zu laden") - oControl = ClassControlCreator.CreateExistingLabel(oControlRow, False) + oControl = ControlCreator.CreateExistingLabel(oControlRow, False) Case "CMB" LOGGER.Debug("Versuch CMB zu laden") If oControlRow.Item("READ_ONLY") Then - Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False) + Dim cmbReadonly = ControlCreator.CreateExistingTextbox(oControlRow, False) oControl = cmbReadonly Else - Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False) + Dim cmb = ControlCreator.CreateExistingCombobox(oControlRow, False) AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex #Region "CONTROL LIST" - If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then + If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then MsgBox("Unexpected Error in getting control-properties (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) Exit Sub End If @@ -179,7 +181,7 @@ Public Class frmMassValidator LOGGER.Debug("ConID > 0 And commandsql <> ''") Dim connectionString As String - Dim ConRow As DataRow() = ClassControlCreator.GET_CONNECTION_INFO(CURR_CON_ID) + Dim ConRow As DataRow() = ControlCreator.GET_CONNECTION_INFO(CURR_CON_ID) If ConRow Is Nothing Then MsgBox("Unexpected Error in getting Coninfo (CMB load) - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) Exit Sub @@ -277,26 +279,7 @@ Public Class frmMassValidator End If #End Region - 'Dim oMaxWidth As Integer = cmb.Width - 'Using oGraphics As Graphics = cmb.CreateGraphics() - ' Dim oStringLength = oGraphics.MeasureString(Text, cmb.Font).Width - ' If oStringLength + 30 > oMaxWidth Then - ' oMaxWidth = oStringLength + 30 - ' End If - 'End Using - - 'Using g As Graphics = Me.CreateGraphics - ' For Each oItem As Object In cmb.Items 'Für alle Einträge... - ' Dim g1 As Graphics = cmb.CreateGraphics - ' If g1.MeasureString(Text, cmb.Font).Width + 30 > oMaxWidth Then - ' oMaxWidth = g1.MeasureString(Text, cmb.Font).Width + 30 - ' End If - ' g1.Dispose() - ' Next oItem - 'End Using - - 'cmb.DropDownWidth = oMaxWidth @@ -311,10 +294,10 @@ Public Class frmMassValidator Case "DTP" LOGGER.Debug("Versuch DTP zu laden") - oControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False) + oControl = ControlCreator.CreateExistingDatepicker(oControlRow, False) Case "DGV" LOGGER.Debug("Versuch DGV zu laden") - Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False) + Dim dgv = ControlCreator.CreateExistingDataGridView(oControlRow, False) AddHandler dgv.RowValidating, AddressOf onDGVRowValidating @@ -322,20 +305,20 @@ Public Class frmMassValidator Case "CHK" LOGGER.Debug("Versuch Checkbox zu laden") - oControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False) + oControl = ControlCreator.CreateExisingCheckbox(oControlRow, False) Case "LINE" LOGGER.Debug("Versuch Linie zu laden") - oControl = ClassControlCreator.CreateExistingLine(oControlRow, False) + oControl = ControlCreator.CreateExistingLine(oControlRow, False) Case "LOOKUP" Dim oMultiselect = oControlRow.Item("MULTISELECT") Dim oReadonly = oControlRow.Item("READ_ONLY") If oMultiselect = False And oReadonly = True Then - Dim lookupReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False) + Dim lookupReadonly = ControlCreator.CreateExistingTextbox(oControlRow, False) oControl = lookupReadonly Else - Dim lookup As LookupControl3 = ClassControlCreator.CreateExistingLookupControl(oControlRow, False) + Dim lookup As LookupControl3 = ControlCreator.CreateExistingLookupControl(oControlRow, False) lookup.Properties.PreventDuplicates = oControlRow.Item("VKT_PREVENT_MULTIPLE_VALUES") lookup.Properties.AllowAddNewValues = oControlRow.Item("VKT_ADD_ITEM") @@ -373,7 +356,7 @@ Public Class frmMassValidator LOGGER.Debug("Versuch Tabelle zu laden") Dim oDTMyColumns As DataTable = DatabaseFallback.GetDatatableECM($"SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = {oControlRow.Item("GUID")} ORDER BY SEQUENCE") ', "MV_LoadControls1") - oControl = ClassControlCreator.CreateExistingGridControl(oControlRow, oDTMyColumns, False) + oControl = ControlCreator.CreateExistingGridControl(oControlRow, oDTMyColumns, False) End Select If oControl IsNot Nothing AndAlso TypeOf oControl IsNot Label Then @@ -451,7 +434,6 @@ Public Class frmMassValidator Sub FillIndexValues() Dim controltype As String Dim indexname As String - Dim resultvalue Try For Each oControl As Control In Me.pnldesigner.Controls @@ -849,12 +831,12 @@ Public Class frmMassValidator If (e.KeyCode = Keys.Return) Or (e.KeyCode = Keys.Tab) Or (e.KeyCode = Keys.Enter) Then Try - If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, box.Name) = 0 Then + If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, box.Name) = 0 Then MsgBox("Unexpected Error in getting control-properties - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) Exit Sub End If - If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, box.Name) = False Then + If ControlCreator.GetDependingControls(DTCONTROLS, box.Name) = False Then MsgBox("Unexpected Error in getting dependent controls - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) Exit Sub End If @@ -953,15 +935,15 @@ Public Class frmMassValidator End Try End Sub Public Sub OnCmbselectedIndex(sender As System.Object, e As System.EventArgs) - Dim cmb As ComboBox = sender + Dim cmb As Windows.Forms.ComboBox = sender If cmb.SelectedIndex <> -1 And CTRLS_Loaded = True And FORM_Shown = True Then ' Try - If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then + If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, cmb.Name) = 0 Then MsgBox("Unexpected Error in getting control-properties CMB - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) Exit Sub End If - If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, cmb.Name) = False Then + If ControlCreator.GetDependingControls(DTCONTROLS, cmb.Name) = False Then MsgBox("Unexpected Error in getting dependent controls CMB- Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) Exit Sub End If @@ -999,12 +981,12 @@ Public Class frmMassValidator Public Sub onDGVRowValidating(ByVal sender As Object, ByVal e As DataGridViewCellCancelEventArgs) Dim dgv As DataGridView = sender Try - If ClassControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, dgv.Name) = 0 Then + If ControlCreator.GET_CONTROL_PROPERTIES(DTCONTROLS, dgv.Name) = 0 Then MsgBox("Unexpected Error in getting control-properties DGV - Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) Exit Sub End If - If ClassControlCreator.GET_DEPENDING_CONTROLS(DTCONTROLS, dgv.Name) = False Then + If ControlCreator.GetDependingControls(DTCONTROLS, dgv.Name) = False Then MsgBox("Unexpected Error in getting dependent controls DGV- Check the log and inform Your sysadmin!", MsgBoxStyle.Critical) Exit Sub End If @@ -1228,7 +1210,7 @@ Public Class frmMassValidator End Try Case GetType(System.Windows.Forms.ComboBox) - Dim cmb As ComboBox = oControl + Dim cmb As Windows.Forms.ComboBox = oControl Try value_from_control = cmb.Text Catch ex As Exception diff --git a/app/TaskFlow/frmValidator.vb b/app/TaskFlow/frmValidator.vb index 9530449..9e424f9 100644 --- a/app/TaskFlow/frmValidator.vb +++ b/app/TaskFlow/frmValidator.vb @@ -83,19 +83,8 @@ Public Class frmValidator Private Property _dependingColumn_in_action As Boolean = False Private Property _SetControlValue_in_action As Boolean = False - Private Property DTConversations As DataTable - Private Property DTDYNAMIC_RIGHTS As DataTable - Private Property DT_AdditionalSearches_Resultset_Docs As DataTable - Private Property Right_Conversation_Add As Boolean = False - Private Property Right_Conversation_Stop As Boolean = False - Private Property Right_Conversation_Message As Boolean = False - - Private Property Conversation_User_Active As Boolean = False - Private Property ConversationQUDT_Delete As DataTable - Private Property Conversation_initialized As Boolean = False - Public Property FormLoaded As Boolean = False Private Property ItemWorked As Boolean = False Private Property Override As Boolean = False @@ -104,7 +93,10 @@ Public Class frmValidator Private Property listChangedLookup As New List(Of String) Private Property ControlHandleStarted As Boolean = False + Private Documentloader As Loader + Private ControlCreator As ClassControlCreator + Private Property OperationMode As OperationMode Private ReadOnly Environment As Environment Private AdditionalDocResultsExist As Boolean = False @@ -159,7 +151,7 @@ Public Class frmValidator OperationMode = GetOperationMode() Documentloader = New Loader(LOGCONFIG, OperationMode, Environment.Service.Client, Environment.User) - + ControlCreator = New ClassControlCreator(LOGCONFIG) PMDelimiter = "~" Override = False @@ -169,8 +161,7 @@ Public Class frmValidator OLD_Document_Path = "" first_control = Nothing me_closing = False - 'pdfxchange = False - 'sumatra = False + FormLoaded = False Attmt_bbtnitmShow.Visibility = BarItemVisibility.Never Attmnt_bbtnitm_LoadonClick.Visibility = BarItemVisibility.Never @@ -617,7 +608,21 @@ Public Class frmValidator End If Dim oValue - If TypeOf control Is TextEdit Then + ' Because LookupControl is a subtype of TextEdit, + ' we need to check for LookupControl first! + If TypeOf control Is LookupControl3 Then + Try + Dim lookup As LookupControl3 = control + + lookup.Properties.DataSource = oDTContent + lookup.Properties.ValueMember = oDTContent.Columns.Item(0).ColumnName + lookup.Properties.DisplayMember = oDTContent.Columns.Item(0).ColumnName + Catch ex As Exception + + LOGGER.Warn("Error in LookUpLoadSQLData: " & ex.Message) + End Try + + ElseIf TypeOf control Is TextEdit Then Try Dim firstRow As DataRow = oDTContent.Rows(0) @@ -629,7 +634,7 @@ Public Class frmValidator LOGGER.Warn("Error in TextBoxLoadSQLData: " & ex.Message) End Try - ElseIf TypeOf control Is ComboBox Then + ElseIf TypeOf control Is Windows.Forms.ComboBox Then Try Dim oMyComboBox As Windows.Forms.ComboBox = control Dim oselectedIndex = oMyComboBox.SelectedIndex @@ -646,17 +651,7 @@ Public Class frmValidator Catch ex As Exception LOGGER.Warn("Error in ComboBoxLoadSQLData: " & ex.Message) End Try - ElseIf TypeOf control Is LookupControl3 Then - Try - Dim lookup As LookupControl3 = control - lookup.Properties.DataSource = oDTContent - lookup.Properties.ValueMember = oDTContent.Columns.Item(0).ColumnName - lookup.Properties.DisplayMember = oDTContent.Columns.Item(0).ColumnName - Catch ex As Exception - - LOGGER.Warn("Error in LookUpLoadSQLData: " & ex.Message) - End Try ElseIf TypeOf control Is GridControl Then Try Dim dataGridView As GridControl = control @@ -761,8 +756,6 @@ Public Class frmValidator Dim oTabIndexCounter As Integer = 0 - ClassControlCreator.Logger = LOGCONFIG.GetLoggerFor("ControlCreator") - For Each oControlRow As DataRow In DT_CONTROLS.Rows Dim oMyControl As Control Dim oControlID = oControlRow.Item("GUID") @@ -774,7 +767,7 @@ Public Class frmValidator oControlInfo = ClassControlCreator.PREFIX_TEXTBOX & "#" & oControlInfo LOGGER.Debug($"[{oControlInfo}] - TXT Try to create control...") - Dim txt As TextEdit = ClassControlCreator.CreateExistingTextbox(oControlRow, False) + Dim txt As TextEdit = ControlCreator.CreateExistingTextbox(oControlRow, False) AddHandler txt.GotFocus, AddressOf OnTextBoxFocus AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp @@ -786,15 +779,15 @@ Public Class frmValidator End Try Case "LBL" oControlInfo = "LBL#" & oControlInfo - oMyControl = ClassControlCreator.CreateExistingLabel(oControlRow, False) + oMyControl = ControlCreator.CreateExistingLabel(oControlRow, False) Case "CMB" oControlInfo = "CMB#" & oControlInfo LOGGER.Debug($"[{oControlInfo}] - CMB Try to create control...") If oControlRow.Item("READ_ONLY") Then - Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False) + Dim cmbReadonly = ControlCreator.CreateExistingTextbox(oControlRow, False) oMyControl = cmbReadonly Else - Dim oComboBox = ClassControlCreator.CreateExistingCombobox(oControlRow, False) + Dim oComboBox = ControlCreator.CreateExistingCombobox(oControlRow, False) AddHandler oComboBox.SelectedValueChanged, AddressOf OnCmbselectedIndex AddHandler oComboBox.GotFocus, Sub(sender As Control, e As EventArgs) @@ -878,10 +871,10 @@ Public Class frmValidator Case "DTP" oControlInfo = "DTP#" & oControlInfo - oMyControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False) + oMyControl = ControlCreator.CreateExistingDatepicker(oControlRow, False) Case "DGV" - Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False) + Dim dgv = ControlCreator.CreateExistingDataGridView(oControlRow, False) AddHandler dgv.RowValidating, AddressOf onDGVRowValidating @@ -893,10 +886,10 @@ Public Class frmValidator Dim oReadonly = oControlRow.Item("READ_ONLY") If oMultiselect = False And oReadonly = True Then - Dim lookupReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False) + Dim lookupReadonly = ControlCreator.CreateExistingTextbox(oControlRow, False) oMyControl = lookupReadonly Else - Dim lookup As LookupControl3 = ClassControlCreator.CreateExistingLookupControl(oControlRow, False) + Dim lookup As LookupControl3 = ControlCreator.CreateExistingLookupControl(oControlRow, False) lookup.Properties.PreventDuplicates = oControlRow.Item("VKT_PREVENT_MULTIPLE_VALUES") lookup.Properties.AllowAddNewValues = oControlRow.Item("VKT_ADD_ITEM") @@ -958,7 +951,7 @@ Public Class frmValidator Case "CHK" oControlInfo = "CHK#" & oControlInfo - oMyControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False) + oMyControl = ControlCreator.CreateExisingCheckbox(oControlRow, False) Dim mycheckbox As CheckBox = oMyControl AddHandler mycheckbox.CheckedChanged, AddressOf onCheckBox_CheckedChange @@ -977,7 +970,7 @@ Public Class frmValidator Continue For End If - Dim oGrid = ClassControlCreator.CreateExistingGridControl(oControlRow, oFilteredDatatable, False) + Dim oGrid = ControlCreator.CreateExistingGridControl(oControlRow, oFilteredDatatable, False) AddHandler oGrid.ProcessGridKey, Sub(ByVal _sender As Object, ByVal e As KeyEventArgs) If e.KeyCode = Keys.Tab Then @@ -1001,9 +994,9 @@ Public Class frmValidator oMyControl = oGrid Case "LINE" - oMyControl = ClassControlCreator.CreateExistingLine(oControlRow, False) + oMyControl = ControlCreator.CreateExistingLine(oControlRow, False) Case "BUTTON" - Dim obutton = ClassControlCreator.CreateExistingButton(oControlRow, False) + Dim obutton = ControlCreator.CreateExistingButton(oControlRow, False) AddHandler obutton.Click, AddressOf onCustomButtonClick oMyControl = obutton @@ -1056,7 +1049,7 @@ Public Class frmValidator Case GetType(DevExpress.XtraEditors.TextEdit) inctrl.Text = "" Case GetType(System.Windows.Forms.ComboBox) - Dim cmb As ComboBox = inctrl + Dim cmb As Windows.Forms.ComboBox = inctrl cmb.SelectedIndex = -1 Case GetType(System.Windows.Forms.DataGridView) Dim dgv As DataGridView = inctrl @@ -1097,7 +1090,7 @@ Public Class frmValidator SetControlValues_FromControl(oTextbox) - ClassControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) + ControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) End Sub Private Function GetControlID(ByVal PROFILEID As Integer, Controlname As String) @@ -1148,7 +1141,7 @@ Public Class frmValidator End If - ClassControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) + ControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) Catch ex As Exception LOGGER.Error(ex) @@ -1165,7 +1158,7 @@ Public Class frmValidator Private Sub onCustomButtonClick(sender As System.Object, e As System.EventArgs) Dim oButton As Button = sender Dim oControlID = DirectCast(oButton.Tag, ClassControlCreator.ControlMetadata).Guid - Dim oSQL = ClassControlCreator.GET_CONTROL_PROPERTY(DT_CONTROLS, oControlID, "SQL_UEBERPRUEFUNG") + Dim oSQL = ControlCreator.GET_CONTROL_PROPERTY(DT_CONTROLS, oControlID, "SQL_UEBERPRUEFUNG") If IsNothing(oSQL) Then LOGGER.Warn("onCustomButtonClick - SQL_UEBERPRUEFUNG IS NOTHING") Exit Sub @@ -1175,7 +1168,7 @@ Public Class frmValidator LOGGER.Warn("onCustomButtonClick - Check_UpdateIndexe = False >> Exit Click") Exit Sub End If - Override_SQLCommand = ClassControlCreator.GET_CONTROL_PROPERTY(DT_CONTROLS, oControlID, "SQL2") + Override_SQLCommand = ControlCreator.GET_CONTROL_PROPERTY(DT_CONTROLS, oControlID, "SQL2") If IsNothing(Override_SQLCommand) Then Override_SQLCommand = "" End If @@ -1395,7 +1388,7 @@ Public Class frmValidator Dim oLookup As RepositoryItemLookupControl3 = sender listChangedLookup.Add(oLookup.Name) - ClassControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) + ControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) Catch ex As Exception LOGGER.Error(ex) End Try @@ -1413,7 +1406,7 @@ Public Class frmValidator Checkbox_EnablingControls(oCheckbox) CheckBox_DependingColumn(oCheckbox) SetControlValues_FromControl(oCheckbox) - ClassControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) + ControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) Catch ex As Exception LOGGER.Error(ex) End Try @@ -1959,7 +1952,7 @@ Public Class frmValidator Dim oControlId = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid If oControlId = oDEPENDING_CONTROL_ID Then - ClassControlCreator.GridTables_CacheDatatableForColumn(oControlId, oDEPENDING_COLUMN, oSqlCommand, oCONNID, oAdvancedLookup) + ControlCreator.GridTables_CacheDatatableForColumn(oControlId, oDEPENDING_COLUMN, oSqlCommand, oCONNID, oAdvancedLookup) _dependingColumn_in_action = False Exit For End If @@ -2003,7 +1996,7 @@ Public Class frmValidator For Each oControl As Control In PanelValidatorControl.Controls Dim oControlId = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_CONTROL_ID Then - ClassControlCreator.GridTables_CacheDatatableForColumn(oControlId, oDEPENDING_COLUMN, oSqlCommand, oCONNID, oAdvancedLookup) + ControlCreator.GridTables_CacheDatatableForColumn(oControlId, oDEPENDING_COLUMN, oSqlCommand, oCONNID, oAdvancedLookup) _dependingColumn_in_action = False Exit For End If @@ -2019,7 +2012,7 @@ Public Class frmValidator End Sub Public Sub OnCmbselectedIndex(sender As System.Object, e As System.EventArgs) - Dim oCombobox As ComboBox = sender + Dim oCombobox As Windows.Forms.ComboBox = sender If oCombobox.SelectedIndex <> -1 And _Indexe_Loaded = True Then If oCombobox.Name = last_control.Name Then 'Abschluss() @@ -2060,7 +2053,7 @@ Public Class frmValidator Next End If - ClassControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) + ControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) Controls2beEnabled(oCombobox.Name) @@ -2990,12 +2983,12 @@ Public Class frmValidator If DTVWCONTROL_INDEX.Rows.Count > 0 Then Dim oCount As Integer = 0 For Each oControl As Control In Me.PanelValidatorControl.Controls - If SingleAttribute <> "" Then - oIDBOverride = True - If SingleAttribute <> oControl.Name Then - Continue For - End If - End If + 'If SingleAttribute <> "" Then + ' oIDBOverride = True + ' If SingleAttribute <> oControl.Name Then + ' Continue For + ' End If + 'End If Dim oValueFromSource Dim oFormattedValue As String = "" @@ -3104,7 +3097,7 @@ Public Class frmValidator End Try - ClassControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) + ControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER) Catch ex As Exception @@ -3285,25 +3278,6 @@ Public Class frmValidator oDataSource.Rows.Add(oRowData.ToArray()) - 'Select Case oColValuesfromSource.Length - ' Case 1 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0)}) - ' Case 2 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1)}) - ' Case 3 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2)}) - ' Case 4 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3)}) - ' Case 5 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3), oColValuesfromSource(4)}) - ' Case 6 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3), oColValuesfromSource(4), oColValuesfromSource(5)}) - ' Case 7 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3), oColValuesfromSource(4), oColValuesfromSource(5), oColValuesfromSource(6)}) - ' Case 8 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3), oColValuesfromSource(4), oColValuesfromSource(5), oColValuesfromSource(6), oColValuesfromSource(7)}) - 'End Select - ElseIf oValueType = "System.Data.DataTable" Then Dim oMyDatatable As DataTable = oValueFromSource @@ -3327,25 +3301,6 @@ Public Class frmValidator oDataSource.Rows.Add(oRowData.ToArray()) - 'Select Case oColValuesfromSource.Length - ' Case 1 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0)}) - ' Case 2 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1)}) - ' Case 3 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2)}) - ' Case 4 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3)}) - ' Case 5 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3), oColValuesfromSource(4)}) - ' Case 6 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3), oColValuesfromSource(4), oColValuesfromSource(5)}) - ' Case 7 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3), oColValuesfromSource(4), oColValuesfromSource(5), oColValuesfromSource(6)}) - ' Case 8 - ' oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3), oColValuesfromSource(4), oColValuesfromSource(5), oColValuesfromSource(6), oColValuesfromSource(7)}) - 'End Select - Next End If @@ -3634,7 +3589,7 @@ Public Class frmValidator For Each oControl As Control In PanelValidatorControl.Controls Dim oControlId = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid If oControlId = oDEPENDING_CTRL_ID Then - ClassControlCreator.GridTables_CacheDatatableForColumn(oControlId, oDEPENDING_COLUMN, oSqlCommand, oCONNID, oAdvancedLookup) + ControlCreator.GridTables_CacheDatatableForColumn(oControlId, oDEPENDING_COLUMN, oSqlCommand, oCONNID, oAdvancedLookup) Exit For End If Next @@ -4181,7 +4136,7 @@ Public Class frmValidator End Try Case GetType(System.Windows.Forms.ComboBox) - Dim cmb As ComboBox = oControl + Dim cmb As Windows.Forms.ComboBox = oControl Try value_from_control = cmb.Text Catch ex As Exception @@ -4328,17 +4283,24 @@ Public Class frmValidator btnSave.Enabled = True End Sub - Function Check_Missing(control As Control, typ As String) As Boolean + + Function Check_Missing_Control_Value(control As Control, typ As String) As Boolean Select Case typ Case "txt" Dim oTextBox As TextEdit = control - If oTextBox.Text = String.Empty Then + + If IsNothing(oTextBox.EditValue) Then + Return True + End If + + If oTextBox.EditValue.ToString = String.Empty Then Return True End If End Select Return False End Function + Function Return_PM_VEKTOR(input As String, VKTBezeichner As String) Dim PM_String As String Try @@ -4673,7 +4635,7 @@ Public Class frmValidator End If 'as erstes überprüfen ob überhaupt etwas eingetragen worden ist - If Check_Missing(oControl, "txt") = True And oIsRequired = True Then 'NICHTS EINGETRAGEN + If Check_Missing_Control_Value(oControl, "txt") = True And oIsRequired = True Then 'NICHTS EINGETRAGEN oMissing = True oErrMsgMissingInput = oWrongInputMessage & " textbox '" & oControl.Name & "'" LOGGER.Warn(oErrMsgMissingInput)