ZooFlow: Administration
This commit is contained in:
@@ -15,5 +15,7 @@
|
||||
Public Const PAGE_META_SOURCE_SQL = "META_SOURCE_SQL"
|
||||
|
||||
Public Const COLUMN_NAME_ACTIVE = "ACTIVE"
|
||||
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -114,7 +114,7 @@ Public Class ClassDetailForm
|
||||
|
||||
Private Sub Load_CWProfile(PrimaryKey As Integer, IsInsert As Boolean)
|
||||
Try
|
||||
Dim oForm As New frmAdmin_CWProfile(PrimaryKey) With {.IsInsert = IsInsert}
|
||||
Dim oForm As New frmAdmin_ClipboardWatcher(PrimaryKey) With {.IsInsert = IsInsert}
|
||||
oForm.ShowDialog()
|
||||
|
||||
RaiseEvent DetailFormClosed(Me, oForm)
|
||||
|
||||
@@ -1,15 +1,37 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
Imports DevExpress.XtraLayout
|
||||
Imports DevExpress.XtraTab
|
||||
Imports DigitalData.Modules.Language.Utils
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
''' <summary>
|
||||
'''
|
||||
''' </summary>
|
||||
Public Class ClassDetailPages
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
Private ReadOnly Logger As Logger
|
||||
Private ReadOnly HostForm As IAdminForm
|
||||
|
||||
Public Items As New Dictionary(Of String, DetailPage)
|
||||
Public CurrentPage As DetailPage
|
||||
|
||||
Public Event AnyControl_Focus As EventHandler(Of DetailPageEventArgs)
|
||||
Public Event AnyControl_Changed As EventHandler(Of DetailPageEventArgs)
|
||||
Public Event CurrentPage_Changed As EventHandler(Of DetailPageEventArgs)
|
||||
|
||||
Private CurrentPage As DetailPage
|
||||
|
||||
Public Property Current As DetailPage
|
||||
Get
|
||||
Return CurrentPage
|
||||
End Get
|
||||
Set(value As DetailPage)
|
||||
CurrentPage = value
|
||||
|
||||
RaiseEvent CurrentPage_Changed(Me, New DetailPageEventArgs With {.Page = CurrentPage})
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Class DetailPageEventArgs
|
||||
Public Property Page As DetailPage
|
||||
@@ -17,6 +39,7 @@ Public Class ClassDetailPages
|
||||
|
||||
Public Class DetailPage
|
||||
Public IsPrimary As Boolean = False
|
||||
Public IsInsert As Boolean = False
|
||||
Public TabPage As XtraTabPage
|
||||
Public Name As String
|
||||
Public BindingSource As BindingSource
|
||||
@@ -25,7 +48,32 @@ Public Class ClassDetailPages
|
||||
Public ChangedWhoEdit As TextEdit
|
||||
End Class
|
||||
|
||||
Public Sub New(LayoutControls As List(Of LayoutControl))
|
||||
''' <summary>
|
||||
''' Detail page which represents the primary page of a form
|
||||
''' </summary>
|
||||
Public Class PrimaryPage
|
||||
Inherits DetailPage
|
||||
|
||||
Public Sub New(Insert As Boolean)
|
||||
IsInsert = Insert
|
||||
IsPrimary = True
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class ComboBoxItem
|
||||
Public Property Text
|
||||
Public Property Value
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return Text
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Form As IAdminForm, LayoutControls As List(Of LayoutControl))
|
||||
Me.LogConfig = LogConfig
|
||||
Logger = LogConfig.GetLogger()
|
||||
HostForm = Form
|
||||
|
||||
For Each oLayoutControl In LayoutControls
|
||||
AddHandler oLayoutControl.Click, AddressOf Handle_Focus
|
||||
AddHandler oLayoutControl.GotFocus, AddressOf Handle_Focus
|
||||
@@ -39,21 +87,110 @@ Public Class ClassDetailPages
|
||||
Next
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Add a new DetailPage or a new PrimaryPage
|
||||
''' </summary>
|
||||
Public Sub Add(Page As DetailPage)
|
||||
Items.Add(Page.TabPage.Name, Page)
|
||||
|
||||
AddHandler Page.BindingSource.AddingNew, Sub(sender As Object, e As EventArgs)
|
||||
Page.AddedWhoEdit.EditValue = Environment.UserName
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Add a list of new DetailPages or new PrimaryPages
|
||||
''' </summary>
|
||||
Public Sub AddRange(ParamArray Pages As DetailPage())
|
||||
For Each oPage In Pages
|
||||
Add(oPage)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub Handle_Validating(sender As Object, e As CancelEventArgs)
|
||||
Dim oControl As BaseEdit = sender
|
||||
Dim oBinding As Binding = oControl.DataBindings.Item("EditValue")
|
||||
''' <summary>
|
||||
''' Get the DetailPage which uses the given `TabPage`
|
||||
''' </summary>
|
||||
Public Function GetDetailPage(TabPage As XtraTabPage) As DetailPage
|
||||
Try
|
||||
Dim oItem = Items.
|
||||
Where(Function(Item) TabPage.Equals(Item.Value.TabPage)).
|
||||
FirstOrDefault()
|
||||
|
||||
If TypeOf oBinding.DataSource Is BindingSource Then
|
||||
Return oItem.Value
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Saves the pending changes to the binding source
|
||||
''' </summary>
|
||||
''' <returns>True, if changes were made, otherwise False</returns>
|
||||
Public Function PrepareSave() As Boolean
|
||||
Dim oPage = CurrentPage
|
||||
|
||||
If oPage Is Nothing Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Try
|
||||
oPage.BindingSource.EndEdit()
|
||||
|
||||
If oPage.DataTable.GetChanges() IsNot Nothing Then
|
||||
If oPage.IsInsert Then
|
||||
oPage.AddedWhoEdit.EditValue = My.Application.User.UserName
|
||||
Else
|
||||
oPage.ChangedWhoEdit.EditValue = My.Application.User.UserName
|
||||
End If
|
||||
|
||||
oPage.BindingSource.EndEdit()
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub Handle_Validating(sender As Object, e As BaseEditValidatingEventArgs)
|
||||
Dim oControl As BaseEdit = sender
|
||||
Dim oColumn As DataColumn = Get_DataColumnFromBaseEdit(oControl)
|
||||
|
||||
If oColumn IsNot Nothing Then
|
||||
Dim oNullable As Boolean = oColumn.AllowDBNull
|
||||
|
||||
If oNullable = False Then
|
||||
If TypeOf oControl Is ComboBoxEdit AndAlso DirectCast(oControl, ComboBoxEdit).SelectedIndex = -1 Then
|
||||
e.ErrorText = "Please select a value from the list."
|
||||
e.Cancel = True
|
||||
|
||||
ElseIf NotNull(oControl.EditValue.ToString, String.Empty) = String.Empty Then
|
||||
e.ErrorText = "Please input a value"
|
||||
e.Cancel = True
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function Get_DataColumnFromBaseEdit(Control As BaseEdit) As DataColumn
|
||||
Dim oBinding As Binding = Control.DataBindings.Item("EditValue")
|
||||
|
||||
If Control.DataBindings.Count = 0 OrElse oBinding Is Nothing Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
If oBinding.DataSource Is Nothing Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
If TypeOf oBinding.DataSource IsNot BindingSource Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oSource As BindingSource = oBinding.DataSource
|
||||
Dim oTableName As String = oSource.DataMember
|
||||
Dim oDataSet As DataSet = oSource.DataSource
|
||||
@@ -61,15 +198,12 @@ Public Class ClassDetailPages
|
||||
Dim oColumnName As String = oBinding.BindingMemberInfo.BindingField
|
||||
Dim oColumn As DataColumn = oTable.Columns.Item(oColumnName)
|
||||
|
||||
Dim oNullable As Boolean = oColumn.AllowDBNull
|
||||
|
||||
If oNullable = False And NotNull(oControl.EditValue.ToString, String.Empty) = String.Empty Then
|
||||
Throw New NoNullAllowedException()
|
||||
End If
|
||||
End If
|
||||
|
||||
Console.WriteLine()
|
||||
End Sub
|
||||
Return oColumn
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub Handle_Focus(sender As Control, e As EventArgs)
|
||||
Dim oControl As Control = sender
|
||||
@@ -86,22 +220,20 @@ Public Class ClassDetailPages
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Get the TabPage containing the Layout Control
|
||||
Do_Handle_Focus(oLayoutControl, oControl)
|
||||
End Sub
|
||||
|
||||
Private Sub Do_Handle_Focus(LayoutControl As LayoutControl, Control As Control)
|
||||
If TypeOf LayoutControl.Parent Is XtraTabPage Then
|
||||
Dim oTabPage As XtraTabPage = LayoutControl.Parent
|
||||
If TypeOf oLayoutControl.Parent Is XtraTabPage Then
|
||||
Dim oTabPage As XtraTabPage = oLayoutControl.Parent
|
||||
|
||||
If Items.ContainsKey(oTabPage.Name) Then
|
||||
CurrentPage = Items.Item(oTabPage.Name)
|
||||
|
||||
Dim oData As New DetailPageEventArgs With {.Page = Items.Item(oTabPage.Name)}
|
||||
RaiseEvent AnyControl_Focus(Control, oData)
|
||||
RaiseEvent CurrentPage_Changed(Me, oData)
|
||||
RaiseEvent AnyControl_Focus(oControl, oData)
|
||||
Else
|
||||
CurrentPage = Nothing
|
||||
RaiseEvent AnyControl_Focus(Control, Nothing)
|
||||
|
||||
RaiseEvent CurrentPage_Changed(Me, Nothing)
|
||||
RaiseEvent AnyControl_Focus(oControl, Nothing)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -3,6 +3,5 @@
|
||||
Property HasChanges As Boolean
|
||||
Property IsInsert As Boolean
|
||||
|
||||
Function SaveData() As Boolean
|
||||
Function DeleteData() As Boolean
|
||||
End Interface
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -129,9 +129,21 @@
|
||||
<metadata name="TableAdapterManager.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>612, 17</value>
|
||||
</metadata>
|
||||
<metadata name="TBLOCAL_PROFILE_TYPEBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>295, 56</value>
|
||||
</metadata>
|
||||
<metadata name="TBCW_PROF_DOC_SEARCHBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>785, 17</value>
|
||||
</metadata>
|
||||
<metadata name="TBLOCAL_SEARCH_POSITIONBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>557, 56</value>
|
||||
</metadata>
|
||||
<metadata name="TBDD_CONNECTIONBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>1006, 56</value>
|
||||
</metadata>
|
||||
<metadata name="DSDD_Stammdaten.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>847, 56</value>
|
||||
</metadata>
|
||||
<metadata name="TBCW_PROF_DATA_SEARCHBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>1336, 17</value>
|
||||
</metadata>
|
||||
@@ -141,4 +153,13 @@
|
||||
<metadata name="TBCW_PROF_DATA_SEARCHTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 56</value>
|
||||
</metadata>
|
||||
<metadata name="TBDD_CONNECTIONTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>1250, 56</value>
|
||||
</metadata>
|
||||
<metadata name="TableAdapterManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 95</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>119</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -1,5 +1,6 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraLayout
|
||||
Imports DevExpress.XtraTab
|
||||
@@ -8,7 +9,7 @@ Imports DigitalData.Controls.SQLEditor
|
||||
Imports DigitalData.GUIs.Common
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class frmAdmin_CWProfile
|
||||
Public Class frmAdmin_ClipboardWatcher
|
||||
Implements IAdminForm
|
||||
|
||||
Public Property PrimaryKey As Integer Implements IAdminForm.PrimaryKey
|
||||
@@ -23,8 +24,34 @@ Public Class frmAdmin_CWProfile
|
||||
Private Const TAB_PAGE_DOCSEARCH = "TAB_PAGE_DOCSEARCH"
|
||||
Private Const TAB_PAGE_DATASEARCH = "TAB_PAGE_DATASEARCH"
|
||||
|
||||
Private Const SEARCH_POSITION_PRIMARY As Integer = 0
|
||||
Private Const SEARCH_POSITION_SECONDARY As Integer = 1
|
||||
Private Const SEARCH_POSITION_TERTIARY As Integer = 2
|
||||
|
||||
Private Const PROFILE_TYPE_DATA_DOCS As Integer = 0
|
||||
Private Const PROFILE_TYPE_DOCS_ONLY As Integer = 1
|
||||
Private Const PROFILE_TYPE_DATA_ONLY As Integer = 2
|
||||
|
||||
Private Pages As ClassDetailPages
|
||||
|
||||
Friend Class ProfileType
|
||||
Public Property Id As Integer
|
||||
Public Property Name As String
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return Name
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Friend Class SearchPosition
|
||||
Public Property Id As Integer
|
||||
Public Property Name As String
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return Name
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Public Sub New(PrimaryKey As Integer)
|
||||
MyBase.New(My.LogConfig)
|
||||
|
||||
@@ -37,6 +64,8 @@ Public Class frmAdmin_CWProfile
|
||||
End Sub
|
||||
|
||||
Private Sub frmAdmin_CWProfile_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
'TODO: Diese Codezeile lädt Daten in die Tabelle "DSDD_Stammdaten.TBDD_CONNECTION". Sie können sie bei Bedarf verschieben oder entfernen.
|
||||
Me.TBDD_CONNECTIONTableAdapter.Fill(Me.DSDD_Stammdaten.TBDD_CONNECTION)
|
||||
Try
|
||||
TBCW_PROFILESTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString
|
||||
TBCW_PROFILESTableAdapter.Fill(DBCW_Stammdaten.TBCW_PROFILES, PrimaryKey)
|
||||
@@ -47,6 +76,9 @@ 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)
|
||||
|
||||
TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString
|
||||
TBDD_CONNECTIONTableAdapter.Fill(DSDD_Stammdaten.TBDD_CONNECTION)
|
||||
|
||||
' Configure the GridViews with some default options
|
||||
Dim oViews As New List(Of GridView) From {GridViewDataSearch, GridViewDocSearch}
|
||||
Dim oGridBuilder As New GridBuilder(oViews)
|
||||
@@ -57,10 +89,17 @@ Public Class frmAdmin_CWProfile
|
||||
' Add Focus Handler to all controls in all LayoutControls
|
||||
Dim oLayoutControls = New List(Of LayoutControl) From {LayoutControlProfile, LayoutControlDocSearch, LayoutControlDataSearch}
|
||||
|
||||
Pages = New ClassDetailPages(oLayoutControls)
|
||||
DBCW_Stammdaten.TBLOCAL_SEARCH_POSITION.Rows.Add(SEARCH_POSITION_PRIMARY, "Haupttabelle")
|
||||
DBCW_Stammdaten.TBLOCAL_SEARCH_POSITION.Rows.Add(SEARCH_POSITION_SECONDARY, "Erste Detailtabelle")
|
||||
DBCW_Stammdaten.TBLOCAL_SEARCH_POSITION.Rows.Add(SEARCH_POSITION_TERTIARY, "Zweite Detailtabelle")
|
||||
|
||||
DBCW_Stammdaten.TBLOCAL_PROFILE_TYPE.Rows.Add(PROFILE_TYPE_DATA_DOCS, "Dokumente und Daten")
|
||||
DBCW_Stammdaten.TBLOCAL_PROFILE_TYPE.Rows.Add(PROFILE_TYPE_DOCS_ONLY, "Nur Dokumente")
|
||||
DBCW_Stammdaten.TBLOCAL_PROFILE_TYPE.Rows.Add(PROFILE_TYPE_DATA_ONLY, "Nur Daten")
|
||||
|
||||
Pages = New ClassDetailPages(My.LogConfig, Me, oLayoutControls)
|
||||
Pages.AddRange({
|
||||
New ClassDetailPages.DetailPage With {
|
||||
.IsPrimary = True,
|
||||
New ClassDetailPages.PrimaryPage(IsInsert) With {
|
||||
.Name = "Profil",
|
||||
.TabPage = PageProfile,
|
||||
.BindingSource = TBCW_PROFILESBindingSource,
|
||||
@@ -80,18 +119,19 @@ Public Class frmAdmin_CWProfile
|
||||
.Name = "Daten-Suche",
|
||||
.TabPage = PageDataSearch,
|
||||
.BindingSource = TBCW_PROF_DATA_SEARCHBindingSource,
|
||||
.DataTable = DBCW_Stammdaten.TBCW_PROF_DATA_SEARCH
|
||||
.DataTable = DBCW_Stammdaten.TBCW_PROF_DATA_SEARCH,
|
||||
.AddedWhoEdit = txtAddedWho11,
|
||||
.ChangedWhoEdit = txtChangedWho11
|
||||
}
|
||||
})
|
||||
|
||||
AddHandler Pages.AnyControl_Focus, AddressOf AnyControl_Focus
|
||||
AddHandler Pages.AnyControl_Changed, AddressOf AnyControl_Changed
|
||||
AddHandler Pages.CurrentPage_Changed, AddressOf CurrentPage_Changed
|
||||
Catch ex As Exception
|
||||
ShowErrorMessage(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub AnyControl_Focus(sender As Object, e As ClassDetailPages.DetailPageEventArgs)
|
||||
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
|
||||
@@ -103,10 +143,6 @@ Public Class frmAdmin_CWProfile
|
||||
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
|
||||
@@ -116,53 +152,26 @@ Public Class frmAdmin_CWProfile
|
||||
labelStatus.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Public Function SaveData() As Boolean Implements IAdminForm.SaveData
|
||||
If Pages.CurrentPage Is Nothing Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oPage = Pages.CurrentPage
|
||||
|
||||
Try
|
||||
oPage.BindingSource.EndEdit()
|
||||
|
||||
If oPage.DataTable.GetChanges() IsNot Nothing Then
|
||||
HasChanges = True
|
||||
|
||||
If IsInsert Then
|
||||
oPage.AddedWhoEdit.EditValue = My.Application.User.UserName
|
||||
Else
|
||||
oPage.ChangedWhoEdit.EditValue = My.Application.User.UserName
|
||||
End If
|
||||
|
||||
oPage.BindingSource.EndEdit()
|
||||
Return True
|
||||
Else
|
||||
HasChanges = False
|
||||
End If
|
||||
|
||||
Return False
|
||||
Catch ex As Exception
|
||||
ShowErrorMessage(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub BarButtonSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonSave.ItemClick
|
||||
ResetMessages()
|
||||
|
||||
If SaveData() And HasChanges Then
|
||||
Select Case Pages.CurrentPage.TabPage.Name
|
||||
If Pages.PrepareSave() = True Then
|
||||
Dim oPage = Pages.Current
|
||||
|
||||
Select Case oPage.TabPage.Name
|
||||
Case PageProfile.Name
|
||||
TBCW_PROFILESTableAdapter.Update(Pages.CurrentPage.DataTable)
|
||||
TBCW_PROFILESTableAdapter.Update(oPage.DataTable)
|
||||
|
||||
Case PageDocumentSearch.Name
|
||||
TBCW_PROF_DOC_SEARCHTableAdapter.Update(Pages.CurrentPage.DataTable)
|
||||
TBCW_PROF_DOC_SEARCHTableAdapter.Update(oPage.DataTable)
|
||||
|
||||
Case PageDataSearch.Name
|
||||
TBCW_PROF_DATA_SEARCHTableAdapter.Update(oPage.DataTable)
|
||||
End Select
|
||||
|
||||
ShowStatus($"{Pages.CurrentPage.Name} gespeichert!")
|
||||
oPage.IsInsert = False
|
||||
|
||||
ShowStatus($"{oPage.Name} gespeichert!")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -171,13 +180,16 @@ Public Class frmAdmin_CWProfile
|
||||
End Function
|
||||
|
||||
Public Function AddData() As Boolean
|
||||
If Pages.CurrentPage Is Nothing Then
|
||||
Dim oPage = Pages.Current
|
||||
|
||||
If Pages.Current Is Nothing Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oPage = Pages.CurrentPage
|
||||
If oPage.IsPrimary = False Then
|
||||
oPage.DataTable.Columns.Item("PROFILE_ID").DefaultValue = PrimaryKey
|
||||
End If
|
||||
|
||||
oPage.DataTable.Columns.Item("PROFILE_ID").DefaultValue = PrimaryKey
|
||||
Dim oNewRecord As DataRowView = oPage.BindingSource.AddNew()
|
||||
|
||||
Return True
|
||||
@@ -223,6 +235,16 @@ Public Class frmAdmin_CWProfile
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonNew_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonNew.ItemClick
|
||||
Pages.Current.IsInsert = True
|
||||
|
||||
AddData()
|
||||
End Sub
|
||||
|
||||
Private Sub XtraTabControl2_SelectedPageChanged(sender As Object, e As TabPageChangedEventArgs) Handles XtraTabControl2.SelectedPageChanged
|
||||
Dim oPage = Pages.GetDetailPage(e.Page)
|
||||
|
||||
If oPage IsNot Nothing Then
|
||||
Pages.Current = oPage
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
@@ -193,7 +193,6 @@ Public Class frmAdmin_Start
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub GridView1_RowClick(sender As Object, e As RowClickEventArgs) Handles GridView1.RowClick
|
||||
Try
|
||||
If e.Clicks = 2 And e.Button = MouseButtons.Left Then
|
||||
|
||||
Reference in New Issue
Block a user