ZooFLow: CW Admin
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraLayout
|
||||
Imports DevExpress.XtraTab
|
||||
@@ -22,7 +23,7 @@ Public Class frmAdmin_CWProfile
|
||||
Private Const TAB_PAGE_DOCSEARCH = "TAB_PAGE_DOCSEARCH"
|
||||
Private Const TAB_PAGE_DATASEARCH = "TAB_PAGE_DATASEARCH"
|
||||
|
||||
Private Current_Page As String
|
||||
Private Pages As ClassDetailPages
|
||||
|
||||
Public Sub New(PrimaryKey As Integer)
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
@@ -34,30 +35,6 @@ Public Class frmAdmin_CWProfile
|
||||
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
|
||||
@@ -69,21 +46,66 @@ Public Class frmAdmin_CWProfile
|
||||
TBCW_PROF_DATA_SEARCHTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString
|
||||
TBCW_PROF_DATA_SEARCHTableAdapter.Fill(DBCW_Stammdaten.TBCW_PROF_DATA_SEARCH, PrimaryKey)
|
||||
|
||||
' Configure the GridViews with some default options
|
||||
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
|
||||
' Add Focus Handler to all controls in all LayoutControls
|
||||
Dim oLayoutControls = New List(Of LayoutControl) From {LayoutControlProfile, LayoutControlDocSearch, LayoutControlDataSearch}
|
||||
|
||||
Pages = New ClassDetailPages(oLayoutControls)
|
||||
Pages.AddRange({
|
||||
New ClassDetailPages.DetailPage With {
|
||||
.IsPrimary = True,
|
||||
.Name = "Profil",
|
||||
.TabPage = PageProfile,
|
||||
.BindingSource = TBCW_PROFILESBindingSource,
|
||||
.DataTable = DBCW_Stammdaten.TBCW_PROFILES,
|
||||
.AddedWhoEdit = txtAddedWho,
|
||||
.ChangedWhoEdit = txtChangedWho
|
||||
},
|
||||
New ClassDetailPages.DetailPage With {
|
||||
.Name = "Dokument-Suche",
|
||||
.TabPage = PageDocumentSearch,
|
||||
.BindingSource = TBCW_PROF_DOC_SEARCHBindingSource,
|
||||
.DataTable = DBCW_Stammdaten.TBCW_PROF_DOC_SEARCH,
|
||||
.AddedWhoEdit = txtAddedWho1,
|
||||
.ChangedWhoEdit = txtChangedWho1
|
||||
},
|
||||
New ClassDetailPages.DetailPage With {
|
||||
.Name = "Daten-Suche",
|
||||
.TabPage = PageDataSearch,
|
||||
.BindingSource = TBCW_PROF_DATA_SEARCHBindingSource,
|
||||
.DataTable = DBCW_Stammdaten.TBCW_PROF_DATA_SEARCH
|
||||
}
|
||||
})
|
||||
|
||||
AddHandler Pages.AnyControl_Focus, AddressOf AnyControl_Focus
|
||||
AddHandler Pages.AnyControl_Changed, AddressOf AnyControl_Changed
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub AnyControl_Focus(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 AnyControl_Changed(sender As Object, e As ClassDetailPages.DetailPageEventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub ResetMessages()
|
||||
labelStatus.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
End Sub
|
||||
@@ -94,42 +116,50 @@ Public Class frmAdmin_CWProfile
|
||||
End Sub
|
||||
|
||||
Public Function SaveData() As Boolean Implements frmAdmin_Interface.SaveData
|
||||
Try
|
||||
TBCW_PROFILESBindingSource.EndEdit()
|
||||
If Pages.CurrentPage Is Nothing Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
If DBCW_Stammdaten.TBCW_PROFILES.GetChanges() IsNot Nothing Then
|
||||
Dim oPage = Pages.CurrentPage
|
||||
|
||||
Try
|
||||
oPage.BindingSource.EndEdit()
|
||||
|
||||
If oPage.DataTable.GetChanges() IsNot Nothing Then
|
||||
HasChanges = True
|
||||
|
||||
If IsInsert Then
|
||||
txtAddedWho.EditValue = My.Application.User.UserName
|
||||
oPage.AddedWhoEdit.EditValue = My.Application.User.UserName
|
||||
Else
|
||||
txtChangedWho.EditValue = My.Application.User.UserName
|
||||
oPage.ChangedWhoEdit.EditValue = My.Application.User.UserName
|
||||
End If
|
||||
|
||||
TBCW_PROFILESBindingSource.EndEdit()
|
||||
TBCW_PROFILESTableAdapter.Update(DBCW_Stammdaten.TBCW_PROFILES)
|
||||
oPage.BindingSource.EndEdit()
|
||||
Return True
|
||||
Else
|
||||
HasChanges = False
|
||||
End If
|
||||
|
||||
Return True
|
||||
Return False
|
||||
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
|
||||
Private Sub BarButtonSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonSave.ItemClick
|
||||
ResetMessages()
|
||||
|
||||
If SaveData() And HasChanges Then
|
||||
ShowStatus("Attribute gespeichert!")
|
||||
Select Case Pages.CurrentPage.TabPage.Name
|
||||
Case PageProfile.Name
|
||||
TBCW_PROFILESTableAdapter.Update(Pages.CurrentPage.DataTable)
|
||||
|
||||
Case PageDocumentSearch.Name
|
||||
TBCW_PROF_DOC_SEARCHTableAdapter.Update(Pages.CurrentPage.DataTable)
|
||||
End Select
|
||||
|
||||
ShowStatus($"{Pages.CurrentPage.Name} gespeichert!")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user