Imports DevExpress.XtraEditors Imports DevExpress.XtraGrid.Views.Grid Imports DevExpress.XtraLayout Imports DevExpress.XtraTab Imports DigitalData.Controls.RegexEditor Imports DigitalData.Controls.SQLEditor Imports DigitalData.GUIs.Common Imports DigitalData.Modules.Logging Public Class frmAdmin_CWProfile Implements frmAdmin_Interface Public Property PrimaryKey As Integer Implements frmAdmin_Interface.PrimaryKey Public Property HasChanges As Boolean Implements frmAdmin_Interface.HasChanges Public Property IsInsert As Boolean Implements frmAdmin_Interface.IsInsert Private Const BUTTON_REGEX_PROFILE = "BUTTON_REGEX_PROFILE" Private Const BUTTON_SEARCH_SQL = "BUTTON_SEARCH_SQL" Private Const BUTTON_COUNT_SQL = "BUTTON_COUNT_SQL" Private Const TAB_PAGE_PROFILE = "TAB_PAGE_PROFILE" Private Const TAB_PAGE_DOCSEARCH = "TAB_PAGE_DOCSEARCH" Private Const TAB_PAGE_DATASEARCH = "TAB_PAGE_DATASEARCH" Private Current_Page As String Public Sub New(PrimaryKey As Integer) ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. Logger = My.LogConfig.GetLogger() Me.PrimaryKey = PrimaryKey Me.IsInsert = IsInsert End Sub Private Sub Any_EditValueChanged(sender As BaseEdit, e As EventArgs) Dim oControl As BaseEdit = sender If TypeOf oControl.Parent Is LayoutControl Then Dim oLayoutControl As LayoutControl = oControl.Parent If TypeOf oLayoutControl.Parent Is XtraTabPage Then Dim oTabControl As XtraTabPage = oLayoutControl.Parent Dim oTag As String = oTabControl.Tag Select Case oTag Case TAB_PAGE_DOCSEARCH Current_Page = TAB_PAGE_DOCSEARCH Case TAB_PAGE_PROFILE Current_Page = TAB_PAGE_DOCSEARCH Case Else Current_Page = Nothing End Select End If End If End Sub Private Sub frmAdmin_CWProfile_Load(sender As Object, e As EventArgs) Handles Me.Load Try TBCW_PROFILESTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString TBCW_PROFILESTableAdapter.Fill(DBCW_Stammdaten.TBCW_PROFILES, PrimaryKey) TBCW_PROF_DOC_SEARCHTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString TBCW_PROF_DOC_SEARCHTableAdapter.Fill(DBCW_Stammdaten.TBCW_PROF_DOC_SEARCH, PrimaryKey) TBCW_PROF_DATA_SEARCHTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString TBCW_PROF_DATA_SEARCHTableAdapter.Fill(DBCW_Stammdaten.TBCW_PROF_DATA_SEARCH, PrimaryKey) Dim oViews As New List(Of GridView) From {GridViewDataSearch, GridViewDocSearch} Dim oGridBuilder As New GridBuilder(oViews) oGridBuilder. WithDefaults(). WithReadOnlyOptions() For Each oContainer As LayoutControlItem In Root.Items Dim oControl As BaseEdit = oContainer.Control AddHandler oControl.GotFocus, AddressOf Any_EditValueChanged Next Catch ex As Exception ShowError(ex) End Try End Sub Private Sub ResetMessages() labelStatus.Visibility = DevExpress.XtraBars.BarItemVisibility.Never End Sub Private Sub ShowStatus(Message As String) labelStatus.Caption = Message labelStatus.Visibility = DevExpress.XtraBars.BarItemVisibility.Always End Sub Public Function SaveData() As Boolean Implements frmAdmin_Interface.SaveData Try TBCW_PROFILESBindingSource.EndEdit() If DBCW_Stammdaten.TBCW_PROFILES.GetChanges() IsNot Nothing Then HasChanges = True If IsInsert Then txtAddedWho.EditValue = My.Application.User.UserName Else txtChangedWho.EditValue = My.Application.User.UserName End If TBCW_PROFILESBindingSource.EndEdit() TBCW_PROFILESTableAdapter.Update(DBCW_Stammdaten.TBCW_PROFILES) End If Return True Catch ex As Exception ShowError(ex) Return False End Try End Function Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick ResetMessages() If SaveData() Then Close() End If End Sub Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick ResetMessages() If SaveData() And HasChanges Then ShowStatus("Attribute gespeichert!") End If End Sub Public Function DeleteData() As Boolean Implements frmAdmin_Interface.DeleteData Throw New NotImplementedException() End Function Private Sub TextEdit4_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles TextEdit4.ButtonClick Dim oTextEdit As TextEdit = sender If e.Button.Tag = BUTTON_REGEX_PROFILE Then Dim oForm As New frmRegexEditor(oTextEdit.EditValue) Dim oResult = oForm.ShowDialog() If oResult = DialogResult.OK Then oTextEdit.EditValue = oForm.RegexString End If End If End Sub Private Sub TextEdit7_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles TextEdit7.ButtonClick Dim oTextEdit As TextEdit = sender If e.Button.Tag = BUTTON_SEARCH_SQL Then Dim oForm As New frmSQLEditor(oTextEdit.EditValue) Dim oResult = oForm.ShowDialog() If oResult = DialogResult.OK Then oTextEdit.EditValue = oForm.SQLString End If End If End Sub Private Sub TextEdit8_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles TextEdit8.ButtonClick Dim oTextEdit As TextEdit = sender If e.Button.Tag = BUTTON_COUNT_SQL Then Dim oForm As New frmSQLEditor(oTextEdit.EditValue) Dim oResult = oForm.ShowDialog() If oResult = DialogResult.OK Then oTextEdit.EditValue = oForm.SQLString End If End If End Sub End Class