ZooFlow: Finishing Attribute Form
This commit is contained in:
77
GUIs.ZooFlow/Administration/frmAdmin_IDBAttribute.vb
Normal file
77
GUIs.ZooFlow/Administration/frmAdmin_IDBAttribute.vb
Normal file
@@ -0,0 +1,77 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class frmAdmin_IDBAttribute
|
||||
Implements interfaceAdmin_Form
|
||||
|
||||
Private Property Logger As Logger Implements interfaceAdmin_Form.Logger
|
||||
Public Property HasChanges As Boolean = False Implements interfaceAdmin_Form.HasChanges
|
||||
Public Property IsInsert As Boolean = False Implements interfaceAdmin_Form.IsInsert
|
||||
Public Property PrimaryKey As Integer Implements interfaceAdmin_Form.PrimaryKey
|
||||
|
||||
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.
|
||||
Logger = My.LogConfig.GetLogger()
|
||||
Me.PrimaryKey = PrimaryKey
|
||||
Me.IsInsert = IsInsert
|
||||
End Sub
|
||||
|
||||
Private Sub frmAdmin_Attribute_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Try
|
||||
TBIDB_ATTRIBUTETableAdapter.Fill(DSIDB_Stammdaten.TBIDB_ATTRIBUTE, PrimaryKey)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
ResetMessages()
|
||||
|
||||
If SaveData() Then
|
||||
Close()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function SaveData() As Boolean Implements interfaceAdmin_Form.SaveData
|
||||
Try
|
||||
TBIDB_ATTRIBUTEBindingSource.EndEdit()
|
||||
|
||||
If DSIDB_Stammdaten.TBIDB_ATTRIBUTE.GetChanges() IsNot Nothing Then
|
||||
HasChanges = True
|
||||
|
||||
If IsInsert Then
|
||||
txtAddedWho.EditValue = My.Application.User.UserName
|
||||
Else
|
||||
txtChangedWho.EditValue = My.Application.User.UserName
|
||||
End If
|
||||
|
||||
TBIDB_ATTRIBUTEBindingSource.EndEdit()
|
||||
TBIDB_ATTRIBUTETableAdapter.Update(DSIDB_Stammdaten.TBIDB_ATTRIBUTE)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user