Administation: Ask to save when changes were made

This commit is contained in:
Jonathan Jenne 2021-06-28 13:13:27 +02:00
parent 518e0369f3
commit 4643f40b26
3 changed files with 2785 additions and 499 deletions

View File

@ -143,6 +143,7 @@ Partial Class frmAdministration
Me.TBDD_DOKUMENTARTBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.MyDataset = New Global_Indexer.MyDataset()
Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.colAKTIV = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colBEZEICHNUNG = New DevExpress.XtraGrid.Columns.GridColumn()
Me.Label3 = New System.Windows.Forms.Label()
Me.XtraTabControl1 = New DevExpress.XtraTab.XtraTabControl()
@ -308,7 +309,6 @@ Partial Class frmAdministration
Me.TBGI_REGEX_DOCTYPETableAdapter = New Global_Indexer.MyDatasetTableAdapters.TBGI_REGEX_DOCTYPETableAdapter()
Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPage8 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.colAKTIV = New DevExpress.XtraGrid.Columns.GridColumn()
GUIDLabel = New System.Windows.Forms.Label()
GUIDLabel1 = New System.Windows.Forms.Label()
NAMELabel = New System.Windows.Forms.Label()
@ -1026,6 +1026,12 @@ Partial Class frmAdministration
Me.GridView1.OptionsView.ShowColumnHeaders = False
Me.GridView1.OptionsView.ShowGroupPanel = False
'
'colAKTIV
'
resources.ApplyResources(Me.colAKTIV, "colAKTIV")
Me.colAKTIV.FieldName = "AKTIV"
Me.colAKTIV.Name = "colAKTIV"
'
'colBEZEICHNUNG
'
resources.ApplyResources(Me.colBEZEICHNUNG, "colBEZEICHNUNG")
@ -2459,12 +2465,6 @@ Partial Class frmAdministration
Me.RibbonPage8.Name = "RibbonPage8"
resources.ApplyResources(Me.RibbonPage8, "RibbonPage8")
'
'colAKTIV
'
resources.ApplyResources(Me.colAKTIV, "colAKTIV")
Me.colAKTIV.FieldName = "AKTIV"
Me.colAKTIV.Name = "colAKTIV"
'
'frmAdministration
'
Me.Appearance.Options.UseFont = True

File diff suppressed because it is too large Load Diff

View File

