|
|
Imports C1.Win.C1TrueDBGrid
|
|
|
Imports System
|
|
|
Imports System.Data
|
|
|
Imports System.Data.SqlTypes
|
|
|
Imports System.Data.SqlClient
|
|
|
Namespace TKB.VV.Utils
|
|
|
''' <summary>
|
|
|
''' Klasse, um die Profile eines Mitarbeiters zu handeln
|
|
|
''' </summary>
|
|
|
''' <remarks></remarks>
|
|
|
Public Class clsProfile
|
|
|
Inherits TKB.VV.DB.clsProfil
|
|
|
Public Profildata As DataTable
|
|
|
|
|
|
''' <summary>
|
|
|
''' Profile des aktuellen Mitarbeiters auselesen
|
|
|
''' </summary>
|
|
|
''' <returns></returns>
|
|
|
''' <remarks></remarks>
|
|
|
Public Function Get_Profil_By_Mitarbeiter() As DataTable
|
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
|
scmCmdToExecute.CommandText = "dbo.sp_get_ma_profile"
|
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
|
Try
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@mitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Globals.clsmitarbeiter.iMitarbeiternr.Value))
|
|
|
sdaAdapter.Fill(dtToReturn)
|
|
|
Me.Profildata = dtToReturn
|
|
|
Return dtToReturn
|
|
|
Catch ex As Exception
|
|
|
Throw New Exception("clsProfile::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
|
Finally
|
|
|
scmCmdToExecute.Dispose()
|
|
|
sdaAdapter.Dispose()
|
|
|
End Try
|
|
|
End Function
|
|
|
|
|
|
Public Function Get_Profil(ByVal nr As Integer)
|
|
|
Me.cpMainConnectionProvider = Globals.conn
|
|
|
Me.iProfilnr = New SqlInt32(CType(Nr, Int32))
|
|
|
Globals.conn.OpenConnection()
|
|
|
Me.SelectOne()
|
|
|
Globals.conn.CloseConnection(True)
|
|
|
End Function
|
|
|
|
|
|
Public Function Set_Aktuelles_Profil(ByVal Profilname As String)
|
|
|
For Each dr As DataRow In Me.Profildata.Rows
|
|
|
If dr("Bezeichnung") = Profilname Then
|
|
|
Me.cpMainConnectionProvider = Globals.conn
|
|
|
Me.iProfilnr = New SqlInt32(CType(dr("Profilnr"), Int32))
|
|
|
Me.SelectOne()
|
|
|
End If
|
|
|
Next
|
|
|
End Function
|
|
|
|
|
|
''' <summary>
|
|
|
''' Neue Person einf<6E>gen
|
|
|
''' </summary>
|
|
|
''' <returns></returns>
|
|
|
''' <remarks></remarks>
|
|
|
Public Function Add_New(Optional ByVal Bezeichnung As String = "") As Integer
|
|
|
Dim db As New TKB.VV.DB.clsMyKey_Tabelle
|
|
|
db.cpMainConnectionProvider = Globals.conn
|
|
|
Dim newkey = db.get_dbkey("Profil")
|
|
|
db.Dispose()
|
|
|
Me.iProfilnr = New SqlInt32(CType(newkey, Int32))
|
|
|
Me.sBezeichnung = New SqlString(CType(Bezeichnung, String))
|
|
|
Me.iMitarbeiternr = New SqlInt32(CType(Globals.clsmitarbeiter.iMitarbeiternr.Value, Int32))
|
|
|
Me.sV_Aktiv_Vertragselemente = New SqlString(CType("", String))
|
|
|
Me.bV_Aktiv_Vertragspartner = New SqlBoolean(CType(False, Boolean))
|
|
|
Me.sV_Sort = New SqlString(CType("", String))
|
|
|
Me.sV_Register = New SqlString(CType("", String))
|
|
|
Me.bStandard = New SqlBoolean(CType(False, Boolean))
|
|
|
Me.bSelektionsart = New SqlBoolean(CType(True, Boolean))
|
|
|
Me.bAktiv = New SqlBoolean(CType(True, Boolean))
|
|
|
Me.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
|
|
Me.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
|
Me.iMutierer = New SqlInt32(CType(Globals.clsmitarbeiter.iMitarbeiternr.Value, Int32))
|
|
|
Me.cpMainConnectionProvider = Globals.conn
|
|
|
Globals.conn.OpenConnection()
|
|
|
Me.Insert()
|
|
|
Globals.conn.CloseConnection(True)
|
|
|
Return newkey
|
|
|
End Function
|
|
|
|
|
|
|
|
|
''' <summary>
|
|
|
''' Profil sichern
|
|
|
''' </summary>
|
|
|
''' <returns></returns>
|
|
|
''' <remarks></remarks>
|
|
|
Public Function Save_Data() As Integer
|
|
|
Me.cpMainConnectionProvider = Globals.conn
|
|
|
Me.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
|
Me.iMutierer = New SqlInt32(CType(Globals.clsmitarbeiter.iMitarbeiternr.Value, Int32))
|
|
|
Globals.conn.OpenConnection()
|
|
|
Me.Update()
|
|
|
Globals.conn.CloseConnection(True)
|
|
|
Return Me.iProfilnr
|
|
|
End Function
|
|
|
|
|
|
Public Function Delete_Profil(ByVal Profilnr As Integer) As Boolean
|
|
|
Try
|
|
|
Me.cpMainConnectionProvider = Globals.conn
|
|
|
Globals.conn.OpenConnection()
|
|
|
Me.Delete()
|
|
|
Globals.conn.CloseConnection(True)
|
|
|
Return True
|
|
|
Catch
|
|
|
Return False
|
|
|
End Try
|
|
|
End Function
|
|
|
|
|
|
|
|
|
End Class
|
|
|
End Namespace
|