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.
84 lines
2.3 KiB
84 lines
2.3 KiB
Imports EDOKALib.Common
|
|
|
|
'''<summary>Diese klasse beinhaltet die Logik für die Profile</summary>
|
|
Public Class Profil
|
|
|
|
#Region "Public methods"
|
|
|
|
'''<summary>Gib eine DataTable mit allen profilen eines Benutzers zurück</summary>
|
|
'''<param name="mitarbeiterNr"></param>
|
|
'''<param name="dt"></param>
|
|
|
|
Public Shared Function GetListeByMitarbeiterNr(ByVal mitarbeiterNr As Integer, ByRef dt As DataTable)
|
|
Try
|
|
Dim ds As New DataSet()
|
|
|
|
DataAccess.Profil.GetListeByMitarbeiterNr(mitarbeiterNr, ds)
|
|
|
|
If ds.Tables.Count = 0 Then
|
|
'no datatable -> no data
|
|
TKBLib.Errorhandling.TraceHelper.Msg("EdokaLib.Profil.GetListeByMitarbeiterNr", "Der Mitarbeiter mit der Nr " & mitarbeiterNr & " hat keine Profile", TraceLevel.Info)
|
|
Throw New ProfilException(1, "Der Mitarbeiter mit der Nr " & mitarbeiterNr & " hat keine Profile")
|
|
End If
|
|
|
|
dt = ds.Tables(0)
|
|
|
|
Catch ex As Exception
|
|
TKBLib.Errorhandling.TraceHelper.Msg("EdokaLib.Profil.GetListeByMitarbeiterNr", ex.Message & ex.StackTrace, TraceLevel.Error)
|
|
Throw ex
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>Gibt die Id(Nr) des standard Profils eines Benutzers zurück</summary>
|
|
'''<param name="mitarbeiterNr"></param>
|
|
|
|
Public Shared Function GetStandardProfilNr(ByVal mitarbeiterNr As Integer) As Integer
|
|
Try
|
|
Dim dt As New DataTable()
|
|
Dim i As Integer
|
|
|
|
GetListeByMitarbeiterNr(mitarbeiterNr, dt)
|
|
|
|
For i = 0 To dt.Rows.Count - 1
|
|
If dt.Rows(i).Item("standard") = True Then
|
|
Return dt.Rows(i).Item("profilnr")
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
TKBLib.Errorhandling.TraceHelper.Msg("EdokaLib.Profil.GetStandardProfilNr", ex.Message & ex.StackTrace, TraceLevel.Error)
|
|
Throw ex
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
|
|
End Class
|
|
|
|
#Region "ProfilException"
|
|
|
|
Public Class ProfilException
|
|
Inherits Exception
|
|
|
|
Private _number As Integer
|
|
Private _description As String
|
|
|
|
Public Sub New(ByVal number As Integer, ByVal description As String)
|
|
_number = number
|
|
_description = description
|
|
End Sub
|
|
|
|
Public Overrides ReadOnly Property Message() As String
|
|
Get
|
|
Return _description
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Number() As Integer
|
|
Get
|
|
Return _number
|
|
End Get
|
|
End Property
|
|
|
|
End Class
|
|
|
|
#End Region
|