Initial commit

This commit is contained in:
2020-10-21 10:43:18 +02:00
commit 56bd02798f
5848 changed files with 2659025 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
Module Crypto
Public Function EncryptText(ByVal strText As String, ByVal strPwd As String)
Dim i As Integer, c As Integer
Dim strBuff As String
strPwd = UCase$(strPwd)
If Len(strPwd) Then
For i = 1 To Len(strText)
c = Asc(Mid$(strText, i, 1))
c = c + Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
strBuff = strBuff & Chr(c And &HFF)
Next i
Else
strBuff = strText
End If
EncryptText = strBuff
End Function
Public Function DecryptText(ByVal strText As String, ByVal strPwd As String)
Dim i As Integer, c As Integer
Dim strBuff As String
strPwd = UCase$(strPwd)
If Len(strPwd) Then
For i = 1 To Len(strText)
c = Asc(Mid$(strText, i, 1))
c = c - Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
strBuff = strBuff & Chr(c And &HFF)
Next i
Else
strBuff = strText
End If
DecryptText = strBuff
End Function
End Module

View File

@@ -0,0 +1,172 @@
'*
' Object MyspaltenTitel
'
' Dieses Objekt liest die Daten aus der Tabelle Spalten und speichert diese in spaltendaten
' Die Daten werden für die Spaltenbezeichnung der C1Datagrids verwendet
'
' Autor: Stefan Hutter
' Datum: 2.12.2002
'*
Namespace EDOKA
Public Class Tabellenspalte
Private m_table As String
Private m_field As String
Private m_spaltenname As String
Private m_locked As Boolean
Private m_Width As Integer
Private m_Order As Integer
Private m_alsHacken As Boolean
Private m_tiptext As String
Property ColWith() As Integer
Get
Return m_Width
End Get
Set(ByVal Value As Integer)
m_Width = Value
End Set
End Property
Property Order() As Integer
Get
Return m_Order
End Get
Set(ByVal Value As Integer)
m_Order = Value
End Set
End Property
Property Tabelle() As String
Get
Return m_table
End Get
Set(ByVal Value As String)
m_table = Value
End Set
End Property
Property Feld() As String
Get
Return m_field
End Get
Set(ByVal Value As String)
m_field = Value
End Set
End Property
Property spaltenname() As String
Get
Return m_spaltenname
End Get
Set(ByVal Value As String)
m_spaltenname = Value
End Set
End Property
Property locked() As Boolean
Get
Return m_locked
End Get
Set(ByVal Value As Boolean)
m_locked = Value
End Set
End Property
Property AlsHacken() As Boolean
Get
Return m_alsHacken
End Get
Set(ByVal Value As Boolean)
m_alsHacken = Value
End Set
End Property
Property TipText() As String
Get
Return m_tiptext
End Get
Set(ByVal Value As String)
m_tiptext = Value
End Set
End Property
Public Function getspalte()
Try
Dim myspalten As New MySpaltenTitel()
Me.spaltenname = myspalten.getspalte(Me.Tabelle, Me.Feld)
Me.locked = myspalten.getlock(Me.Tabelle, Me.Feld)
Me.ColWith = myspalten.getColWidth(Me.Tabelle, Me.Feld)
Me.Order = myspalten.getOrder(Me.Tabelle, Me.Feld)
Me.AlsHacken = myspalten.gethacken(Me.Tabelle, Me.Feld)
Me.TipText = myspalten.gettiptext(Me.Tabelle, Me.Feld)
Catch
End Try
End Function
End Class
Public Class MySpaltenTitel
Public Function getspalte(ByVal tabelle As String, ByVal feld As String) As String
Dim i As Integer
If Globals.Spalten.Rows.Count = 0 Then load_data()
For i = 0 To Globals.Spalten.Rows.Count - 1
If Globals.Spalten.Rows(i).Item(1) = tabelle And Globals.Spalten.Rows(i).Item(2) = feld Then
getspalte = Globals.Spalten.Rows(i).Item(3)
End If
Next
End Function
Public Function getlock(ByVal tabelle As String, ByVal feld As String) As Boolean
Dim i As Integer
If Globals.Spalten.Rows.Count = 0 Then load_data()
For i = 0 To Globals.Spalten.Rows.Count - 1
If Globals.Spalten.Rows(i).Item(1) = tabelle And Globals.Spalten.Rows(i).Item(2) = feld Then
getlock = Globals.Spalten.Rows(i).Item(4)
End If
Next
End Function
Public Function getColWidth(ByVal tabelle As String, ByVal feld As String) As Integer
Dim i As Integer
If Globals.Spalten.Rows.Count = 0 Then load_data()
For i = 0 To Globals.Spalten.Rows.Count - 1
If Globals.Spalten.Rows(i).Item(1) = tabelle And Globals.Spalten.Rows(i).Item(2) = feld Then
getColWidth = Globals.Spalten.Rows(i).Item(6)
End If
Next
End Function
Public Function getOrder(ByVal tabelle As String, ByVal feld As String) As Integer
Dim i As Integer
If Globals.Spalten.Rows.Count = 0 Then load_data()
For i = 0 To Globals.Spalten.Rows.Count - 1
If Globals.Spalten.Rows(i).Item(1) = tabelle And Globals.Spalten.Rows(i).Item(2) = feld Then
getOrder = Globals.Spalten.Rows(i).Item(7)
End If
Next
End Function
Public Function gethacken(ByVal tabelle As String, ByVal feld As String) As Integer
Dim i As Integer
If Globals.Spalten.Rows.Count = 0 Then load_data()
For i = 0 To Globals.Spalten.Rows.Count - 1
If Globals.Spalten.Rows(i).Item(1) = tabelle And Globals.Spalten.Rows(i).Item(2) = feld Then
gethacken = Globals.Spalten.Rows(i).Item(5)
End If
Next
End Function
Public Function gettiptext(ByVal tabelle As String, ByVal feld As String) As String
Dim i As Integer
If Globals.Spalten.Rows.Count = 0 Then load_data()
For i = 0 To Globals.Spalten.Rows.Count - 1
If Globals.Spalten.Rows(i).Item(1) = tabelle And Globals.Spalten.Rows(i).Item(2) = feld Then
gettiptext = Globals.Spalten.Rows(i).Item(8)
End If
Next
End Function
Public Sub load_data()
Dim spalten As New edokadb.clsSpalten()
Globals.Spalten.Rows.Clear()
spalten.cpMainConnectionProvider = conn
Globals.Spalten = spalten.SelectAll
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,289 @@
' ///////////////////////////////////////////////////////////////////////////
' // Description: Connection Provider class for Database connection sharing
' // Generated by LLBLGen v1.2.1045.38210 Final on: Dienstag, 26. November 2002, 22:32:48
' // This class implements IDisposable.
' ///////////////////////////////////////////////////////////////////////////
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Namespace edokadb
' /// <summary>
' /// Purpose: provides a SqlConnection object which can be shared among data-access tier objects
' /// to provide a way to do ADO.NET transaction coding without the hassling with SqlConnection objects
' /// on a high level.
' /// </summary>
Public Class clsConnectionProvider
Implements IDisposable
#Region " Class Member Declarations "
Private m_scoDBConnection As SqlConnection
Private m_bIsTransactionPending, m_bIsDisposed As Boolean
Private m_stCurrentTransaction As SqlTransaction
Private m_alSavePoints As ArrayList
#End Region
Public Sub New()
' // Init the class
InitClass()
End Sub
' /// <summary>
' /// Purpose: Implements the IDispose' method Dispose.
' /// </summary>
Overloads Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
' /// <summary>
' /// Purpose: Implements the Dispose functionality.
' /// </summary>
Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean)
' // Check to see if Dispose has already been called.
If Not m_bIsDisposed Then
If bIsDisposing Then
' // Dispose managed resources.
If Not (m_stCurrentTransaction Is Nothing) Then
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
End If
If Not (m_scoDBConnection Is Nothing) Then
' // closing the connection will abort (rollback) any pending transactions
m_scoDBConnection.Close()
m_scoDBConnection.Dispose()
m_scoDBConnection = Nothing
End If
End If
End If
m_bIsDisposed = True
End Sub
' /// <summary>
' /// Purpose: Initializes class members.
' /// </summary>
Private Sub InitClass()
' // Create all the objects and initialize other members.
m_scoDBConnection = new SqlConnection()
m_bIsDisposed = False
m_stCurrentTransaction = Nothing
m_bIsTransactionPending = False
m_alSavePoints = new ArrayList()
End Sub
' /// <summary>
' /// Purpose: Opens the connection object.
' /// </summary>
' /// <returns>True, if succeeded, otherwise an Exception exception is thrown.</returns>
Public Function OpenConnection() As Boolean
Try
If (m_scoDBConnection.State And ConnectionState.Open) > 0 Then
' // It's already open.
Throw New Exception("OpenConnection::Connection is already open.")
End If
m_scoDBConnection.Open()
m_bIsTransactionPending = False
m_alSavePoints.Clear()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Starts a new ADO.NET transaction using the open connection object of this class.
' /// </summary>
' /// <param name="sTransactionName">Name of the transaction to start</param>
' /// <returns>True, if transaction is started correctly, otherwise an Exception exception is thrown</returns>
Public Function BeginTransaction(sTransactionName As String) As Boolean
Try
If m_bIsTransactionPending Then
' // no nested transactions allowed.
Throw New Exception("BeginTransaction::Already transaction pending. Nesting not allowed")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("BeginTransaction::Connection is not open.")
End If
' // begin the transaction and store the transaction object.
m_stCurrentTransaction = m_scoDBConnection.BeginTransaction(IsolationLevel.ReadCommitted, sTransactionName)
m_bIsTransactionPending = True
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Commits a pending transaction on the open connection object of this class.
' /// </summary>
' /// <returns>True, if commit was succesful, or an Exception exception is thrown</returns>
Public Function CommitTransaction() As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("CommitTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("CommitTransaction::Connection is not open.")
End if
' // commit the transaction
m_stCurrentTransaction.Commit()
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Rolls back a pending transaction on the open connection object of this class,
' /// or rolls back to the savepoint with the given name. Savepoints are created with SaveTransaction().
' /// </summary>
' /// <param name="sTransactionToRollback">Name of transaction to roll back. Can be name of savepoint</param>
' /// <returns>True, if rollback was succesful, or an Exception exception is thrown</returns>
Public Function RollbackTransaction(sTransactionToRollback As String) As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("RollbackTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("RollbackTransaction::Connection is not open.")
End If
' // rollback the transaction
m_stCurrentTransaction.Rollback(sTransactionToRollback)
' // if this wasn't a savepoint, we've rolled back the complete transaction, so we
' // can clean it up.
If Not m_alSavePoints.Contains(sTransactionToRollback) Then
' // it's not a savepoint
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
End If
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Saves a pending transaction on the open connection object of this class to a 'savepoint'
' /// with the given name.
' /// When a rollback is issued, the caller can rollback to this savepoint or roll back the complete transaction.
' /// </summary>
' /// <param name="sSavePointName">Name of the savepoint to store the current transaction under.</param>
' /// <returns>True, if save was succesful, or an Exception exception is thrown</returns>
Public Function SaveTransaction(sSavePointName As String) As Boolean
Try
If Not m_bIsTransactionPending Then
' // no transaction pending
Throw New Exception("SaveTransaction::No transaction pending.")
End If
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // no open connection
Throw New Exception("SaveTransaction::Connection is not open.")
End If
' // save the transaction
m_stCurrentTransaction.Save(sSavePointName)
' // Store the savepoint in the list.
m_alSavePoints.Add(sSavePointName)
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
' /// <summary>
' /// Purpose: Closes the open connection. Depending on bCommitPendingTransactions, a pending
' /// transaction is commited, or aborted.
' /// </summary>
' /// <param name="bCommitPendingTransaction">Flag for what to do when a transaction is still pending. True
' /// will commit the current transaction, False will abort (rollback) the complete current transaction.</param>
' /// <returns>True, if close was succesful, False if connection was already closed, or an Exception exception is thrown when
' /// an error occurs</returns>
Public Function CloseConnection(bCommitPendingTransaction As Boolean) As Boolean
Try
If (m_scoDBConnection.State And ConnectionState.Open) = 0 Then
' // No open connection
Return False
End If
If m_bIsTransactionPending Then
If bCommitPendingTransaction Then
' // Commit the pending transaction
m_stCurrentTransaction.Commit()
Else
' // Rollback the pending transaction
m_stCurrentTransaction.Rollback()
End If
m_bIsTransactionPending = False
m_stCurrentTransaction.Dispose()
m_stCurrentTransaction = Nothing
m_alSavePoints.Clear()
End If
' // close the connection
m_scoDBConnection.Close()
Return True
Catch ex As Exception
' // bubble exception
Throw ex
End Try
End Function
#Region " Class Property Declarations "
Public ReadOnly Property stCurrentTransaction() As SqlTransaction
Get
Return m_stCurrentTransaction
End Get
End Property
Public ReadOnly Property bIsTransactionPending() As Boolean
Get
Return m_bIsTransactionPending
End Get
End Property
Public ReadOnly Property scoDBConnection() As SqlConnection
Get
Return m_scoDBConnection
End Get
End Property
Public WriteOnly Property sConnectionString() As String
Set (ByVal Value As String)
m_scoDBConnection.ConnectionString = Value
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -0,0 +1,202 @@
' //////////////////////////////////////////////////////////////////////////////////////////
' // Description: Base class for Database Interaction.
' // Generated by LLBLGen v1.2.1045.38210 Final on: Dienstag, 26. November 2002, 22:32:48
' // Because this class implements IDisposable, derived classes shouldn't do so.
' //////////////////////////////////////////////////////////////////////////////////////////
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Namespace edokadb
' /// <summary>
' /// Purpose: Error Enums used by this LLBL library.
' /// </summary>
Public Enum LLBLError
AllOk
' // Add more here (check the comma's!)
End Enum
' /// <summary>
' /// Purpose: General interface of the API generated. Contains only common methods of all classes.
' /// </summary>
Public Interface ICommonDBAccess
Function Insert() As Boolean
Function Update() As Boolean
Function Delete() As Boolean
Function SelectOne() As DataTable
Function SelectAll() As DataTable
End Interface
' /// <summary>
' /// Purpose: Abstract base class for Database Interaction classes.
' /// </summary>
Public MustInherit Class clsDBInteractionBase
Implements IDisposable
Implements ICommonDBAccess
#Region " Class Member Declarations "
Protected m_scoMainConnection As SqlConnection
Protected m_iErrorCode As SqlInt32
Protected m_bMainConnectionIsCreatedLocal As Boolean
Protected m_cpMainConnectionProvider As clsConnectionProvider
Private m_sConnectionString As String
Private m_bIsDisposed As Boolean
#End Region
' /// <summary>
' /// Purpose: Class constructor.
' /// </summary>
Public Sub New()
' // Initialize the class' members.
InitClass()
End Sub
' /// <summary>
' /// Purpose: Initializes class members.
' /// </summary>
Private Sub InitClass()
' // create all the objects and initialize other members.
m_scoMainConnection = new SqlConnection()
m_bMainConnectionIsCreatedLocal = True
m_cpMainConnectionProvider = Nothing
m_iErrorCode = New SqlInt32(LLBLError.AllOk)
m_bIsDisposed = False
End Sub
' /// <summary>
' /// Purpose: Implements the IDispose' method Dispose.
' /// </summary>
Overloads Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
' /// <summary>
' /// Purpose: Implements the Dispose functionality.
' /// </summary>
Overridable Overloads Protected Sub Dispose(ByVal bIsDisposing As Boolean)
' // Check to see if Dispose has already been called.
If Not m_bIsDisposed Then
If bIsDisposing Then
' // Dispose managed resources.
If m_bMainConnectionIsCreatedLocal Then
' // Object is created in this class, so destroy it here.
m_scoMainConnection.Close()
m_scoMainConnection.Dispose()
m_bMainConnectionIsCreatedLocal = True
End If
m_cpMainConnectionProvider = Nothing
m_scoMainConnection = Nothing
End If
End If
m_bIsDisposed = True
End Sub
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.Insert() method.
' /// </summary>
Public Overridable Function Insert() As Boolean Implements ICommonDBAccess.Insert
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.Delete() method.
' /// </summary>
Public Overridable Function Delete() As Boolean Implements ICommonDBAccess.Delete
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.Update() method.
' /// </summary>
Public Overridable Function Update() As Boolean Implements ICommonDBAccess.Update
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.SelectOne() method.
' /// </summary>
Public Overridable Function SelectOne() As DataTable Implements ICommonDBAccess.SelectOne
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
' /// <summary>
' /// Purpose: Implements the ICommonDBAccess.SelectAll() method.
' /// </summary>
Public Overridable Function SelectAll() As DataTable Implements ICommonDBAccess.SelectAll
' // No implementation, throw exception
Throw New NotImplementedException()
End Function
#Region " Class Property Declarations "
Public WriteOnly Property cpMainConnectionProvider() As clsConnectionProvider
Set(ByVal Value As clsConnectionProvider)
If Value Is Nothing Then
' // Invalid value
Throw New ArgumentNullException("cpMainConnectionProvider", "Nothing passed as value to this property which is not allowed.")
End If
' // A connection provider object is passed to this class.
' // Retrieve the SqlConnection object, if present and create a
' // reference to it. If there is already a MainConnection object
' // referenced by the membervar, destroy that one or simply
' // remove the reference, based on the flag.
If Not (m_scoMainConnection Is Nothing) Then
' // First get rid of current connection object. Caller is responsible
If m_bMainConnectionIsCreatedLocal Then
' // Is local created object, close it and dispose it.
m_scoMainConnection.Close()
m_scoMainConnection.Dispose()
End If
' // Remove reference.
m_scoMainConnection = Nothing
End If
m_cpMainConnectionProvider = CType(Value, clsConnectionProvider)
m_scoMainConnection = m_cpMainConnectionProvider.scoDBConnection
m_bMainConnectionIsCreatedLocal = False
End Set
End Property
Public ReadOnly Property iErrorCode() As SqlInt32
Get
Return m_iErrorCode
End Get
End Property
Public Property sConnectionString() As String
Get
Return m_sConnectionString
End Get
Set (ByVal Value As String)
m_sConnectionString = Value
m_scoMainConnection.ConnectionString = m_sConnectionString
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -0,0 +1,174 @@
Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Namespace edokadb
Public Class clsMyPartner
Public Function search_partner(ByVal query As String, ByVal anzahl As String, ByVal fnkt As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Dim table As String = "dbo.partner"
scmCmdToExecute.CommandText = "dbo.[sp_partner_search]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable("partner")
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = conn.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@query", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, query))
scmCmdToExecute.Parameters.Add(New SqlParameter("@table", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, table))
scmCmdToExecute.Parameters.Add(New SqlParameter("@anz", SqlDbType.VarChar, 10, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, anzahl))
scmCmdToExecute.Parameters.Add(New SqlParameter("@fnkt", SqlDbType.VarChar, 1, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, fnkt))
scmCmdToExecute.Connection.Open()
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsMyPartner::sp_partner_search::Error occured." + ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Public Function search_doppelte_partner(ByVal query As String, ByVal table As String, ByVal fnkt As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[sp_partner_search]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable("partner")
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = conn.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@query", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, query))
scmCmdToExecute.Parameters.Add(New SqlParameter("@table", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, table))
scmCmdToExecute.Parameters.Add(New SqlParameter("@anz", SqlDbType.VarChar, 10, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
scmCmdToExecute.Parameters.Add(New SqlParameter("@fnkt", SqlDbType.VarChar, 1, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 4))
scmCmdToExecute.Connection.Open()
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsMyPartner::sp_partner_search::Error occured." + ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Public Function Partner_Detail(ByVal nrpar00 As String) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Dim table As String = "dbo.partner"
scmCmdToExecute.CommandText = "dbo.[sp_partner_detail]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable("partner")
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = conn.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@nrpar00", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, nrpar00))
scmCmdToExecute.Connection.Open()
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsMyPartner::sp_partner_detail::Error occured." + ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Public Function Partner_VV(ByVal nrpar00 As String) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Dim table As String = "dbo.partner"
scmCmdToExecute.CommandText = "dbo.[sp_partner_vv]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable("partner")
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = conn.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@nrpar00", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, nrpar00))
scmCmdToExecute.Connection.Open()
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsMyPartner::sp_partner_vv::Error occured." + ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Public Function Partner_Gebdat(ByVal nrpar00 As String) As String
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Dim table As String = "dbo.partner"
scmCmdToExecute.CommandText = "dbo.[sp_partner_gebdat]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable("partner")
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = conn.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@nrpar00", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, nrpar00))
scmCmdToExecute.Parameters.Add(New SqlParameter("@gebdat", SqlDbType.VarChar, 255, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, ""))
scmCmdToExecute.Connection.Open()
sdaAdapter.Fill(dtToReturn)
Return scmCmdToExecute.Parameters("@gebdat").Value
Catch ex As Exception
' MsgBox(ex.Message)
' // some error occured. Bubble it to caller and encapsulate Exception object
' Throw New Exception("clsMyPartner::sp_partner_vv::Error occured." + ex.Message, ex)
Return ""
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Public Function Partner_Betreuer(ByVal nrpar00 As String) As String
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Dim table As String = "dbo.partner"
scmCmdToExecute.CommandText = "dbo.[sp_partner_betreuer]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable("partner")
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = conn.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@nrpar00", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, nrpar00))
scmCmdToExecute.Parameters.Add(New SqlParameter("@betreuer", SqlDbType.VarChar, 255, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, ""))
scmCmdToExecute.Connection.Open()
sdaAdapter.Fill(dtToReturn)
Return scmCmdToExecute.Parameters("@betreuer").Value
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsMyPartner::sp_partner_vv::Error occured." + ex.Message, ex)
Return ""
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
dtToReturn.Dispose()
End Try
End Function
End Class
End Namespace

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,610 @@
' ///////////////////////////////////////////////////////////////////////////
' // Description: Data Access class for the table 'spalten'
' // Generated by LLBLGen v1.2.1045.38210 Final on: Montag, 20. Januar 2003, 22:51:23
' // 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 edokadb
' /// <summary>
' /// Purpose: Data Access class for the table 'spalten'.
' /// </summary>
Public Class clsSpalten
Inherits clsDBInteractionBase
#Region " Class Member Declarations "
Private m_bReadonly, m_bAlsHacken, m_bAktiv As SqlBoolean
Private m_daErstellt_am, m_daMutiert_am As SqlDateTime
Private m_iMandantnr, m_iMutierer, m_iReihenfolge, m_iBreite, m_iEintragnr As SqlInt32
Private m_sTabelle, m_sTabellenspalte, m_sTiptext, m_sSpalte 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>iEintragnr</LI>
' /// <LI>sTabelle. May be SqlString.Null</LI>
' /// <LI>sTabellenspalte. May be SqlString.Null</LI>
' /// <LI>sSpalte. May be SqlString.Null</LI>
' /// <LI>bReadonly. May be SqlBoolean.Null</LI>
' /// <LI>bAlsHacken. May be SqlBoolean.Null</LI>
' /// <LI>iBreite. May be SqlInt32.Null</LI>
' /// <LI>iReihenfolge. May be SqlInt32.Null</LI>
' /// <LI>sTiptext. May be SqlString.Null</LI>
' /// <LI>bAktiv</LI>
' /// <LI>daErstellt_am. May be SqlDateTime.Null</LI>
' /// <LI>daMutiert_am. May be SqlDateTime.Null</LI>
' /// <LI>iMutierer. May be SqlInt32.Null</LI>
' /// <LI>iMandantnr. May be SqlInt32.Null</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Overrides Public Function Insert() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_spalten_Insert]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ieintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iEintragnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@stabelle", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTabelle))
scmCmdToExecute.Parameters.Add(New SqlParameter("@stabellenspalte", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTabellenspalte))
scmCmdToExecute.Parameters.Add(New SqlParameter("@sspalte", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sSpalte))
scmCmdToExecute.Parameters.Add(New SqlParameter("@bReadonly", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bReadonly))
scmCmdToExecute.Parameters.Add(New SqlParameter("@balsHacken", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bAlsHacken))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iBreite", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iBreite))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iReihenfolge", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iReihenfolge))
scmCmdToExecute.Parameters.Add(New SqlParameter("@stiptext", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTiptext))
scmCmdToExecute.Parameters.Add(New SqlParameter("@baktiv", SqlDbType.Bit, 1, ParameterDirection.Input, False, 1, 0, "", DataRowVersion.Proposed, m_bAktiv))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daerstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daErstellt_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@damutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", 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("@imandantnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMandantnr))
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.
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_spalten_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("clsSpalten::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>iEintragnr</LI>
' /// <LI>sTabelle. May be SqlString.Null</LI>
' /// <LI>sTabellenspalte. May be SqlString.Null</LI>
' /// <LI>sSpalte. May be SqlString.Null</LI>
' /// <LI>bReadonly. May be SqlBoolean.Null</LI>
' /// <LI>bAlsHacken. May be SqlBoolean.Null</LI>
' /// <LI>iBreite. May be SqlInt32.Null</LI>
' /// <LI>iReihenfolge. May be SqlInt32.Null</LI>
' /// <LI>sTiptext. May be SqlString.Null</LI>
' /// <LI>bAktiv</LI>
' /// <LI>daErstellt_am. May be SqlDateTime.Null</LI>
' /// <LI>daMutiert_am. May be SqlDateTime.Null</LI>
' /// <LI>iMutierer. May be SqlInt32.Null</LI>
' /// <LI>iMandantnr. 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_spalten_Update]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ieintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iEintragnr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@stabelle", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTabelle))
scmCmdToExecute.Parameters.Add(New SqlParameter("@stabellenspalte", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTabellenspalte))
scmCmdToExecute.Parameters.Add(New SqlParameter("@sspalte", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sSpalte))
scmCmdToExecute.Parameters.Add(New SqlParameter("@bReadonly", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bReadonly))
scmCmdToExecute.Parameters.Add(New SqlParameter("@balsHacken", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bAlsHacken))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iBreite", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iBreite))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iReihenfolge", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iReihenfolge))
scmCmdToExecute.Parameters.Add(New SqlParameter("@stiptext", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sTiptext))
scmCmdToExecute.Parameters.Add(New SqlParameter("@baktiv", SqlDbType.Bit, 1, ParameterDirection.Input, False, 1, 0, "", DataRowVersion.Proposed, m_bAktiv))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daerstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daErstellt_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@damutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", 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("@imandantnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMandantnr))
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.
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_spalten_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("clsSpalten::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>iEintragnr</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// </UL>
' /// </remarks>
Public Overrides Function Delete() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_spalten_Delete]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@ieintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iEintragnr))
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.
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_spalten_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("clsSpalten::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>iEintragnr</LI>
' /// </UL>
' /// Properties set after a succesful call of this method:
' /// <UL>
' /// <LI>iErrorCode</LI>
' /// <LI>iEintragnr</LI>
' /// <LI>sTabelle</LI>
' /// <LI>sTabellenspalte</LI>
' /// <LI>sSpalte</LI>
' /// <LI>bReadonly</LI>
' /// <LI>bAlsHacken</LI>
' /// <LI>iBreite</LI>
' /// <LI>iReihenfolge</LI>
' /// <LI>sTiptext</LI>
' /// <LI>bAktiv</LI>
' /// <LI>daErstellt_am</LI>
' /// <LI>daMutiert_am</LI>
' /// <LI>iMutierer</LI>
' /// <LI>iMandantnr</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_spalten_SelectOne]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("spalten")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@ieintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iEintragnr))
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_spalten_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
If dtToReturn.Rows.Count > 0 Then
m_iEintragnr = New SqlInt32(CType(dtToReturn.Rows(0)("eintragnr"), Integer))
If dtToReturn.Rows(0)("tabelle") Is System.DBNull.Value Then
m_sTabelle = SqlString.Null
Else
m_sTabelle = New SqlString(CType(dtToReturn.Rows(0)("tabelle"), String))
End If
If dtToReturn.Rows(0)("tabellenspalte") Is System.DBNull.Value Then
m_sTabellenspalte = SqlString.Null
Else
m_sTabellenspalte = New SqlString(CType(dtToReturn.Rows(0)("tabellenspalte"), String))
End If
If dtToReturn.Rows(0)("spalte") Is System.DBNull.Value Then
m_sSpalte = SqlString.Null
Else
m_sSpalte = New SqlString(CType(dtToReturn.Rows(0)("spalte"), String))
End If
If dtToReturn.Rows(0)("Readonly") Is System.DBNull.Value Then
m_bReadonly = SqlBoolean.Null
Else
m_bReadonly = New SqlBoolean(CType(dtToReturn.Rows(0)("Readonly"), Boolean))
End If
If dtToReturn.Rows(0)("alsHacken") Is System.DBNull.Value Then
m_bAlsHacken = SqlBoolean.Null
Else
m_bAlsHacken = New SqlBoolean(CType(dtToReturn.Rows(0)("alsHacken"), Boolean))
End If
If dtToReturn.Rows(0)("Breite") Is System.DBNull.Value Then
m_iBreite = SqlInt32.Null
Else
m_iBreite = New SqlInt32(CType(dtToReturn.Rows(0)("Breite"), Integer))
End If
If dtToReturn.Rows(0)("Reihenfolge") Is System.DBNull.Value Then
m_iReihenfolge = SqlInt32.Null
Else
m_iReihenfolge = New SqlInt32(CType(dtToReturn.Rows(0)("Reihenfolge"), Integer))
End If
If dtToReturn.Rows(0)("tiptext") Is System.DBNull.Value Then
m_sTiptext = SqlString.Null
Else
m_sTiptext = New SqlString(CType(dtToReturn.Rows(0)("tiptext"), String))
End If
m_bAktiv = New SqlBoolean(CType(dtToReturn.Rows(0)("aktiv"), Boolean))
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
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
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsSpalten::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>
Public Overrides Function SelectAll() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_spalten_SelectAll]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable("spalten")
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_spalten_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("clsSpalten::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 [iEintragnr]() As SqlInt32
Get
Return m_iEintragnr
End Get
Set(ByVal Value As SqlInt32)
Dim iEintragnrTmp As SqlInt32 = Value
If iEintragnrTmp.IsNull Then
Throw New ArgumentOutOfRangeException("iEintragnr", "iEintragnr can't be NULL")
End If
m_iEintragnr = Value
End Set
End Property
Public Property [sTabelle]() As SqlString
Get
Return m_sTabelle
End Get
Set(ByVal Value As SqlString)
m_sTabelle = Value
End Set
End Property
Public Property [sTabellenspalte]() As SqlString
Get
Return m_sTabellenspalte
End Get
Set(ByVal Value As SqlString)
m_sTabellenspalte = Value
End Set
End Property
Public Property [sSpalte]() As SqlString
Get
Return m_sSpalte
End Get
Set(ByVal Value As SqlString)
m_sSpalte = Value
End Set
End Property
Public Property [bReadonly]() As SqlBoolean
Get
Return m_bReadonly
End Get
Set(ByVal Value As SqlBoolean)
m_bReadonly = Value
End Set
End Property
Public Property [bAlsHacken]() As SqlBoolean
Get
Return m_bAlsHacken
End Get
Set(ByVal Value As SqlBoolean)
m_bAlsHacken = Value
End Set
End Property
Public Property [iBreite]() As SqlInt32
Get
Return m_iBreite
End Get
Set(ByVal Value As SqlInt32)
m_iBreite = Value
End Set
End Property
Public Property [iReihenfolge]() As SqlInt32
Get
Return m_iReihenfolge
End Get
Set(ByVal Value As SqlInt32)
m_iReihenfolge = Value
End Set
End Property
Public Property [sTiptext]() As SqlString
Get
Return m_sTiptext
End Get
Set(ByVal Value As SqlString)
m_sTiptext = Value
End Set
End Property
Public Property [bAktiv]() As SqlBoolean
Get
Return m_bAktiv
End Get
Set(ByVal Value As SqlBoolean)
Dim bAktivTmp As SqlBoolean = Value
If bAktivTmp.IsNull Then
Throw New ArgumentOutOfRangeException("bAktiv", "bAktiv can't be NULL")
End If
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
Public Property [iMandantnr]() As SqlInt32
Get
Return m_iMandantnr
End Get
Set(ByVal Value As SqlInt32)
m_iMandantnr = Value
End Set
End Property
#End Region
End Class
End Namespace

View File

@@ -0,0 +1,21 @@
Imports System.IO
Namespace EDOKA
Public Class DB_Connection
Shared Sub New()
Dim fc As Integer = 0
If fc < 2 Then Globals.ConnectionFileName = "edokaconn.cfg"
Dim ofile As System.IO.File
Dim oread As System.IO.StreamReader
oread = ofile.OpenText(Application.StartupPath + "\" + Globals.ConnectionFileName)
sConnectionString = oread.ReadLine
sConnectionString = Crypto.DecryptText(sConnectionString, "HutterundMueller")
sConnectionString = Left(sConnectionString, Len(sConnectionString) - 1)
Globals.sConnectionString = sConnectionString
oread.Close()
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,139 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmBenutzer
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmBenutzer))
Me.ToolStrip1 = New System.Windows.Forms.ToolStrip
Me.ToolStripButton1 = New System.Windows.Forms.ToolStripButton
Me.ToolStripButton2 = New System.Windows.Forms.ToolStripButton
Me.DokList = New C1.Win.C1TrueDBGrid.C1TrueDBGrid
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.ToolStrip1.SuspendLayout()
CType(Me.DokList, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'ToolStrip1
'
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripButton1, Me.ToolStripButton2})
Me.ToolStrip1.Location = New System.Drawing.Point(0, 0)
Me.ToolStrip1.Name = "ToolStrip1"
Me.ToolStrip1.Size = New System.Drawing.Size(466, 25)
Me.ToolStrip1.TabIndex = 0
Me.ToolStrip1.Text = "ToolStrip1"
'
'ToolStripButton1
'
Me.ToolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.ToolStripButton1.Image = CType(resources.GetObject("ToolStripButton1.Image"), System.Drawing.Image)
Me.ToolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta
Me.ToolStripButton1.Name = "ToolStripButton1"
Me.ToolStripButton1.Size = New System.Drawing.Size(23, 22)
Me.ToolStripButton1.Text = "Fenster schliessen"
'
'ToolStripButton2
'
Me.ToolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.ToolStripButton2.Image = CType(resources.GetObject("ToolStripButton2.Image"), System.Drawing.Image)
Me.ToolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta
Me.ToolStripButton2.Name = "ToolStripButton2"
Me.ToolStripButton2.Size = New System.Drawing.Size(23, 22)
Me.ToolStripButton2.Text = "Daten speichern"
'
'DokList
'
Me.DokList.AllowAddNew = True
Me.DokList.AllowDelete = True
Me.DokList.AlternatingRows = True
Me.DokList.Dock = System.Windows.Forms.DockStyle.Left
Me.DokList.FetchRowStyles = True
Me.DokList.FilterBar = True
Me.DokList.GroupByCaption = "Drag a column header here to group by that column"
Me.DokList.Images.Add(CType(resources.GetObject("DokList.Images"), System.Drawing.Image))
Me.DokList.Location = New System.Drawing.Point(0, 25)
Me.DokList.Name = "DokList"
Me.DokList.PreviewInfo.Location = New System.Drawing.Point(0, 0)
Me.DokList.PreviewInfo.Size = New System.Drawing.Size(0, 0)
Me.DokList.PreviewInfo.ZoomFactor = 75
Me.DokList.PrintInfo.PageSettings = CType(resources.GetObject("DokList.PrintInfo.PageSettings"), System.Drawing.Printing.PageSettings)
Me.DokList.ScrollTips = True
Me.DokList.Size = New System.Drawing.Size(352, 237)
Me.DokList.TabIndex = 13
Me.DokList.Text = "C1TrueDBGrid2"
Me.DokList.PropBag = resources.GetString("DokList.PropBag")
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(367, 25)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(40, 13)
Me.Label1.TabIndex = 14
Me.Label1.Text = "Rollen:"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(367, 38)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(79, 13)
Me.Label2.TabIndex = 15
Me.Label2.Text = "1: Administrator"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(367, 51)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(86, 13)
Me.Label3.TabIndex = 16
Me.Label3.Text = "0: Normaler User"
'
'frmBenutzer
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(466, 262)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.DokList)
Me.Controls.Add(Me.ToolStrip1)
Me.Name = "frmBenutzer"
Me.Text = "Benutzerverwaltung"
Me.ToolStrip1.ResumeLayout(False)
Me.ToolStrip1.PerformLayout()
CType(Me.DokList, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents ToolStrip1 As System.Windows.Forms.ToolStrip
Friend WithEvents ToolStripButton1 As System.Windows.Forms.ToolStripButton
Friend WithEvents ToolStripButton2 As System.Windows.Forms.ToolStripButton
Friend WithEvents DokList As C1.Win.C1TrueDBGrid.C1TrueDBGrid
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
End Class

View File

@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="ToolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base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uR
vkIMTaLmBysL29H0bbYfsCJsnkYAq1pAeNjY2CRLVMzpYKWiXqJR3VREMISq3uREMvWKcKZeqtbUWFtb
D6Fv+xIuhPXTCGCfYR8UEoH29o6JHC53GDHK1p73HHs0NVyu4wgWOx4vxcLCQkLfdSfsCTadn/rHppJD
ezRYb3i2h9abjqbGo91oNnUd21On51Nb3ulB9iUW7S/ktAtiO7ipsaN3siNP7z/qdVOI/usdj/LA/wGD
64pjkCipnAAAAABJRU5ErkJggg==
</value>
</data>
<data name="ToolStripButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABeSURBVDhPYzhw4MB/SjADSDMDAwNZGKwXZkBDA8QQQq6B
qYHT5BgAczHZLkB2LVleGMQGwJyGL1pBanB6ASZJDI01GolxAUgjXhfgcj4sgQ1SA8jNUPCkTCgD4ZMH
ADk0Kh+zxKF0AAAAAElFTkSuQmCC
</value>
</data>
<data name="DokList.Images" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA3SURBVChTY2DABP+xiIGFkCVwsVEUwhThNREkiaEAJoiP
RnEmskKs7kd3C1YrYTrx+g6bIrAYAKCqHOQvFu6BAAAAAElFTkSuQmCC
</value>
</data>
<data name="DokList.PrintInfo.PageSettings" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0yLjAuMC4wLCBDdWx0
dXJlPW5ldXRyYWwsIFB1Y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dGVtLkRyYXdpbmcuUHJpbnRpbmcuRHVwbGV4
AgAAACBTeXN0ZW0uRHJhd2luZy5QcmludGluZy5UcmlTdGF0ZQIAAAAkU3lzdGVtLkRyYXdpbmcuUHJp
bnRpbmcuUGFnZVNldHRpbmdzAgAAAAgICAgiU3lzdGVtLkRyYXdpbmcuUHJpbnRpbmcuUHJpbnRSYW5n
ZQIAAAAHAgIAAAAKBgcAAAAACQcAAAAAAAAACv//Bfj///8eU3lzdGVtLkRyYXdpbmcuUHJpbnRpbmcu
RHVwbGV4AQAAAAd2YWx1ZV9fAAgCAAAA/////wH3/////P///wAJCgAAAAAAAAAAAAAADycAAAAAAAAF
9f///yJTeXN0ZW0uRHJhd2luZy5QcmludGluZy5QcmludFJhbmdlAQAAAAd2YWx1ZV9fAAgCAAAAAAAA
AAAACgUGAAAAH1N5c3RlbS5EcmF3aW5nLlByaW50aW5nLk1hcmdpbnMEAAAABGxlZnQFcmlnaHQDdG9w
BmJvdHRvbQAAAAAICAgIAgAAAGQAAABkAAAAZAAAAGQAAAABCgAAAAEAAAAJAwAAAAHz/////P///wAK
CgoB8v////z///8ACQ8AAAABDwAAAAYAAABkAAAAZAAAAGQAAABkAAAACw==
</value>
</data>
<data name="DokList.PropBag" xml:space="preserve">
<value>&lt;?xml version="1.0"?&gt;&lt;Blob&gt;&lt;Styles type="C1.Win.C1TrueDBGrid.Design.ContextWrapper"&gt;&lt;Data&gt;Inactive{ForeColor:InactiveCaptionText;BackColor:InactiveCaption;}OddRow{}Style5{}Style1{}RecordSelector{AlignImage:Center;}Style6{}Style8{}Footer{}Style13{}Style3{}Style12{}HighlightRow{ForeColor:HighlightText;BackColor:Highlight;}Editor{}Style4{}FilterBar{BackColor:255, 255, 192;}EvenRow{BackColor:224, 224, 224;}FilterWatermark{ForeColor:InfoText;BackColor:Info;}Style11{}Style16{}Group{BackColor:ControlDark;Border:None,,0, 0, 0, 0;AlignVert:Center;}Caption{AlignHorz:Center;}Selected{ForeColor:HighlightText;BackColor:Highlight;}Style9{}Style2{}Style14{}Normal{}Style7{}Heading{Wrap:True;AlignVert:Center;Border:Raised,,1, 1, 1, 1;ForeColor:ControlText;BackColor:Control;}Style10{AlignHorz:Near;}Style15{}&lt;/Data&gt;&lt;/Styles&gt;&lt;Splits&gt;&lt;C1.Win.C1TrueDBGrid.MergeView Name="" AlternatingRowStyle="True" CaptionHeight="17" ColumnCaptionHeight="17" ColumnFooterHeight="17" FetchRowStyles="True" FilterBar="True" MarqueeStyle="DottedCellBorder" RecordSelectorWidth="17" DefRecSelWidth="17" VerticalScrollGroup="1" HorizontalScrollGroup="1"&gt;&lt;CaptionStyle parent="Style2" me="Style10" /&gt;&lt;EditorStyle parent="Editor" me="Style5" /&gt;&lt;EvenRowStyle parent="EvenRow" me="Style8" /&gt;&lt;FilterBarStyle parent="FilterBar" me="Style13" /&gt;&lt;FilterWatermarkStyle parent="FilterWatermark" me="Style16" /&gt;&lt;FooterStyle parent="Footer" me="Style3" /&gt;&lt;GroupStyle parent="Group" me="Style12" /&gt;&lt;HeadingStyle parent="Heading" me="Style2" /&gt;&lt;HighLightRowStyle parent="HighlightRow" me="Style7" /&gt;&lt;InactiveStyle parent="Inactive" me="Style4" /&gt;&lt;OddRowStyle parent="OddRow" me="Style9" /&gt;&lt;RecordSelectorStyle parent="RecordSelector" me="Style11" /&gt;&lt;SelectedStyle parent="Selected" me="Style6" /&gt;&lt;Style parent="Normal" me="Style1" /&gt;&lt;ClientRect&gt;0, 0, 350, 235&lt;/ClientRect&gt;&lt;BorderSide&gt;0&lt;/BorderSide&gt;&lt;/C1.Win.C1TrueDBGrid.MergeView&gt;&lt;/Splits&gt;&lt;NamedStyles&gt;&lt;Style parent="" me="Normal" /&gt;&lt;Style parent="Normal" me="Heading" /&gt;&lt;Style parent="Heading" me="Footer" /&gt;&lt;Style parent="Heading" me="Caption" /&gt;&lt;Style parent="Heading" me="Inactive" /&gt;&lt;Style parent="Normal" me="Selected" /&gt;&lt;Style parent="Normal" me="Editor" /&gt;&lt;Style parent="Normal" me="HighlightRow" /&gt;&lt;Style parent="Normal" me="EvenRow" /&gt;&lt;Style parent="Normal" me="OddRow" /&gt;&lt;Style parent="Heading" me="RecordSelector" /&gt;&lt;Style parent="Normal" me="FilterBar" /&gt;&lt;Style parent="Caption" me="Group" /&gt;&lt;Style parent="FilterBar" me="FilterWatermark" /&gt;&lt;/NamedStyles&gt;&lt;vertSplits&gt;1&lt;/vertSplits&gt;&lt;horzSplits&gt;1&lt;/horzSplits&gt;&lt;Layout&gt;None&lt;/Layout&gt;&lt;DefaultRecSelWidth&gt;17&lt;/DefaultRecSelWidth&gt;&lt;ClientArea&gt;0, 0, 350, 235&lt;/ClientArea&gt;&lt;PrintPageHeaderStyle parent="" me="Style14" /&gt;&lt;PrintPageFooterStyle parent="" me="Style15" /&gt;&lt;/Blob&gt;</value>
</data>
</root>

View File

@@ -0,0 +1,27 @@
Public Class frmBenutzer
Private Sub frmBenutzer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.DokList.DataSource = Globals.Userdata.Tables(0)
Me.DokList.DataMember = Globals.Userdata.Tables(0).TableName
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
For Each dr As DataRow In Globals.Userdata.Tables(0).Rows
dr.Item(0) = Crypto.EncryptText(dr.Item(0).ToString, "Selbstanzeigen")
Next
Globals.Userdata.WriteXml(Application.StartupPath + "\users.xml")
Globals.Userdata.Tables.Clear()
Globals.Userdata.ReadXml(Application.StartupPath + "\users.xml")
For Each dr As DataRow In Globals.Userdata.Tables(0).Rows
dr.Item(0) = Crypto.DecryptText(dr.Item(0).ToString, "Selbstanzeigen")
Next
Me.DokList.DataSource = Nothing
Me.DokList.DataSource = Globals.Userdata.Tables(0)
Me.DokList.DataMember = Globals.Userdata.Tables(0).TableName
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Me.Close()
End Sub
End Class

View File

@@ -0,0 +1,295 @@
Imports System.Windows.Forms
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.IO
Imports EDOKALib.Common
Public Module mMain
Public Class SerialHelper
'///Class mercilessly ripped-off from Dr GUI.Net #3 :)
Public Shared Function SerializeToBase64String(ByVal o As Object) As String
Dim formatter As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
Dim serialMemoryStream As New MemoryStream()
formatter.Serialize(serialMemoryStream, o)
Dim bytes() As Byte = serialMemoryStream.ToArray()
Return Convert.ToBase64String(bytes).Trim()
End Function
Public Shared Function DeserializeFromBase64String(ByVal base64String As String) As Object
Dim formatter As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
base64String = base64String.Trim(ControlChars.NullChar)
Dim bytes() As Byte = Convert.FromBase64String(base64String)
Dim serialMemoryStream As New MemoryStream(bytes)
Return formatter.Deserialize(serialMemoryStream)
End Function
End Class
Public Class SingleInstance
Public Interface ISingleInstanceForm
Delegate Sub _WndProc(ByVal m As Message, ByRef Cancel As Boolean)
Event WndProc As _WndProc
ReadOnly Property Handle() As IntPtr
Sub HandleCommand(ByVal strCmd As String)
End Interface
#Region "API"
Private Const WM_COPYDATA As Integer = &H4A
<StructLayout(LayoutKind.Sequential)> _
Public Structure COPYDATASTRUCT
Public dwData As Integer
Public cbData As Integer
Public lpData As Integer
End Structure
Private Declare Auto Function GetProp Lib "user32" (ByVal hWnd As Integer, ByVal lpString As String) As Integer
Private Declare Auto Function SetProp Lib "user32" (ByVal hWnd As Integer, ByVal lpString As String, ByVal hData As Integer) As Integer
Private Delegate Function EnumWindowsProc(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As EnumWindowsProc, ByVal lParam As Integer) As Integer
Private Declare Auto Function SendMessage Lib "user32" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As Integer
Public Declare Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA" _
(ByVal windowHandle As IntPtr, _
ByVal Msg As UInt16, _
ByVal wParam As IntPtr, _
ByRef lParam As COPYDATASTRUCT, _
ByVal flags As SendMessageTimeoutFlags, _
ByVal timeout As UInt16, _
ByVal result As IntPtr) As IntPtr
<Flags()> _
Public Enum SendMessageTimeoutFlags As Short
SMTO_NORMAL = &H0 '0x0000
SMTO_BLOCK = &H1 ''0x0001
SMTO_ABORTIFHUNG = &H2 '0x0002
SMTO_NOTIMEOUTIFNOTHUNG = &H8 '0x0008
End Enum
#End Region
#Region "EnumWindows"
Private Shared _EWP As New EnumWindowsProc(AddressOf EWP)
Private Shared Function EWP(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
' Customised windows enumeration procedure. Stops
' when it finds another application with the Window
' property set, or when all windows are exhausted.
Try
If IsThisApp(hWnd) Then
_hWnd = hWnd
Return 0
Else
Return 1
End If
Catch
Return 0
End Try
End Function
Private Shared Function IsThisApp(ByVal hWnd As Long) As Boolean
' Check if the windows property is set for this
' window handle:
If GetProp(hWnd, _mcThisAppID & "_APPLICATION") = 1 Then
Return True
End If
End Function
Private Shared Function FindWindow() As Boolean
If _hWnd = -1 Then
EnumWindows(_EWP, 0)
If _hWnd = -1 Then
Return False
Else
Return True
End If
Else
Return True
End If
End Function
Private Shared Function SendCDSToWindow(ByVal CD As COPYDATASTRUCT) As Boolean
Try
Dim lpCD As IntPtr = Marshal.AllocHGlobal(Len(CD))
Marshal.StructureToPtr(CD, lpCD, False)
'SendMessage(_hWnd, WM_COPYDATA, _hWnd, lpCD)
Dim result As IntPtr
Dim retVal As IntPtr
Dim handle As New IntPtr(_hWnd)
retVal = SendMessageTimeout(handle, Convert.ToUInt16(WM_COPYDATA), handle, CD, SendMessageTimeoutFlags.SMTO_NORMAL, Convert.ToUInt16(2000), result)
Marshal.FreeHGlobal(lpCD)
Return True
Catch ex As Exception
'TKBLib.Errorhandling.TraceHelper.Msg("EdokaApp.mMain.SendCDSToWindow", ex.Message & ex.StackTrace, TraceLevel.Error)
Return False
End Try
End Function
Private Shared Function SendMessageToWindow(ByVal strCmd As String) As Boolean
If _hWnd = -1 Then Return False
If Len(strCmd) = 0 Then
Try
Dim CD As COPYDATASTRUCT
With CD
.dwData = 0
.cbData = 0
.lpData = 0
End With
Return SendCDSToWindow(CD)
Catch
Return False
End Try
Else
Try
Dim B() As Byte = Encoding.Default.GetBytes(strCmd)
Dim lpB As IntPtr = Marshal.AllocHGlobal(B.Length)
Marshal.Copy(B, 0, lpB, B.Length)
Dim CD As COPYDATASTRUCT
With CD
.dwData = 0
.cbData = B.Length
.lpData = lpB.ToInt32
End With
Erase B
Try
If SendCDSToWindow(CD) Then
Return True
Else
Return False
End If
Catch
Return False
Finally
Marshal.FreeHGlobal(lpB)
End Try
Catch
Return False
End Try
End If
End Function
Private Shared Function SendMessageToWindow(ByVal oCmd As Object) As Boolean
Try
Dim strCmd As String = SerialHelper.SerializeToBase64String(oCmd)
Return SendMessageToWindow(strCmd)
Catch
Return False
End Try
End Function
#End Region
Private Shared _hWnd As Integer = -1
Private Shared _mcThisAppID As String
Private Shared oMutex As Threading.Mutex
Private Shared _MutexOwned As Boolean = False
Private Shared WithEvents MainForm As ISingleInstanceForm
Shared Sub New()
_mcThisAppID = Reflection.Assembly.GetExecutingAssembly().FullName
oMutex = New Threading.Mutex(True, _mcThisAppID & "_APPLICATION_MUTEX", _MutexOwned)
If Not _MutexOwned Then
If Not FindWindow() Then
_MutexOwned = True
End If
End If
AddHandler AppDomain.CurrentDomain.ProcessExit, AddressOf OnExit
End Sub
Private Shared Sub OnExit(ByVal sender As Object, ByVal e As EventArgs)
Try
If Not oMutex Is Nothing Then
oMutex.ReleaseMutex()
CType(oMutex, IDisposable).Dispose()
oMutex = Nothing
End If
Catch
'Do Nothing
End Try
End Sub
Public Shared ReadOnly Property IsFirstInstance() As Boolean
Get
Return _MutexOwned
End Get
End Property
Public Shared Function NotifyPreviousWindow() As Boolean
Return SendMessageToWindow(vbNullString)
End Function
Public Shared Function NotifyPreviousWindow(ByVal strText As String) As Boolean
Return SendMessageToWindow(strText)
End Function
Public Shared Function NotifyPreviousWindow(ByVal oCmd As Object) As Boolean
Return SendMessageToWindow(oCmd)
End Function
Public Shared Sub SetMainForm(ByVal frm As ISingleInstanceForm)
MainForm = frm
Try
Dim hWnd As Integer = frm.Handle.ToInt32
SetProp(hWnd, _mcThisAppID & "_APPLICATION", 1)
Catch
MainForm = Nothing
End Try
End Sub
Private Shared Sub MainForm_WndProc(ByVal m As System.Windows.Forms.Message, ByRef Cancel As Boolean) Handles MainForm.WndProc
Select Case m.Msg
Case WM_COPYDATA
Dim B() As Byte
Try
Dim CD As COPYDATASTRUCT = m.GetLParam(GetType(COPYDATASTRUCT))
ReDim B(CD.cbData)
Dim lpData As IntPtr = New IntPtr(CD.lpData)
Marshal.Copy(lpData, B, 0, CD.cbData)
Dim strData As String = Encoding.Default.GetString(B)
'TKBLib.Errorhandling.TraceHelper.Msg("EdokaApp.mMain.SingleeInstance.MainForm_WndProc", "Received Windows Msg " & strData, TraceLevel.Info)
MainForm.HandleCommand(strData)
Cancel = True
Catch
Cancel = False
Finally
Erase B
End Try
Case Else
Cancel = False
End Select
End Sub
End Class
Private MainForm As FrmMain
<STAThread()> Public Function Main(ByVal CmdArgs() As String) As Integer
If SingleInstance.IsFirstInstance Then
Try
g_bRun = True
MainForm = New FrmMain
'MainForm.CmdArgsSimulated = CmdArgs
SingleInstance.SetMainForm(MainForm)
Application.Run(MainForm)
Catch ex As Exception
'If Not Force_Exit Then
' MsgBox(ex.Message)
' End If
End Try
Else
g_bRun = True
SingleInstance.NotifyPreviousWindow(CmdArgs)
End If
End Function
End Module