From 359700e6837fbc8fcc763948d112eb5592a51c98 Mon Sep 17 00:00:00 2001 From: OlgunR Date: Thu, 9 Oct 2025 15:09:10 +0200 Subject: [PATCH] Speichern und Laden: deskriptiver Index, Checkbox Zusatzoptoinen - frmNIVerknuepfungen --- ToolCollection/frmNIVerknuepfungen.vb | 129 +++++++++++++++++++------- 1 file changed, 93 insertions(+), 36 deletions(-) diff --git a/ToolCollection/frmNIVerknuepfungen.vb b/ToolCollection/frmNIVerknuepfungen.vb index 48953f2..154aa5a 100644 --- a/ToolCollection/frmNIVerknuepfungen.vb +++ b/ToolCollection/frmNIVerknuepfungen.vb @@ -22,7 +22,8 @@ Public Class frmNIVerknuepfungen Private _flagIgnoreVisibilityChanged As Boolean = False Private _flagIgnoreCheckedChanged As Boolean = False Private _formloaded As Boolean = False - Private selectedIndex_Type As String + Private _selectedIndex_Type As String + Private _isLoading As Boolean = False Public Shared vSQL As String Public Shared vstartwert As String @@ -168,6 +169,7 @@ Public Class frmNIVerknuepfungen ''' Name des zu ladenden Profils ''' Private Sub LoadSelectedProfile(ByVal profilname As String) + Me._isLoading = True Try ' setzt erst einmal alles zurück Me.tabctrlbottom.Visible = True @@ -221,7 +223,7 @@ Public Class frmNIVerknuepfungen End If 'Überprüfungsselect - Me.txtCheckIndexSQL.Text = Me._selectedProfil.checkIndexsql + Me.txtCheckIndexSQL.Text = "" 'Move and Rename aktiv? If Me._selectedProfil.SQL_Anweisung IsNot Nothing Then If Me._selectedProfil.SQL_Anweisung <> "" Then @@ -475,6 +477,7 @@ Public Class frmNIVerknuepfungen Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Laden des Profils") End Try + Me._isLoading = False End Sub @@ -2005,9 +2008,9 @@ Public Class frmNIVerknuepfungen If Me.lvwVerknuepfungen.SelectedItems.Count > 0 Then If Me._selectedProfil._links.selectedLink IsNot Nothing Then 'Radiobuttons Vektor InsertState Überprüfen - selectedIndex_Type = _windreamNI.GetIndex_Type(Me.lvwVerknuepfungen.SelectedItems(0).SubItems(0).Text) + _selectedIndex_Type = _windreamNI.GetIndex_Type(Me.lvwVerknuepfungen.SelectedItems(0).SubItems(0).Text) visinvisible_Vektor_ins_State() - If selectedIndex_Type.StartsWith("Vektor") Then + If _selectedIndex_Type.StartsWith("Vektor") Then Me.Changeinaction = True Select Case Me._selectedProfil._links.selectedLink.vktins_state Case 1 @@ -2316,6 +2319,7 @@ Public Class frmNIVerknuepfungen Select Case Me.DialogResult Case DialogResult.OK + SaveCheckStatusFinished() If Not Me._selectedProfil.IsSaved Then SaveProfile() If Not Me._selectedProfil._links.IsLinksSaved Then SaveLinks() Case DialogResult.Cancel @@ -2327,6 +2331,8 @@ Public Class frmNIVerknuepfungen Dim msgResult As MsgBoxResult = MsgBox("Möchten Sie die Änderungen speichern?", MsgBoxStyle.YesNoCancel, "Änderungen übernehmen?") If msgResult = MsgBoxResult.Yes Then + SaveCheckStatusFinished() + If Not Me._selectedProfil.IsSaved Then SaveProfile() End If @@ -2366,7 +2372,6 @@ Public Class frmNIVerknuepfungen Me.SplitContainer1.Visible = False Me.pnlfulltext.Visible = False End If - End Sub Private Sub btnEindIndex_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEindIndex.Click Dim text As String = Me.txteindeutigerIndex.Text @@ -2380,34 +2385,51 @@ Public Class frmNIVerknuepfungen End Sub + Private Sub SaveCheckStatusFinished() + My.Settings.vNIStatusFinished = chbxStatusfertig.Checked + My.Settings.Save() + End Sub + Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chbxStatusfertig.CheckedChanged - If Me.chbxStatusfertig.Checked Then - Me.cmbIndex_Statusfertig.Enabled = True - My.Settings.vNIStatusFinished = chbxStatusfertig.Checked - My.Settings.Save() - Try - Me.cmbIndex_Statusfertig.Items.Clear() - Dim indexe = _windream.GetIndicesByObjecttype(Me._selectedProfil.Dokumenttyp.aName, True, "NI") - If indexe IsNot Nothing Then - For Each index As String In indexe - Me.cmbIndex_Statusfertig.Items.Add(index) - Next - End If - If Not IsNothing(Me._selectedProfil.finalerIndex) Then - cmbIndex_Statusfertig.SelectedIndex = cmbIndex_Statusfertig.FindStringExact(Me._selectedProfil.finalerIndex) - End If + If _isLoading = False Then + + If chbxStatusfertig.Checked Then + Me.cmbIndex_Statusfertig.Enabled = True + 'My.Settings.vNIStatusFinished = chbxStatusfertig.Checked + 'My.Settings.Save() + 'Me._selectedProfil.setChanged() + 'Me.btnSaveAll.Enabled = True + Try + Me.cmbIndex_Statusfertig.Items.Clear() + Dim indexe = _windream.GetIndicesByObjecttype(Me._selectedProfil.Dokumenttyp.aName, True, "NI") + If indexe IsNot Nothing Then + For Each index As String In indexe + Me.cmbIndex_Statusfertig.Items.Add(index) + Next + End If + If Not IsNothing(Me._selectedProfil.finalerIndex) Then + cmbIndex_Statusfertig.SelectedIndex = cmbIndex_Statusfertig.FindStringExact(Me._selectedProfil.finalerIndex) + End If - Catch ex As Exception - MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Laden der windream-Indexe in die Auswahlliste 'cmbIndex_Statusfertig'") - End Try - Else - Me.cmbIndex_Statusfertig.Enabled = False - My.Settings.vNIStatusFinished = chbxStatusfertig.Checked - My.Settings.Save() - If Me._selectedProfil IsNot Nothing Then - Me._selectedProfil.finalerIndex = "" - Me._selectedProfil.setChanged() + Me._selectedProfil.setChanged() + Me.btnSaveAll.Enabled = True + Catch ex As Exception + MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Laden der windream-Indexe in die Auswahlliste 'cmbIndex_Statusfertig'") + End Try + Else + Me.cmbIndex_Statusfertig.Enabled = False + 'My.Settings.vNIStatusFinished = chbxStatusfertig.Checked + 'My.Settings.Save() + 'Me._selectedProfil.setChanged() + 'Me.btnSaveAll.Enabled = True + If Me._selectedProfil IsNot Nothing Then + Me._selectedProfil.finalerIndex = "" + Me._selectedProfil.setChanged() + Me.btnSaveAll.Enabled = True + End If End If + Else + Exit Sub End If End Sub @@ -2695,8 +2717,8 @@ Public Class frmNIVerknuepfungen 'End Sub Private Sub SaveProfile() - If Me.txtCheckIndexSQL.Text <> "" Then - Try + 'If Me.txtCheckIndexSQL.Text <> "" Then + Try ' die Änderungen speichern If Me._selectedProfil.Save(True, "profile") = True Then Me._selectedProfil.setSaved() @@ -2707,7 +2729,7 @@ Public Class frmNIVerknuepfungen Catch ex As Exception MsgBox("Fehler beim Speichern des SQL-Befehles." & vbNewLine & vbNewLine & "Fehlernachricht:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler beim Speichern eines SQL-Befehls.") End Try - End If + 'End If End Sub Private Sub txtCheckIndexSQL_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtCheckIndexSQL.TextChanged @@ -2723,6 +2745,40 @@ Public Class frmNIVerknuepfungen End If + + 'Try + ' ' wenn im ListView eine Zeile selektiert wurde + ' If Me.lvwVerknuepfungen.SelectedItems.Count > 0 Then + ' ' Überprüfen ob eingegebener Wert gepeichert werden muß? + ' Dim SQL_ORIGIN As String = Me._selectedProfil._links.getLinkByValues(Me.lvwVerknuepfungen.SelectedItems(0).SubItems(0).Text, Me.lvwVerknuepfungen.SelectedItems(0).SubItems(1).Text, + ' Me.lvwVerknuepfungen.SelectedItems(0).SubItems(2).Text).getSelectAnweisung().ToString + ' If SQL_ORIGIN <> Me.txtSelectAnweisung.Text Then + ' With btnSaveAll + ' .Enabled = True + ' .ForeColor = Drawing.Color.Black + ' End With + ' End If + ' ' die Informationen der selektierten Verknüpfung auslesen + ' Me._selectedProfil._links.getLinkByValues(Me.lvwVerknuepfungen.SelectedItems(0).SubItems(0).Text, Me.lvwVerknuepfungen.SelectedItems(0).SubItems(1).Text, + ' Me.lvwVerknuepfungen.SelectedItems(0).SubItems(2).Text).setSelectAnweisung(Me.txtSelectAnweisung.Text) + ' Me.btnSaveAll.Enabled = True + ' Me._selectedProfil.setChanged() + ' Me._selectedProfil._links.setLinksChanged() + ' 'Jetzt den Startwert bestimmen + ' 'MsgBox("[%" & Me.lvwVerbunden.SelectedItems(0).SubItems(0).Text & "]") + ' If Me.txteindeutigerIndex.Text <> "" Then + ' If Me.txtSelectAnweisung.Text.Contains(Me.txteindeutigerIndex.Text) Then + ' Me.lblSQLTest.Text = "Testwert für eind. Index: " & "[%" & Me.txteindeutigerIndex.Text & "]" + ' End If + ' End If + + ' End If + + 'Catch ex As Exception + ' MsgBox("Die Verknüpfung konnte nicht angelegt werden." & vbNewLine & vbNewLine & ex.Message, MsgBoxStyle.Exclamation, "Fehler beim Anlegen einer Verknüpfung") + 'End Try + + End Sub Private Sub txteindeutigerIndex_TextChanged(sender As System.Object, e As System.EventArgs) Handles txteindeutigerIndex.TextChanged @@ -3503,13 +3559,13 @@ Public Class frmNIVerknuepfungen Me.chkboxWhitespace.Checked = False Me.txtregex.Text = "" End Select - selectedIndex_Type = _windreamNI.GetIndex_Type(lbxWMIndex.SelectedItem) - If selectedIndex_Type Is Nothing = False Then + _selectedIndex_Type = _windreamNI.GetIndex_Type(lbxWMIndex.SelectedItem) + If _selectedIndex_Type Is Nothing = False Then visinvisible_Vektor_ins_State() End If End Sub Sub visinvisible_Vektor_ins_State() - If selectedIndex_Type.StartsWith("Vektor") Then + If _selectedIndex_Type.StartsWith("Vektor") Then Me.rbvkt_add.Visible = True Me.rbvkt_overwrite.Visible = True Me.chkvkt_Dublette.Visible = True @@ -3679,6 +3735,7 @@ Public Class frmNIVerknuepfungen End Sub Private Sub btnSaveAll_Click(sender As Object, e As EventArgs) Handles btnSaveAll.Click + SaveCheckStatusFinished() SaveLinks() SaveProfile() End Sub