Initial commit

This commit is contained in:
2020-10-21 10:44:38 +02:00
commit 039adbbadf
1125 changed files with 854026 additions and 0 deletions

View File

@@ -0,0 +1,192 @@
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Public Class clsPruefschrittResultat
Inherits DB.clsPruefSchrittResultat
#Region "Deklarationen"
Public daten As New DataTable
Public Neuer_Datensatz As Boolean = False
Public Mitarbeiterdaten As New DataTable
Dim stammdaten As New DB.clsStammdaten
Dim SpaltenTitel As New Utils.Tabellenspalte
Dim status As New clsStatus
Dim mMutierer As String
Property MutiererText() As String
Get
Return mMutierer
End Get
Set(ByVal value As String)
mMutierer = value
End Set
End Property
#End Region
Sub New()
MyBase.New()
End Sub
Public Overloads Sub dispose()
MyBase.Dispose()
Try
Me.stammdaten = Nothing
Catch
End Try
End Sub
''' <summary>
''' Mutierer auslesen
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function Get_Mutierer(ByVal nr As Integer) As String
Try
Dim ma As New DB.clsMitarbeiter
Dim dt As New DataTable
Dim Retvalue As String
ma.cpMainConnectionProvider = Globals.conn
ma.iMitarbeiternr = New SqlInt32(CType(nr, Int32))
dt = ma.SelectOne()
If dt.Rows.Count = 0 Then
Retvalue = ("{" + nr.ToString + "}")
Else
Retvalue = ma.sName.ToString + " " + ma.sVorname.ToString + ", " + ma.sTgnummer.ToString
End If
ma.Dispose()
dt.Dispose()
Return Retvalue
Catch
Return ""
End Try
End Function
Public Function Get_Data(ByVal Nr As Integer)
Me.cpMainConnectionProvider = Globals.conn
Me.iPruefSchrittResultatNr = New SqlInt32(CType(Nr, Int32))
Globals.conn.OpenConnection()
Me.daten = Me.SelectOne()
Globals.conn.CloseConnection(True)
Try
Me.MutiererText = Get_Mutierer(Me.iMutierer.Value)
Catch ex As Exception
Me.MutiererText = ""
End Try
End Function
Public Function Save_Data() As Integer
Me.cpMainConnectionProvider = Globals.conn
Me.iMutierer = New SqlInt32(CType(Globals.clsmitarbeiter.iMitarbeiternr, Int32))
Me.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
Globals.conn.OpenConnection()
Me.Update()
Globals.conn.CloseConnection(True)
Me.Neuer_Datensatz = False
End Function
''' <summary>
''' Löschen eines Datensatzes erstellen.
''' </summary>
''' <param name="Basenr">Ursprungs-Person: Ist dieser Wert nicht 0, werden die Daten mit BaseNr zuerst gelesen</param>
''' <returns></returns>
''' <remarks></remarks>
Public Function Delete_Data(Optional ByVal Basenr As Integer = 0) As Integer
If Basenr <> 0 Then
Get_Data(Basenr)
End If
If bAktiv.Value = False Then Exit Function
Me.cpMainConnectionProvider = Globals.conn
Me.bAktiv = New SqlBoolean(CType(False, Boolean))
Me.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
Me.iMutierer = New SqlInt32(CType(Globals.clsmitarbeiter.iMitarbeiternr, Int32))
Globals.conn.OpenConnection()
Me.Update()
Globals.conn.CloseConnection(True)
Me.Neuer_Datensatz = False
End Function
Public Overloads Function Delete(Optional ByVal Basenr As Integer = 0) As Integer
If Basenr <> 0 Then
Get_Data(Basenr)
End If
Me.cpMainConnectionProvider = Globals.conn
Globals.conn.OpenConnection()
MyBase.Delete()
Globals.conn.CloseConnection(True)
Me.Neuer_Datensatz = False
End Function
''' <summary>
''' Neue Person einfügen
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function Add_New(ByVal PruefschrittNr As Integer) As Integer
Me.iPruefSchrittResultatNr = New SqlInt32(CType(PruefschrittNr, Int32))
Me.iPruefschrittNr = New SqlInt32(CType(PruefschrittNr, Int32))
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, Int32))
Me.sKurzbeschreibung = New SqlString(CType("", String))
Me.sBeschreibung = New SqlString(CType("", String))
Me.iAnzahl_Pruefungen = New SqlInt32(CType(0, Int32))
Me.iFindings_hoch = New SqlInt32(CType(0, Int32))
Me.iFindings_mittel = New SqlInt32(CType(0, Int32))
Me.iFindings_niedrig = New SqlInt32(CType(0, Int32))
Me.iFinding_kein = New SqlInt32(CType(0, Int32))
Me.cpMainConnectionProvider = Globals.conn
Try
Globals.conn.OpenConnection()
Me.Insert()
Globals.conn.CloseConnection(True)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Me.Neuer_Datensatz = True
Return Me.iPruefSchrittResultatNr.Value
End Function
Public Function Get_Eintraege(ByRef c1daten As C1.Win.C1TrueDBGrid.C1TrueDBGrid, ByVal Mitarbeiternr As Integer, ByRef tree As DevComponents.AdvTree.AdvTree)
Try
Dim ds As New DataSet
Dim connection As New SqlConnection()
Dim da As New SqlDataAdapter("", connection)
Dim sqlcmd As New SqlCommand
sqlcmd.CommandText = "sp_get_pruefschritt"
sqlcmd.Parameters.Add(New SqlParameter("@manr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Mitarbeiternr))
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Connection = connection
Try
connection.ConnectionString = Globals.sConnectionString
connection.Open()
da.SelectCommand = sqlcmd
da.Fill(ds, "Datatable1")
c1daten.DataSource = Nothing
c1daten.DataSource = ds.Tables(0)
c1daten.DataMember = ds.Tables(0).TableName
SpaltenTitel.Spaltentitel_aktualisieren(c1daten, "Pruefschritt", ds.Tables(0))
Catch ex As Exception
MsgBox(ex.Message)
Finally
connection.Close()
da.Dispose()
sqlcmd.Dispose()
End Try
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
End Class

View File

@@ -0,0 +1,491 @@
' ///////////////////////////////////////////////////////////////////////////
' // Description: Data Access class for the table 'key_tabelle'
' // Generated by LLBLGen v1.21.2003.712 Final on: Freitag, 4. Januar 2013, 17:02:51
' // Because the Base Class already implements IDispose, this class doesn't.
' ///////////////////////////////////////////////////////////////////////////
Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Namespace DB
''' <summary>
''' Purpose: Data Access class for the table 'key_tabelle'.
''' </summary>
Public Class clsKey_tabelle
Inherits clsDBInteractionBase
#Region " Class Member Declarations "
Private m_bAktiv As SqlBoolean
Private m_daErstellt_am, m_daMutiert_am As SqlDateTime
Private m_iMutierer, m_iKeynr, m_iKey_wert, m_iMandantnr As SqlInt32
Private m_sBeschreibung As SqlString
#End Region
''' <summary>
''' Purpose: Class constructor.
''' </summary>
Public Sub New()
' // Nothing for now.
End Sub
''' <summary>
''' Purpose: Insert method. This method will insert one new row into the database.
''' </summary>
''' <returns>True if succeeded, otherwise an Exception is thrown. </returns>
''' <remarks>
''' Properties needed for this method:
''' <UL>
''' <LI>sBeschreibung</LI>
''' <LI>iKey_wert</LI>
''' <LI>iMandantnr. May be SqlInt32.Null</LI>
''' <LI>bAktiv. May be SqlBoolean.Null</LI>
''' <LI>daErstellt_am. May be SqlDateTime.Null</LI>
''' <LI>daMutiert_am. May be SqlDateTime.Null</LI>
''' <LI>iMutierer. May be SqlInt32.Null</LI>
''' </UL>
''' Properties set after a succesful call of this method:
''' <UL>
''' <LI>iKeynr</LI>
''' <LI>iErrorCode</LI>
'''</UL>
''' </remarks>
Overrides Public Function Insert() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_key_tabelle_Insert]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@sbeschreibung", SqlDbType.VarChar, 255, ParameterDirection.Input, False, 0, 0, "", DataRowVersion.Proposed, m_sBeschreibung))
scmCmdToExecute.Parameters.Add(New SqlParameter("@ikey_wert", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKey_wert))
scmCmdToExecute.Parameters.Add(New SqlParameter("@imandantnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMandantnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@baktiv", SqlDbType.Bit, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_bAktiv))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daerstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daErstellt_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@damutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daMutiert_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@imutierer", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMutierer))
scmCmdToExecute.Parameters.Add(new SqlParameter("@ikeynr", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iKeynr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
m_iRowsAffected = scmCmdToExecute.ExecuteNonQuery()
m_iKeynr = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@ikeynr").Value, Integer))
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_key_tabelle_Insert' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsKey_tabelle::Insert::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
''' <summary>
''' Purpose: Update method. This method will Update one existing row in the database.
''' </summary>
''' <returns>True if succeeded, otherwise an Exception is thrown. </returns>
''' <remarks>
''' Properties needed for this method:
''' <UL>
''' <LI>iKeynr</LI>
''' <LI>sBeschreibung</LI>
''' <LI>iKey_wert</LI>
''' <LI>iMandantnr. May be SqlInt32.Null</LI>
''' <LI>bAktiv. May be SqlBoolean.Null</LI>
''' <LI>daErstellt_am. May be SqlDateTime.Null</LI>
''' <LI>daMutiert_am. May be SqlDateTime.Null</LI>
''' <LI>iMutierer. May be SqlInt32.Null</LI>
''' </UL>
''' Properties set after a succesful call of this method:
''' <UL>
''' <LI>iErrorCode</LI>
'''</UL>
''' </remarks>
Overrides Public Function Update() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_key_tabelle_Update]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ikeynr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKeynr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@sbeschreibung", SqlDbType.VarChar, 255, ParameterDirection.Input, False, 0, 0, "", DataRowVersion.Proposed, m_sBeschreibung))
scmCmdToExecute.Parameters.Add(New SqlParameter("@ikey_wert", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKey_wert))
scmCmdToExecute.Parameters.Add(New SqlParameter("@imandantnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMandantnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@baktiv", SqlDbType.Bit, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_bAktiv))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daerstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daErstellt_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@damutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daMutiert_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@imutierer", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMutierer))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
m_iRowsAffected = scmCmdToExecute.ExecuteNonQuery()
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_key_tabelle_Update' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsKey_tabelle::Update::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
''' <summary>
''' Purpose: Delete method. This method will Delete one existing row in the database, based on the Primary Key.
''' </summary>
''' <returns>True if succeeded, otherwise an Exception is thrown. </returns>
''' <remarks>
''' Properties needed for this method:
''' <UL>
''' <LI>iKeynr</LI>
''' </UL>
''' Properties set after a succesful call of this method:
''' <UL>
''' <LI>iErrorCode</LI>
'''</UL>
''' </remarks>
Overrides Public Function Delete() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_key_tabelle_Delete]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ikeynr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKeynr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
m_iRowsAffected = scmCmdToExecute.ExecuteNonQuery()
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_key_tabelle_Delete' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsKey_tabelle::Delete::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
''' <summary>
''' Purpose: Select method. This method will Select one existing row from the database, based on the Primary Key.
''' </summary>
''' <returns>DataTable object if succeeded, otherwise an Exception is thrown. </returns>
''' <remarks>
''' Properties needed for this method:
''' <UL>
''' <LI>iKeynr</LI>
''' </UL>
''' Properties set after a succesful call of this method:
''' <UL>
''' <LI>iErrorCode</LI>
''' <LI>iKeynr</LI>
''' <LI>sBeschreibung</LI>
''' <LI>iKey_wert</LI>
''' <LI>iMandantnr</LI>
''' <LI>bAktiv</LI>
''' <LI>daErstellt_am</LI>
''' <LI>daMutiert_am</LI>
''' <LI>iMutierer</LI>
'''</UL>
''' Will fill all properties corresponding with a field in the table with the value of the row selected.
''' </remarks>
Overrides Public Function SelectOne() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_key_tabelle_SelectOne]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("key_tabelle")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@ikeynr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKeynr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
sdaAdapter.Fill(dtToReturn)
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_key_tabelle_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
If dtToReturn.Rows.Count > 0 Then
m_iKeynr = New SqlInt32(CType(dtToReturn.Rows(0)("keynr"), Integer))
m_sBeschreibung = New SqlString(CType(dtToReturn.Rows(0)("beschreibung"), String))
m_iKey_wert = New SqlInt32(CType(dtToReturn.Rows(0)("key_wert"), Integer))
If dtToReturn.Rows(0)("mandantnr") Is System.DBNull.Value Then
m_iMandantnr = SqlInt32.Null
Else
m_iMandantnr = New SqlInt32(CType(dtToReturn.Rows(0)("mandantnr"), Integer))
End If
If dtToReturn.Rows(0)("aktiv") Is System.DBNull.Value Then
m_bAktiv = SqlBoolean.Null
Else
m_bAktiv = New SqlBoolean(CType(dtToReturn.Rows(0)("aktiv"), Boolean))
End If
If dtToReturn.Rows(0)("erstellt_am") Is System.DBNull.Value Then
m_daErstellt_am = SqlDateTime.Null
Else
m_daErstellt_am = New SqlDateTime(CType(dtToReturn.Rows(0)("erstellt_am"), Date))
End If
If dtToReturn.Rows(0)("mutiert_am") Is System.DBNull.Value Then
m_daMutiert_am = SqlDateTime.Null
Else
m_daMutiert_am = New SqlDateTime(CType(dtToReturn.Rows(0)("mutiert_am"), Date))
End If
If dtToReturn.Rows(0)("mutierer") Is System.DBNull.Value Then
m_iMutierer = SqlInt32.Null
Else
m_iMutierer = New SqlInt32(CType(dtToReturn.Rows(0)("mutierer"), Integer))
End If
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsKey_tabelle::SelectOne::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
''' <summary>
''' Purpose: SelectAll method. This method will Select all rows from the table.
''' </summary>
''' <returns>DataTable object if succeeded, otherwise an Exception is thrown. </returns>
''' <remarks>
''' Properties set after a succesful call of this method:
''' <UL>
''' <LI>iErrorCode</LI>
'''</UL>
''' </remarks>
Overrides Public Function SelectAll() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_key_tabelle_SelectAll]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("key_tabelle")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
sdaAdapter.Fill(dtToReturn)
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_key_tabelle_SelectAll' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsKey_tabelle::SelectAll::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
#Region " Class Property Declarations "
Public Property [iKeynr]() As SqlInt32
Get
Return m_iKeynr
End Get
Set(ByVal Value As SqlInt32)
Dim iKeynrTmp As SqlInt32 = Value
If iKeynrTmp.IsNull Then
Throw New ArgumentOutOfRangeException("iKeynr", "iKeynr can't be NULL")
End If
m_iKeynr = Value
End Set
End Property
Public Property [sBeschreibung]() As SqlString
Get
Return m_sBeschreibung
End Get
Set(ByVal Value As SqlString)
Dim sBeschreibungTmp As SqlString = Value
If sBeschreibungTmp.IsNull Then
Throw New ArgumentOutOfRangeException("sBeschreibung", "sBeschreibung can't be NULL")
End If
m_sBeschreibung = Value
End Set
End Property
Public Property [iKey_wert]() As SqlInt32
Get
Return m_iKey_wert
End Get
Set(ByVal Value As SqlInt32)
Dim iKey_wertTmp As SqlInt32 = Value
If iKey_wertTmp.IsNull Then
Throw New ArgumentOutOfRangeException("iKey_wert", "iKey_wert can't be NULL")
End If
m_iKey_wert = Value
End Set
End Property
Public Property [iMandantnr]() As SqlInt32
Get
Return m_iMandantnr
End Get
Set(ByVal Value As SqlInt32)
m_iMandantnr = Value
End Set
End Property
Public Property [bAktiv]() As SqlBoolean
Get
Return m_bAktiv
End Get
Set(ByVal Value As SqlBoolean)
m_bAktiv = Value
End Set
End Property
Public Property [daErstellt_am]() As SqlDateTime
Get
Return m_daErstellt_am
End Get
Set(ByVal Value As SqlDateTime)
m_daErstellt_am = Value
End Set
End Property
Public Property [daMutiert_am]() As SqlDateTime
Get
Return m_daMutiert_am
End Get
Set(ByVal Value As SqlDateTime)
m_daMutiert_am = Value
End Set
End Property
Public Property [iMutierer]() As SqlInt32
Get
Return m_iMutierer
End Get
Set(ByVal Value As SqlInt32)
m_iMutierer = Value
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -0,0 +1,117 @@
Imports System.Data.SqlClient
Imports System.Data.SqlDbType
Public Class frmNeuerVorgabeEintrag
Dim vorgabe As New clsVorgabe
Dim mKey As Integer
Property Key As Integer
Get
Return mKey
End Get
Set(value As Integer)
mKey = value
End Set
End Property
Dim m_tree As New DevComponents.AdvTree.AdvTree
Property Tree As DevComponents.AdvTree.AdvTree
Get
Return m_tree
End Get
Set(value As DevComponents.AdvTree.AdvTree)
m_tree = value
End Set
End Property
Dim m_selectednode As DevComponents.AdvTree.Node
Property SelectedNode As DevComponents.AdvTree.Node
Get
Return m_selectednode
End Get
Set(value As DevComponents.AdvTree.Node)
m_selectednode = value
End Set
End Property
Dim m_parentnode As DevComponents.AdvTree.Node
Property Parentnode As DevComponents.AdvTree.Node
Get
Return m_parentnode
End Get
Set(value As DevComponents.AdvTree.Node)
m_parentnode = value
End Set
End Property
Sub New()
InitializeComponent()
Me.TreeVorgabe.ImageList = Globals.GueltigImages
End Sub
Private Sub frmNeuerVorgabeintrag_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.TreeVorgabe.Nodes.Clear()
For i As Integer = 0 To Me.Tree.Nodes.Count - 1
Me.TreeVorgabe.Nodes.Add(Me.Tree.Nodes(i))
Next i
Me.TreeVorgabe.SelectedNode = Me.SelectedNode
If Me.Key > -1 Then
Me.TreeVorgabe.SelectedNode = Me.TreeVorgabe.SelectedNode.Parent
End If
If m_parentnode IsNot Nothing Then
Me.TreeVorgabe.SelectedNode = Me.Parentnode
End If
If Me.TreeVorgabe.SelectedNode Is Nothing Then
Me.txtKapitelnr.Enabled = False
End If
Me.dtGueltigbis.Value = "31.12.2099"
Me.txtKapitelnr.Focus()
If Me.Key > -1 Then
vorgabe.Get_Data(Me.Key)
Me.txtKapitelnr.Text = vorgabe.sKapitelNr.Value.ToString
Me.txtKapitel.Text = vorgabe.sKapitel.Value.ToString
Try
Me.dtGueltigbis.Value = vorgabe.daGueltig_Bis.Value
Catch
Me.dtGueltigbis.Value = "31.12.2099"
End Try
End If
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
If Me.Key = -1 Then
vorgabe.Add_New()
Me.Key = vorgabe.iVorgabeID.Value
Else
vorgabe.Get_Data(Me.Key)
If Me.Key = Me.TreeVorgabe.SelectedNode.Tag Then
MsgBox("Das übergeordnete Element ist ungültig. Bitte korrigieren.", vbExclamation)
Exit Sub
End If
End If
Me.DialogResult = DialogResult.OK
vorgabe.sKapitel = New SqlTypes.SqlString(CType(Me.txtKapitel.Text, String))
vorgabe.sKapitelNr = New SqlTypes.SqlString(CType(Me.txtKapitelnr.Text, String))
vorgabe.daGueltig_Bis = New SqlTypes.SqlDateTime(CType(Me.dtGueltigbis.Value, DateTime))
If Me.txtKapitelnr.Enabled = False Then
Else
vorgabe.iParentID = New SqlTypes.SqlInt32(CType(Me.TreeVorgabe.SelectedNode.Tag, Int32))
End If
vorgabe.Save_Data()
Me.Close()
End Sub
Private Sub btnAbbruch_Click(sender As Object, e As EventArgs) Handles btnAbbruch.Click
Me.DialogResult = DialogResult.Abort
Me.Close()
End Sub
Private Sub TSBtnQuit_Click(sender As Object, e As EventArgs) Handles TSBtnQuit.Click
btnAbbruch_Click(sender, e)
End Sub
End Class