From 20d93efcc1c4bda211dfb62410b51105a08584ed Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 16 Aug 2022 16:13:25 +0200 Subject: [PATCH] fix loading control name list --- app/DD_PM_WINDREAM/frmAdministration.vb | 75 +++++++++++++++---------- app/DD_PM_WINDREAM/frmFormDesigner.vb | 69 +++++++++++++---------- 2 files changed, 85 insertions(+), 59 deletions(-) diff --git a/app/DD_PM_WINDREAM/frmAdministration.vb b/app/DD_PM_WINDREAM/frmAdministration.vb index 753341a..2b02773 100644 --- a/app/DD_PM_WINDREAM/frmAdministration.vb +++ b/app/DD_PM_WINDREAM/frmAdministration.vb @@ -7,6 +7,7 @@ Imports DevExpress.XtraGrid.Views.Base Imports DevExpress.XtraGrid.Views.Grid Imports DigitalData.GUIs.Common Imports DigitalData.Modules.Language.Utils +Imports DigitalData.Modules.Logging Public Class frmAdministration Private UNSAVED_CHANGES_PROFILE As Boolean = False @@ -17,12 +18,15 @@ Public Class frmAdministration Private ReadOnly email As New ClassEmail Private FormDesigner As frmFormDesigner + Private _Logger As Logger = LOGCONFIG.GetLogger() Private Property profile_guid As Integer = 0 Private Property DT_CHART_CONFIG As DataTable Private Property PROF_ORIGIN As DataTable Private Sub frmAdministration_Load(sender As Object, e As System.EventArgs) Handles Me.Load + _Logger.Debug("Loading Administration") + FORM_LOADED = False UNSAVED_CHANGES_PROFILE = False Try @@ -57,7 +61,7 @@ Public Class frmAdministration tabctrl_Profilkonfig.SelectedIndex = 0 Catch ex As Exception - LOGGER.Error(ex) + _Logger.Error(ex) MsgBox("Fehler bei Laden der Wertehilfen und Konfig-Daten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try If IDB_ACTIVE = True Then @@ -77,6 +81,8 @@ Public Class frmAdministration ObjekttypenEintragen() Indexe_eintragen() ' RibbonPageGroupProfile.Enabled = False + + _Logger.Debug("Administration loaded!") End Sub Sub Indexe_eintragen() If cmbObjekttypen.Text <> "" Then @@ -128,7 +134,7 @@ Public Class frmAdministration ' MyIndicies_Types.Add(type) 'Next Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Error in GetIndices windream: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") PM_VEKTOR_INDEXComboBox.SelectedIndex = -1 cmbLOGIndex.SelectedIndex = -1 @@ -163,7 +169,7 @@ Public Class frmAdministration MyIndicies_Types.Add(type) Next Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Error in GetIndices IDB: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try @@ -177,6 +183,8 @@ Public Class frmAdministration End Sub Sub Refresh_Profildaten() + _Logger.Debug("Loading Profile Data") + Try BINDINGSOURCE_CHANGING = True CHANGES_FORM_DESIGN = True @@ -193,10 +201,11 @@ Public Class frmAdministration End If End If Catch ex As Exception - LOGGER.Error(ex) + _Logger.Error(ex) MsgBox("Fehler bei Refresh_Profildaten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") Finally BINDINGSOURCE_CHANGING = False + _Logger.Debug("Loading Profile Data done!") End Try End Sub Private Sub ObjekttypenEintragen() @@ -209,7 +218,7 @@ Public Class frmAdministration Me.cmbObjekttypen.Items.Add(aType.aName) Next Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Es konnte keine Verbindung zum windream-Server hergestellt werden.", MsgBoxStyle.Critical, "Fehler beim Zugriff auf windream-Server") End Try Else @@ -260,7 +269,7 @@ Public Class frmAdministration p.Close() End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei öffnen der windream-Suche:") End Try End Sub @@ -301,7 +310,7 @@ Public Class frmAdministration Catch ex As Exception 'Profilzuordnung' - LOGGER.Error(ex) + _LOGGER.Error(ex) End Try End Sub @@ -329,7 +338,7 @@ Public Class frmAdministration TBPROFILE_USERTableAdapter.CMDInsert(profileId, userId, USER_USERNAME) FillProfile_Zuordnung(profileId) Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Hinzufügen eines Users:") End Try End Sub @@ -343,7 +352,7 @@ Public Class frmAdministration TBPROFILE_USERTableAdapter.CmdDelete(profileId, userId) FillProfile_Zuordnung(profileId) Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Entfernen eines Users:") End Try End Sub @@ -359,7 +368,7 @@ Public Class frmAdministration ' TBPROFILE_USERTableAdapter.CMDInsert(profileId, userId, USER_USERNAME) FillProfile_Zuordnung(profileId) Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Hinzufügen einer Gruppe:") End Try End Sub @@ -375,7 +384,7 @@ Public Class frmAdministration 'TBPROFILE_USERTableAdapter.cmdDelete(userId) FillProfile_Zuordnung(profileId) Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Entfernen einer Gruppe:") End Try End Sub @@ -388,9 +397,9 @@ Public Class frmAdministration EditMode_Profile("Unlock") End Sub - - Private Sub Refresh_Final_indexe() + _Logger.Debug("Loading Final Index Data") + Try 'Me.lblSaveFinalIndex.Visible = False If FORM_LOADED = False Then Exit Sub @@ -404,6 +413,8 @@ Public Class frmAdministration Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Refresh_Final_indexe:") + Finally + _Logger.Debug("Loading Final Index Data done!") End Try End Sub @@ -531,7 +542,7 @@ Public Class frmAdministration SQLconnection.Close() Return True Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Fehler in Execute_SQL: " & vbNewLine & ex.Message & vbNewLine & vbNewLine & " SQL: " & SQL) Return False End Try @@ -573,7 +584,7 @@ Public Class frmAdministration Try Me.TBDD_USERTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBDD_USER) Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Fehler bei LoadUsers: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try End Sub @@ -698,9 +709,9 @@ Public Class frmAdministration Refresh_Final_indexe() End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox($"Error while loading Final Index properties: {ex.Message}", MsgBoxStyle.Critical) - LOGGER.Info($"Error while loading Final Index properties: {ex.Message}") + _LOGGER.Info($"Error while loading Final Index properties: {ex.Message}") End Try End Sub @@ -742,7 +753,7 @@ Public Class frmAdministration propertyGrid.Refresh() End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) Finally UNSAVED_CHANGES_FI = True End Try @@ -802,7 +813,7 @@ Public Class frmAdministration End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Fehler bei Anlage Profilkopie:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try @@ -824,7 +835,7 @@ Public Class frmAdministration End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Fehler bei Löschen des Profils:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler:") End Try @@ -863,7 +874,7 @@ Public Class frmAdministration tsbStaticInfo.Caption = "" End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) If ex.Message.Contains("DataTable-Index") = False Then MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei Speichern des Profils:") End If @@ -878,7 +889,7 @@ Public Class frmAdministration Try TBPM_PROFILEBindingSource.AddNew() Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) End Try End If @@ -921,7 +932,7 @@ Public Class frmAdministration End If Catch ex As Exception MsgBox("Fehler beim Speichern: " & vbNewLine & vbNewLine & ex.Message) - LOGGER.Error(ex) + _LOGGER.Error(ex) End Try End Sub @@ -1035,9 +1046,9 @@ Public Class frmAdministration End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Error while Saving Final Index: " & ex.Message, MsgBoxStyle.Critical) - LOGGER.Info("Error while Saving Final Index: " & ex.Message) + _LOGGER.Info("Error while Saving Final Index: " & ex.Message) Finally BarButtonItem19.Visibility = DevExpress.XtraBars.BarItemVisibility.Never BarButtonItem16.Visibility = DevExpress.XtraBars.BarItemVisibility.Always @@ -1070,7 +1081,7 @@ Public Class frmAdministration End If Catch ex As Exception MsgBox("Error in Saving SQL Overview: " & vbNewLine & vbNewLine & ex.Message) - LOGGER.Error(ex) + _LOGGER.Error(ex) End Try End Sub @@ -1101,7 +1112,7 @@ Public Class frmAdministration End If Catch ex As Exception MsgBox("Error in Saving Profile SQL: " & vbNewLine & vbNewLine & ex.Message) - LOGGER.Error(ex) + _LOGGER.Error(ex) End Try End Sub @@ -1133,7 +1144,7 @@ Public Class frmAdministration End If Catch ex As Exception MsgBox("Error in Saving Profile SQLFinish: " & vbNewLine & vbNewLine & ex.Message) - LOGGER.Error(ex) + _LOGGER.Error(ex) End Try End Sub Function CHECK_QUESTION_CHANGES() As Boolean @@ -1175,15 +1186,21 @@ Public Class frmAdministration If FORM_LOADED = False Or UNSAVED_CHANGES_PROFILE = True Or UNSAVED_CHANGES_FI = True Or BINDINGSOURCE_CHANGING = True Then Exit Sub End If + + + BINDINGSOURCE_CHANGING = True If TabControl1.SelectedIndex = 1 And FORM_LOADED Then Try Dim profileId As Integer = GetCurrentProfileId() + + _Logger.Debug("Loading Profile [{0}]", profileId) + If Not IsNothing(profileId) Then FillProfile_Zuordnung(profileId) End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox($"Error while calling FillProfile_User", MsgBoxStyle.Critical) End Try End If diff --git a/app/DD_PM_WINDREAM/frmFormDesigner.vb b/app/DD_PM_WINDREAM/frmFormDesigner.vb index 0121e7f..19ef0a2 100644 --- a/app/DD_PM_WINDREAM/frmFormDesigner.vb +++ b/app/DD_PM_WINDREAM/frmFormDesigner.vb @@ -19,6 +19,7 @@ Public Class frmFormDesigner ' Control Variables Private CurrentControl As Control = Nothing + Private _Logger = LOGCONFIG.GetLogger() ' Movement Variables Private Mouse_IsPressed As Boolean @@ -36,16 +37,24 @@ Public Class frmFormDesigner Private CurrentColumnId As Integer = 0 Public Sub Reload_ControlNameList() - TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil(DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, USER_LANGUAGE, CURRENT_ProfilGUID) - CURRENT_CONTROL_NAME_LIST = DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS.AsEnumerable(). - Where(Function(row) row.CTRL_TYPE <> "LBL"). - Select(Function(row) row.NAME). - OrderBy(Function(name) name). + _Logger.debug("Reloading control name list") + Dim oControlNameList = DatabaseFallback.GetDatatableECM($" + SELECT NAME + FROM TBPM_PROFILE_CONTROLS + WHERE + PROFIL_ID = {CURRENT_ProfilGUID} AND + CTRL_TYPE <> 'LBL' + ORDER BY NAME" + ) + CURRENT_CONTROL_NAME_LIST = oControlNameList.AsEnumerable(). + Select(Function(row) row.ItemEx("NAME", String.Empty)). ToList() + _Logger.debug("Reloading control name list done!") End Sub Private Sub frmFormDesigner_Load(sender As Object, e As EventArgs) Handles Me.Load Try + ClassControlCreator.Logger = LOGCONFIG.GetLoggerFor("ControlCreator") BarButtonItem3.Caption = "Designer locked" BarButtonItem3.ItemAppearance.Normal.BackColor = Color.Red @@ -104,7 +113,7 @@ Public Class frmFormDesigner End If 'Catch ex As Exception - ' LOGGER.Error(ex) + ' _Logger.Error(ex) ' MsgBox("Fehler bei Initialisieren von windream: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") 'End Try @@ -115,13 +124,13 @@ Public Class frmFormDesigner TBPM_CONTROL_TABLETableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBDD_CONNECTIONTableAdapter.Fill(DD_DMSLiteDataSet.TBDD_CONNECTION) Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Fehler bei Laden der Connection-Strings und Grunddaten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try LoadControls() Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "error loading form:") End Try End Sub @@ -305,7 +314,7 @@ Public Class frmFormDesigner End Select Next Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Fehler bei LoadControls " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try @@ -320,7 +329,7 @@ Public Class frmFormDesigner ' Try ' TBPM_PROFILE_CONTROLSBindingSource.Clear() ' Catch ex As Exception - ' LOGGER.Error(ex) + ' _Logger.Error(ex) ' End Try 'End Sub @@ -509,9 +518,9 @@ Public Class frmFormDesigner ' pnldesigner.Controls.Add(oButton) ' End Select ' Catch ex As Exception - ' LOGGER.Error(ex) - ' LOGGER.Info($"Error while Adding new control {e.Data.GetData(DataFormats.Text)}:") - ' LOGGER.Info(ex) + ' _Logger.Error(ex) + ' _Logger.Info($"Error while Adding new control {e.Data.GetData(DataFormats.Text)}:") + ' _Logger.Info(ex) ' End Try 'End Sub @@ -599,7 +608,7 @@ Public Class frmFormDesigner GridControlContextMenu.Show(Cursor.Position.X, Cursor.Position.Y) End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox("Error while loading Column Configuration: " & vbCrLf & ex.Message, MsgBoxStyle.Critical) End Try End Sub @@ -618,7 +627,7 @@ Public Class frmFormDesigner End If End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "DeleteControl:") End Try End Sub @@ -718,7 +727,7 @@ Public Class frmFormDesigner MyBase.Cursor = Cursors.Default Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical) - LOGGER.Error(ex) + _LOGGER.Error(ex) Mouse_IsMoving = False Mouse_IsPressed = False End Try @@ -747,7 +756,7 @@ Public Class frmFormDesigner End If End If Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) Mouse_IsMoving = False End Try End Sub @@ -822,9 +831,9 @@ Public Class frmFormDesigner Try TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil(DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, USER_LANGUAGE, ProfileId) Catch ex As Exception - LOGGER.Error(ex) - LOGGER.Info("Error while executing TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil in LoadControlProperties:") - LOGGER.Info(ex) + _LOGGER.Error(ex) + _LOGGER.Info("Error while executing TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil in LoadControlProperties:") + _LOGGER.Info(ex) End Try Dim oControlId = DirectCast(sender.Tag, ClassControlCreator.ControlMetadata).Guid @@ -835,7 +844,7 @@ Public Class frmFormDesigner ' Control-Id wurde nicht in DataRow gefunden If IsNothing(oRow) Then - LOGGER.Info($"Error while filtering Controls by Guid '{oControlId}' in LoadControlProperties:") + _LOGGER.Info($"Error while filtering Controls by Guid '{oControlId}' in LoadControlProperties:") MsgBox($"Control mit der Id {oControlId} wurde nicht gefunden!", MsgBoxStyle.Critical, "Fehler beim Laden der Control Eigenschaften") Exit Sub @@ -1243,10 +1252,10 @@ Public Class frmFormDesigner Return True Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) Dim oMsg = $"UpdateImage - Error while saving Control (Id: {CURRENT_CONTROL_ID}): {vbCrLf}{ex.Message}" MsgBox(oMsg) - LOGGER.Info(oMsg) + _LOGGER.Info(oMsg) Return False End Try End Function @@ -1279,10 +1288,10 @@ Public Class frmFormDesigner Catch ex As Exception - LOGGER.Error(ex) + _LOGGER.Error(ex) Dim oMsg = $"UpdateSingleValue - Fehler beim Speichern von Control (Id: {guid}, column: {columnName}): {vbCrLf}{ex.Message}" MsgBox(oMsg) - LOGGER.Info(oMsg) + _LOGGER.Info(oMsg) Return False End Try End Function @@ -1301,7 +1310,7 @@ Public Class frmFormDesigner Catch ex As Exception Dim oMsg = $"MenuItemAddColumn_Click - Fehler beim Hinzufügen von einer neuen Spalte: {vbCrLf}{ex.Message}" MsgBox(oMsg) - LOGGER.Error(ex) + _LOGGER.Error(ex) End Try End Sub @@ -1334,7 +1343,7 @@ Public Class frmFormDesigner End If Catch ex As Exception MsgBox("Error in Saving Profile SQLFinish: " & vbNewLine & vbNewLine & ex.Message) - LOGGER.Error(ex) + _LOGGER.Error(ex) End Try End Sub @@ -1579,9 +1588,9 @@ Public Class frmFormDesigner RibPGCtrlWidth.Enabled = True End If Catch ex As Exception - LOGGER.Error(ex) - LOGGER.Info($"Error while Adding new control {ControlSelected}:") - LOGGER.Info(ex) + _LOGGER.Error(ex) + _LOGGER.Info($"Error while Adding new control {ControlSelected}:") + _LOGGER.Info(ex) End Try Me.Cursor = Cursors.Default ControlSelected = ""