You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
4.9 KiB
170 lines
4.9 KiB
'''<summary>Diese klasse beinhaltet die Logik für Anwendungen</summary>
|
|
Public Class Anwendung
|
|
|
|
#Region "Members"
|
|
Private _anwendungsNr As Integer
|
|
Private _bezeichnung As String
|
|
Private _beschreibung As String
|
|
Private _mandantNr As Integer 'wird nicht gebraucht. kein property implementiert
|
|
Private _aktiv As Boolean
|
|
Private _erstelltAm As DateTime
|
|
Private _mutiertAm As DateTime
|
|
Private _mutiererId As Integer
|
|
#End Region
|
|
|
|
#Region "Constructors"
|
|
'''<summary>default konstruktor</summary>
|
|
Public Sub New()
|
|
|
|
End Sub
|
|
|
|
'''<summary>lädt eine anwendung aus der db</summary>
|
|
'''<param name="anwendungsNr"></param>
|
|
Public Sub New(ByVal anwendungsNr As Integer)
|
|
|
|
If anwendungsNr.ToString() <> Config.GetParameterValue("NullReplaceValue") Then
|
|
Dim ds As New DataSet()
|
|
DataAccess.Anwendung.GetAnwendung(ds, anwendungsNr)
|
|
LoadData(ds)
|
|
Else
|
|
'erstelle leere instanz
|
|
End If
|
|
End Sub
|
|
|
|
'''<summary>erstellt eine neue anwendung in der db und lädt diese</summary>
|
|
'''<param name="bezeichnung"></param>
|
|
'''<param name="beschreibung"></param>
|
|
'''<param name="aktiv"></param>
|
|
Public Sub New(ByVal bezeichnung As String, ByVal beschreibung As String, ByVal aktiv As Boolean, ByVal mutiererId As Integer)
|
|
_bezeichnung = bezeichnung
|
|
_beschreibung = beschreibung
|
|
_aktiv = aktiv
|
|
Save(mutiererId)
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "Private Functions"
|
|
'''<summary>Lädt alle Daten einer Anwendung aus der DB</summary>
|
|
Private Sub LoadData(ByVal ds As DataSet)
|
|
Try
|
|
If Common.Tools.ValidateDS(ds) Then
|
|
_anwendungsNr = Common.Tools.CToInt32(ds.Tables(0).Rows(0)("anwendungNr"))
|
|
_bezeichnung = NullHandler.CToString(ds.Tables(0).Rows(0)("bezeichnung"))
|
|
_beschreibung = NullHandler.CToString(ds.Tables(0).Rows(0)("beschreibung"))
|
|
_mandantNr = NullHandler.CToInt32(ds.Tables(0).Rows(0)("mandantNr"))
|
|
_aktiv = Common.Tools.CToBool(ds.Tables(0).Rows(0)("aktiv"))
|
|
_erstelltAm = NullHandler.CToDateTime(ds.Tables(0).Rows(0)("erstellt_am"))
|
|
_mutiertAm = NullHandler.CToDateTime(ds.Tables(0).Rows(0)("mutiert_am"))
|
|
_mutiererId = Common.Tools.CToInt32(ds.Tables(0).Rows(0)("mutierer"))
|
|
End If
|
|
Catch ex As Exception
|
|
TKBLib.Errorhandling.TraceHelper.Msg("EDOKALib.BF.Anwendung.Save", ex.Message + " " + ex.StackTrace, TraceLevel.Error)
|
|
Throw ex
|
|
End Try
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "Public Functions"
|
|
'''<summary>Speichert alle Members in die DB</summary>
|
|
Public Sub Save(ByVal mutierer As Integer)
|
|
Try
|
|
Dim err As Integer
|
|
Dim key As Integer
|
|
|
|
If _anwendungsNr = 0 Then 'create new
|
|
err = DataAccess.Anwendung.Add(key, _bezeichnung, _beschreibung, _mandantNr, _aktiv, mutierer)
|
|
If err = 0 Then
|
|
_anwendungsNr = key
|
|
End If
|
|
Else 'save existing
|
|
err = DataAccess.Anwendung.Update(_anwendungsNr, _bezeichnung, Beschreibung, _mandantNr, _aktiv, mutierer)
|
|
End If
|
|
|
|
If err <> 0 Then
|
|
Throw New DokumentartException(Meldungstext.GetInhaltById(40000))
|
|
End If
|
|
|
|
'refresh data
|
|
Dim ds As New DataSet()
|
|
DataAccess.Anwendung.GetAnwendung(ds, _anwendungsNr)
|
|
LoadData(ds)
|
|
|
|
Catch ex As Exception
|
|
TKBLib.Errorhandling.TraceHelper.Msg("EDOKALib.BF.Anwendung.Save", ex.Message + " " + ex.StackTrace, TraceLevel.Error)
|
|
Throw ex
|
|
End Try
|
|
End Sub
|
|
'''<summary>Löscht einen Mitarbeiter aus der DB (Setzt in auf inaktiv)</summary>
|
|
Public Sub Delete(ByVal mutierer As Integer)
|
|
Try
|
|
_aktiv = False
|
|
Save(mutierer)
|
|
Catch ex As Exception
|
|
TKBLib.Errorhandling.TraceHelper.Msg("EDOKALib.BF.Anwendung.Delete", ex.Message + " " + ex.StackTrace, TraceLevel.Error)
|
|
Throw ex
|
|
End Try
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "Properties"
|
|
Public Property AnwendungsNr() As Integer
|
|
Get
|
|
Return _anwendungsNr
|
|
End Get
|
|
Set(ByVal Value As Integer)
|
|
_anwendungsNr = Value
|
|
End Set
|
|
End Property
|
|
Public Property Bezeichnung() As String
|
|
Get
|
|
Return _bezeichnung
|
|
End Get
|
|
Set(ByVal Value As String)
|
|
_bezeichnung = Value
|
|
End Set
|
|
End Property
|
|
Public Property Beschreibung() As String
|
|
Get
|
|
Return _beschreibung
|
|
End Get
|
|
Set(ByVal Value As String)
|
|
_beschreibung = Value
|
|
End Set
|
|
End Property
|
|
Public Property Aktiv() As Boolean
|
|
Get
|
|
Return _aktiv
|
|
End Get
|
|
Set(ByVal Value As Boolean)
|
|
_aktiv = Value
|
|
End Set
|
|
End Property
|
|
Public Property ErstelltAm() As DateTime
|
|
Get
|
|
Return _erstelltAm
|
|
End Get
|
|
Set(ByVal Value As DateTime)
|
|
_erstelltAm = Value
|
|
End Set
|
|
End Property
|
|
Public Property MutiertAm() As DateTime
|
|
Get
|
|
Return _mutiertAm
|
|
End Get
|
|
Set(ByVal Value As DateTime)
|
|
_mutiertAm = Value
|
|
End Set
|
|
End Property
|
|
Public Property MutiererId() As Integer
|
|
Get
|
|
Return _mutiererId
|
|
End Get
|
|
Set(ByVal Value As Integer)
|
|
_mutiererId = Value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
End Class
|
|
|