Initial
This commit is contained in:
171
BusinessFacade/TeamMitarbeiter.vb
Normal file
171
BusinessFacade/TeamMitarbeiter.vb
Normal file
@@ -0,0 +1,171 @@
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
|
||||
Imports EDOKALib.Common
|
||||
|
||||
'''<summary>Diese klasse beinhaltet die Logik für die Team-Mitarbeiter Zuordnung</summary>
|
||||
Public Class TeamMitarbeiter
|
||||
|
||||
#Region "Members"
|
||||
|
||||
Private _teamMitarbeiterNr As Integer = -1
|
||||
Private _team As BusinessFacade.Team
|
||||
Private _mitarbeiterNr As Integer
|
||||
Private _anteil As Integer
|
||||
Private _mandantNr As Integer
|
||||
Private _isAktiv As Boolean
|
||||
Private _erstelltAm As DateTime
|
||||
Private _mutiertAm As DateTime
|
||||
Private _mutiererMitarbeiter As BusinessFacade.Mitarbeiter
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Constructor"
|
||||
|
||||
Public Sub New()
|
||||
End Sub
|
||||
|
||||
Public Sub New(ByVal teamMitarbeiterNr As Integer)
|
||||
Try
|
||||
Dim ds As New DataSet()
|
||||
DataAccess.TeamMitarbeiter.GetById(teamMitarbeiterNr, ds)
|
||||
|
||||
If ds.Tables.Count > 0 Then
|
||||
If ds.Tables(0).Rows.Count > 0 Then
|
||||
_teamMitarbeiterNr = teamMitarbeiterNr
|
||||
_team = New BusinessFacade.Team(Tools.CToInt32(ds.Tables(0).Rows(0)("teamNr")))
|
||||
_mitarbeiterNr = Tools.CToInt32(ds.Tables(0).Rows(0)("mitarbeiternr"))
|
||||
_anteil = Tools.CToInt32(ds.Tables(0).Rows(0)("anteil"))
|
||||
_mandantNr = Tools.CToInt32(ds.Tables(0).Rows(0)("mandantnr"))
|
||||
_isAktiv = Common.Tools.CToBool(ds.Tables(0).Rows(0)("aktiv"))
|
||||
_erstelltAm = Tools.CToDateTime(ds.Tables(0).Rows(0)("erstellt_am"))
|
||||
_mutiertAm = Tools.CToDateTime(ds.Tables(0).Rows(0)("mutiert_am"))
|
||||
_mutiererMitarbeiter = New BusinessFacade.Mitarbeiter(Tools.CToInt32(ds.Tables(0).Rows(0)("mutierer")))
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Throw ex
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Public methods"
|
||||
|
||||
'''<summary>Gibt eine Liste mit allen Teams für einen Mitarbeitern zurück</summary>
|
||||
'''<param name="ds">Das DataSet welches gefüllt werden soll</param>
|
||||
Public Overloads Shared Sub GetListe(ByVal mitarbeiterNr As Integer, ByRef ds As DataSet)
|
||||
Try
|
||||
DataAccess.TeamMitarbeiter.GetListByMitarbeiterNr(mitarbeiterNr, ds)
|
||||
Catch ex As Exception
|
||||
Throw ex
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'''<summary>Löscht eine Team-Mitarbeiter Zuordnung aus der Datenbank</summary>
|
||||
'''<param name="teamMitarbeiterNr">Zu löschende Verbindung</param>
|
||||
'''<param name="mutiererMitarbeiterNr">Die Id des Benutzers, welcher die Änderungen vornimmt</param>
|
||||
Public Overloads Shared Function Delete(ByVal teamMitarbeiterNr As Integer, ByVal mutiererMitarbeiterNr As Integer)
|
||||
Try
|
||||
DataAccess.TeamMitarbeiter.Delete(teamMitarbeiterNr, mutiererMitarbeiterNr)
|
||||
Catch ex As Exception
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'''<summary>Speichert die Daten der aktuellen Instanz in die Datenbank</summary>
|
||||
'''<param name="mutiererMitarbeiterNr">Die Id des Benutzers, welcher die Änderungen vornimmt</param>
|
||||
|
||||
Public Function Save(ByVal mutiererMitarbeiterNr As Integer)
|
||||
Try
|
||||
If _teamMitarbeiterNr < 0 Then
|
||||
'neuer eintrag
|
||||
DataAccess.TeamMitarbeiter.Insert(_team.TeamNr, _mitarbeiterNr, _anteil, _mandantNr, _isAktiv, mutiererMitarbeiterNr)
|
||||
Else
|
||||
'bestehender eintrag
|
||||
DataAccess.TeamMitarbeiter.Update(_teamMitarbeiterNr, _team.TeamNr, _mitarbeiterNr, _anteil, _mandantNr, _isAktiv, mutiererMitarbeiterNr)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Properties"
|
||||
|
||||
Public ReadOnly Property TeamMitarbeiterNr() As Integer
|
||||
Get
|
||||
Return _teamMitarbeiterNr
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property Team() As BusinessFacade.Team
|
||||
Get
|
||||
Return _team
|
||||
End Get
|
||||
Set(ByVal Value As BusinessFacade.Team)
|
||||
_team = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property MitarbeiterNr() As Integer
|
||||
Get
|
||||
Return _mitarbeiterNr
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
_mitarbeiterNr = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property Anteil() As Integer
|
||||
Get
|
||||
Return _anteil
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
_anteil = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property MandantNr() As Integer
|
||||
Get
|
||||
Return _mandantNr
|
||||
End Get
|
||||
Set(ByVal Value As Integer)
|
||||
_mandantNr = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property IsAktiv() As Boolean
|
||||
Get
|
||||
Return _isAktiv
|
||||
End Get
|
||||
Set(ByVal Value As Boolean)
|
||||
_isAktiv = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property ErstelltAm() As DateTime
|
||||
Get
|
||||
Return _erstelltAm
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property MutiertAm() As DateTime
|
||||
Get
|
||||
Return _mutiertAm
|
||||
End Get
|
||||
Set(ByVal Value As DateTime)
|
||||
_mutiertAm = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property MutiererMitarbeiter() As BusinessFacade.Mitarbeiter
|
||||
Get
|
||||
Return _mutiererMitarbeiter
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user