Imports DevExpress.XtraLayout Imports DigitalData.Modules.Logging Public Class frmAdmin_Globix Implements IAdminForm Public Property HasChanges As Boolean = False Implements IAdminForm.HasChanges Public Property IsInsert As Boolean = False Implements IAdminForm.IsInsert Public Property PrimaryKey As Integer Implements IAdminForm.PrimaryKey Private Pages As ClassDetailPages Public Sub New(PrimaryKey As Integer, Optional IsInsert As Boolean = False) ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. Me.PrimaryKey = PrimaryKey Me.IsInsert = IsInsert End Sub Private Sub frmAdmin_Globix_Load(sender As Object, e As EventArgs) Handles MyBase.Load InitializeBaseForm(My.LogConfig) Try TBDD_DOKUMENTARTTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString TBDD_DOKUMENTARTTableAdapter.Fill(Me.GlobixDataset.TBDD_DOKUMENTART, PrimaryKey) TBDD_INDEX_MANTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString Load_TabData() ' Add Focus Handler to all controls in all LayoutControls Dim oLayoutControls = New List(Of LayoutControl) From {LayoutControlProfile, LayoutControlManIndexe, LayoutControlAutoIndexe, LayoutControlRework} Pages = New ClassDetailPages(My.LogConfig, Me, oLayoutControls) Pages.AddRange({ New ClassDetailPages.PrimaryPage(IsInsert) With { .Name = "Profil", .TabPage = XtraTabPageProfile, .BindingSource = TBDD_DOKUMENTARTBindingSource, .DataTable = GlobixDataset.TBDD_DOKUMENTART, .AddedWhoEdit = TextEditErstelltWer, .ChangedWhoEdit = TextEditGeandertWer }, New ClassDetailPages.DetailPage With { .Name = "ManIndexe", .TabPage = XtraTabPageManIndexe, .BindingSource = TBDD_INDEX_MANBindingSource, .DataTable = GlobixDataset.TBDD_INDEX_MAN, .AddedWhoEdit = TextEditAddedWho_ManIndex, .ChangedWhoEdit = TextEditChangedWho_ManIndex } }) Pages.PrepareLoad() AddHandler Pages.CurrentPage_Changed, AddressOf CurrentPage_Changed Catch ex As Exception ShowErrorMessage(ex) End Try End Sub Sub Load_TabData() Load_INDEXMAN() End Sub Private Sub Load_INDEXMAN() Try Me.TBDD_INDEX_MANTableAdapter.Fill(Me.GlobixDataset.TBDD_INDEX_MAN, PrimaryKey) Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in Load IndexeManuell: ") End Try End Sub Private Sub CurrentPage_Changed(sender As Object, e As ClassDetailPages.DetailPageEventArgs) If Not IsNothing(e.Page) Then If e.Page.IsPrimary = True Then BarButtonNew.Enabled = False Else BarButtonNew.Enabled = True End If RibbonPageGroup1.Text = e.Page.Name End If 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 DeleteData() As Boolean Implements IAdminForm.DeleteData Throw New NotImplementedException() End Function Private Sub SimpleButton2_Click(sender As Object, e As EventArgs) End Sub Private Sub XtraTabControl1_Click(sender As Object, e As EventArgs) Handles XtraTabControl1.Click End Sub Private Sub SUGGESTIONCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles SUGGESTIONCheckBox.CheckedChanged If SUGGESTIONCheckBox.CheckState = CheckState.Checked Then btneditSQLmanIndex.Enabled = True Else btneditSQLmanIndex.Enabled = False End If End Sub Private Sub BarButtonSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonSave.ItemClick ResetMessages() If Pages.PrepareSave() = True Then Try Dim oPage = Pages.Current Select Case oPage.TabPage.Name Case XtraTabPageProfile.Name TBDD_INDEX_MANTableAdapter.Update(oPage.DataTable) Case XtraTabPageManIndexe.Name TBDD_INDEX_MANTableAdapter.Update(oPage.DataTable) End Select oPage.IsInsert = False ShowStatus($"{oPage.Name} gespeichert!") Catch ex As Exception ShowErrorMessage(ex) End Try Else ShowStatus("Keine Änderungen!") End If End Sub Private Sub BarButtonNew_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonNew.ItemClick Pages.Current.IsInsert = True AddData() End Sub Public Function AddData() As Boolean Dim oPage = Pages.Current If Pages.Current Is Nothing Then Return False End If If oPage.IsPrimary = False Then oPage.DataTable.Columns.Item("DOK_ID").DefaultValue = PrimaryKey End If Dim oNewRecord As DataRowView = oPage.BindingSource.AddNew() Return True End Function End Class