Public Class frmControl_Detail Private Sub TBPM_CONTROL_TABLEBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Me.Validate() Me.TBPM_CONTROL_TABLEBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.DD_DMSLiteDataSet) End Sub Public Function FillData(ID As Integer) Try TBPM_CONTROL_TABLETableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM TBPM_CONTROL_TABLETableAdapter.FillByGUID(DD_DMSLiteDataSet.TBPM_CONTROL_TABLE, ID) Return True Catch ex As System.Exception MsgBox(TBPM_CONTROL_TABLETableAdapter.Connection.ConnectionString & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler beim Laden der Daten zu SpaltenID: " & ID) End Try End Function Sub Save_Data() Try TBPM_CONTROL_TABLEBindingSource.EndEdit() If DD_DMSLiteDataSet.TBPM_CONTROL_TABLE.GetChanges Is Nothing = False Then Me.CHANGED_WHOTextBox.Text = USER_USERNAME TBPM_CONTROL_TABLEBindingSource.EndEdit() TBPM_CONTROL_TABLETableAdapter.cmdUpdate( SPALTENNAMETextBox.Text, SPALTEN_HEADERTextBox.Text, SPALTENBREITETextBox.Text, VALIDATIONCheckbox.Checked, READ_ONLYCheckBox.Checked, LOAD_IDX_VALUECheckBox.Checked, CHANGED_WHOTextBox.Text, REGEX_MATCHTextBox.Text, REGEX_MESSAGE_DETextBox.Text, REGEX_MESSAGE_DETextBox.Text, DEFAULTVALUETextBox.Text, SEQUENCETextBox.Text, ADVANCED_LOOKUPCheckbox.Checked, GUIDTextBox.Text ) tslblAenderungen.Visibility = DevExpress.XtraBars.BarItemVisibility.Always tslblAenderungen.Caption = "Änderungen gespeichert - " & Now FillData(GUIDTextBox.Text) Else tslblAenderungen.Visibility = DevExpress.XtraBars.BarItemVisibility.Never End If Catch ex As Exception LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Speichern:") End Try End Sub Private Sub frmControl_Detail_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing My.Settings.frmTableColumns_Position = Me.Location End Sub Private Sub frmControl_Detail_Load(sender As Object, e As EventArgs) Handles Me.Load Try Me.TBPM_CONTROL_TABLETableAdapter.Connection.ConnectionString = CONNECTION_STRING_ECM If My.Settings.frmTableColumns_Position.IsEmpty = False Then If My.Settings.frmTableColumns_Position.X > 0 And My.Settings.frmTableColumns_Position.Y > 0 Then Me.Location = My.Settings.frmTableColumns_Position End If End If Catch ex As Exception LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Laden der Formulardaten:") End Try End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Dim oForm As New frmRegexEditor() oForm.RegexString = REGEX_MATCHTextBox.Text Dim oResult = oForm.ShowDialog() If oResult = DialogResult.OK Then REGEX_MATCHTextBox.Text = oForm.RegexString End If End Sub Private Sub btnSQLEdit_Click(sender As Object, e As EventArgs) Dim oldSQL = SQL_COMMANDTextBox.Text CURRENT_DESIGN_TYPE = "SQL_SOURCE_TABLE_COLUMN" CURRENT_INDEX_ID = GUIDTextBox.Text Dim oForm As New frmSQL_DESIGNER() With {.SQLCommand = oldSQL} oForm.TopMost = True Dim oResult = oForm.ShowDialog() oForm.BringToFront() If oResult = DialogResult.OK Then If oldSQL <> oForm.SQLCommand Then Dim oUpdate As String = $"Update TBPM_CONTROL_TABLE SET CHANGED_WHO = '{USER_USERNAME}', SQL_COMMAND = '{oForm.SQLCommand.Replace("'", "''")}' , CONNECTION_ID = {oForm.ConnectionID} WHERE GUID = {GUIDTextBox.Text}" If Database_ECM.ExecuteNonQuery(oUpdate) = True Then tslblAenderungen.Visibility = DevExpress.XtraBars.BarItemVisibility.Always tslblAenderungen.Caption = "Changes saved - " & Now End If End If End If End Sub Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick Save_Data() End Sub Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick Try If MessageBox.Show("Wollen Sie diese Spalte wirklich löschen?", "Spalte löschen", MessageBoxButtons.YesNo) = DialogResult.Yes Then TBPM_CONTROL_TABLETableAdapter.Delete(GUIDTextBox.Text) Close() End If Catch ex As Exception LOGGER.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Löschen:") End Try End Sub Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click Dim oForm As New frmRegexEditor() oForm.RegexString = REGEX_MATCHTextBox.Text Dim oResult = oForm.ShowDialog() If oResult = DialogResult.OK Then REGEX_MATCHTextBox.Text = oForm.RegexString End If End Sub Private Sub SimpleButton2_Click(sender As Object, e As EventArgs) Handles SimpleButton2.Click Dim oldSQL = SQL_COMMANDTextBox.Text CURRENT_DESIGN_TYPE = "SQL_SOURCE_TABLE_COLUMN" CURRENT_INDEX_ID = GUIDTextBox.Text Dim oForm As New frmSQL_DESIGNER() With {.SQLCommand = oldSQL} oForm.TopMost = True Dim oResult = oForm.ShowDialog() oForm.BringToFront() If oResult = DialogResult.OK Then If oldSQL <> oForm.SQLCommand Then Dim oUpdate As String = $"Update TBPM_CONTROL_TABLE SET CHANGED_WHO = '{USER_USERNAME}', SQL_COMMAND = '{oForm.SQLCommand.Replace("'", "''")}' , CONNECTION_ID = {oForm.ConnectionID} WHERE GUID = {GUIDTextBox.Text}" If Database_ECM.ExecuteNonQuery(oUpdate) = True Then tslblAenderungen.Visibility = DevExpress.XtraBars.BarItemVisibility.Always tslblAenderungen.Caption = "Changes saved - " & Now End If End If End If End Sub End Class