@ -435,6 +435,34 @@ Public Class frmAdministration
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in Save Man Index: ")
End Try
End Sub
Sub Save_Regex()
If Not IsInsert Then
TextBox4.Text = Environment.UserName
End If
Try
Me.TBGI_REGEX_DOCTYPEBindingSource.EndEdit()
Catch ex As Exception
MsgBox("Error in Save Regex1: " & vbNewLine & ex.Message, MsgBoxStyle.Exclamation)
Exit Sub
End Try
If MyDataset.TBGI_REGEX_DOCTYPE.GetChanges Is Nothing = False Then
Try
Me.TBGI_REGEX_DOCTYPEBindingSource.EndEdit()
Catch ex As Exception
MsgBox("Error in Save Regex2: " & vbNewLine & ex.Message, MsgBoxStyle.Exclamation)
End Try
TBGI_REGEX_DOCTYPETableAdapter.Update(MyDataset.TBGI_REGEX_DOCTYPE)
SetStatus("Profilzuordnung gespeichert!")
Else
ClearStatus()
End If
IsInsert = False
End Sub
Sub Save_IndexAuto()
Try
Me.TBDD_INDEX_AUTOMBindingSource.EndEdit()
@ -1026,30 +1054,7 @@ Public Class frmAdministration
End Sub
Private Sub BarButtonItem13_ItemClick_1(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem13.ItemClick
If Not IsInsert Then
TextBox4.Text = Environment.UserName
End If
Try
Me.TBGI_REGEX_DOCTYPEBindingSource.EndEdit()
Catch ex As Exception
MsgBox("Error in Save Regex1: " & vbNewLine & ex.Message, MsgBoxStyle.Exclamation)
Exit Sub
End Try
If MyDataset.TBGI_REGEX_DOCTYPE.GetChanges Is Nothing = False Then
Try
Me.TBGI_REGEX_DOCTYPEBindingSource.EndEdit()
Catch ex As Exception
MsgBox("Error in Save Regex2: " & vbNewLine & ex.Message, MsgBoxStyle.Exclamation)
End Try
TBGI_REGEX_DOCTYPETableAdapter.Update(MyDataset.TBGI_REGEX_DOCTYPE)
SetStatus("Profilzuordnung gespeichert!")
Else
ClearStatus()
End If
IsInsert = False
Save_Regex()
End Sub
Private Sub BarButtonItem14_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem14.ItemClick
@ -1310,4 +1315,89 @@ Public Class frmAdministration
DEFAULT_VALUETextBox.Text = oValue
End If
End Sub
Private Sub GridView1_BeforeLeaveRow(sender As Object, e As RowAllowEventArgs) Handles GridView1.BeforeLeaveRow
Dim oRowView As DataRowView = GridView1.GetRow(e.RowHandle)
Dim oProfileName As String = oRowView?.Row.Item("BEZEICHNUNG")
If oRowView Is Nothing Then
Exit Sub
End If
Check_HasChanges(oProfileName)
End Sub
Private Function Check_HasChanges(ProfileName As String) As Boolean
TBDD_DOKUMENTARTBindingSource.EndEdit()
If MyDataset.TBDD_DOKUMENTART.GetChanges IsNot Nothing Then
If Ask_SaveChanges("Dokumentarten", ProfileName) Then
Save_Dokumentart()
Return True
Else
MyDataset.TBDD_DOKUMENTART.RejectChanges()
Return False
End If
End If
TBDD_INDEX_MANBindingSource.EndEdit()
If MyDataset.TBDD_INDEX_MAN.GetChanges IsNot Nothing Then
If Ask_SaveChanges("Manuelle Indexe", ProfileName) Then
Save_IndexMan()
Return True
Else
MyDataset.TBDD_INDEX_MAN.RejectChanges()
Return False
End If
End If
TBDD_INDEX_AUTOMBindingSource.EndEdit()
If MyDataset.TBDD_INDEX_AUTOM.GetChanges() IsNot Nothing Then
If Ask_SaveChanges("Automatische Indexe", ProfileName) Then
Save_IndexAuto()
Return True
Else
MyDataset.TBDD_INDEX_AUTOM.RejectChanges()
Return False
End If
End If
TBDD_INDEX_MAN_POSTPROCESSINGBindingSource.EndEdit()
If MyDataset.TBDD_INDEX_MAN_POSTPROCESSING.GetChanges() IsNot Nothing Then
If Ask_SaveChanges("Nachbearbeitung", ProfileName) Then
Save_PostProcessing()
Return True
Else
MyDataset.TBDD_INDEX_AUTOM.RejectChanges()
Return False
End If
End If
TBGI_REGEX_DOCTYPEBindingSource.EndEdit()
If MyDataset.TBGI_REGEX_DOCTYPE.GetChanges() IsNot Nothing Then
If Ask_SaveChanges("Automatische Profilauswahl", ProfileName) Then
Save_Regex()
Return True
Else
MyDataset.TBGI_REGEX_DOCTYPE.RejectChanges()
Return False
End If
End If
Return True
End Function
Private Function Ask_SaveChanges(Entity As String, ProfileName As String) As Boolean
Dim oMessage = $"Sie haben im Profil '{ProfileName}' ungespeicherte Änderungen im Bereich '{Entity}'. Wollen Sie die Änderungen speichern?"
Dim oResult = MsgBox(oMessage, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text)
If oResult = MsgBoxResult.Yes Then
Return True
Else
Return False
End If
End Function
Private Sub frmAdministration_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Check_HasChanges(BEZEICHNUNGTextBox.Text)
End Sub
End Class