This commit is contained in:
2022-12-25 10:09:49 +01:00
commit 406d053e79
3903 changed files with 2127541 additions and 0 deletions

269
Backup/Common/Action.vb Normal file
View File

@@ -0,0 +1,269 @@
Imports System.IO
Imports System.Xml
Imports System.Xml.Schema
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Public Class Action
#Region "Members"
Private Shared _actionSingleton As Action
Private _actionType As ActionType
Private _creatorTgNr As String
Private _sourceApplication As String
Private _parameters As Parameter()
Private _validationSuccess As Boolean
#End Region
#Region "Public methods"
'''<summary>Lädt externes Xml file für automatisierte Aktionen</summary>
'''<param name="xmlImportFile">Das Xml File mit den entsprechenden Parametern</param>
Public Sub Load(ByVal xmlImportFile As FileInfo)
Try
'Validate source
'If Not IsValid(xmlImportFile) Then
' 'xml file is invalid
' Throw New ActionException(1, "Specified file " & xmlImportFile.FullName & " hasn't got a valid strucure which is specified by his schema")
'End If
Dim doc As New XmlDocument()
doc.Load(xmlImportFile.FullName)
'read header elements
_actionType = CType(doc.SelectSingleNode("action/actionId").InnerText, ActionType)
_creatorTgNr = doc.SelectSingleNode("action/creatorTg").InnerText
_sourceApplication = doc.SelectSingleNode("action/sourceApplication").InnerText
Dim RootNode As XmlElement = doc.DocumentElement
Dim nodeList As XmlNodeList = RootNode.ChildNodes
If nodeList.Count > 0 Then
'set correct array size
ReDim _parameters(nodeList.Count - 1)
Dim value As String
Dim name As String
Dim parameterCounter As Integer = 0
Dim i As Integer
For i = 0 To nodeList.Count - 1
value = nodeList.Item(i).InnerText
name = nodeList.Item(i).LocalName
'append new parameter
_parameters(parameterCounter) = New Parameter(name, value)
parameterCounter = parameterCounter + 1
Next
End If
'Rel 4.02
Catch ex As Exception
Throw ex
TKBLib.Errorhandling.TraceHelper.Msg("EdokaLib.Common.Action.Load", ex.Message & ex.StackTrace, TraceLevel.Error)
End Try
End Sub
'''<summary>Returns a parameter identified by his name</summary>
'''<param name="paramName"></param>
'''<returns></returns>
Public Function GetParameterByName(ByVal paramName As String) As Parameter
Try
Dim param As Parameter
For Each param In _parameters
If param.Name = paramName Then
Return param
End If
Next
Catch ex As Exception
TKBLib.Errorhandling.TraceHelper.Msg("EdokaLib.Common.Action.GetParameterByName", ex.Message & ex.StackTrace, TraceLevel.Error)
Throw ex
End Try
End Function
'''<summary>Zerstört die statische Instanz</summary>
Public Sub Destroy()
Try
_actionSingleton = Nothing
Catch ex As Exception
TKBLib.Errorhandling.TraceHelper.Msg("EdokaLib.Common.Action.Destroy", ex.Message & ex.StackTrace, TraceLevel.Error)
Throw ex
End Try
End Sub
#End Region
#Region "Private methods/subs"
'''<summary>Überprüft ob das Xml file dem angegebenen Schema entspricht</summary>
'''<param name="xmlImportFile"></param>
'''<returns></returns>
Private Function IsValid(ByVal xmlImportFile As FileInfo) As Boolean
Dim reader As New XmlTextReader(xmlImportFile.FullName)
'We pass the xmltextreader into the xmlvalidatingreader
'This will validate the xml doc with the schema file
'NOTE the xml file it self points to the schema file
Dim validator As New XmlValidatingReader(reader)
Try
'First we create the xmltextreader
' Set the validation event handler
'AddHandler validator.ValidationEventHandler, _
'AddressOf ValidationCallback
_validationSuccess = True 'make sure to reset the success var
' Read XML data
While (validator.Read)
End While
'Close the reader.
validator.Close()
reader.Close()
'The validationeventhandler is the only thing that would
'set m_Success to false
Return _validationSuccess
Catch ex As Exception
validator.Close()
reader.Close()
_validationSuccess = False
TKBLib.Errorhandling.TraceHelper.Msg("EdokaLib.Common.Action.IsValid", ex.Message & ex.StackTrace, TraceLevel.Warning)
_validationSuccess = False
Return _validationSuccess
Throw ex
End Try
End Function
Private Sub ValidationCallback(ByVal sender As Object, ByVal args As ValidationEventArgs)
Try
'Display the validation error. This is only called on error
_validationSuccess = False 'Validation failed
Debug.Write("Validation error: " + args.Message + Environment.NewLine)
Throw New ActionException(1, "Fehler bei der Validierung")
Catch ex As Exception
Throw ex
End Try
End Sub
#End Region
#Region "Properties"
Public Shared ReadOnly Property Action() As Action
Get
If IsNothing(_actionSingleton) Then
_actionSingleton = New Action()
End If
Return _actionSingleton
End Get
End Property
Public ReadOnly Property valtionOK() As Boolean
Get
Return _validationSuccess
End Get
End Property
Public ReadOnly Property ActionType() As ActionType
Get
Return _actionType
End Get
End Property
Public ReadOnly Property CreatorTgNr() As String
Get
Return _creatorTgNr
End Get
End Property
Public ReadOnly Property SourceApplication() As String
Get
Return _sourceApplication
End Get
End Property
Public ReadOnly Property Parameters() As Parameter()
Get
Return _parameters
End Get
End Property
#End Region
End Class
#Region "ActionException"
Public Class ActionException
Inherits Exception
Private _number As Integer
Private _description As String
Public Sub New(ByVal number As Integer, ByVal description As String)
_number = number
_description = description
End Sub
Public Overrides ReadOnly Property Message() As String
Get
Return _description
End Get
End Property
Public ReadOnly Property Number() As Integer
Get
Return _number
End Get
End Property
End Class
#End Region
'''<summary>Struct für einzelne Parameter</summary>
Public Structure Parameter
Private _value As String
Private _name As String
Public Sub New(ByVal name As String, ByVal value As String)
Try
_value = value
_name = name
Catch ex As Exception
TKBLib.Errorhandling.TraceHelper.Msg("EdokaLib.Common.Parameter.New", ex.Message & ex.StackTrace, TraceLevel.Error)
Throw ex
End Try
End Sub
Public ReadOnly Property Value() As String
Get
Return _value
End Get
End Property
Public ReadOnly Property Name() As String
Get
Return _name
End Get
End Property
End Structure
Public Enum ActionType
AnzeigePartnerdossier = 1
DokumentAnzeige = 2
DokumentErstellung = 3
DokumentBearbeitung = 4
Statusmutation = 5
HostDokumentAnzeige = 6
UVMDokumentanzeige = 7
ZVDokumentanzeige = 8
End Enum

View File

@@ -0,0 +1,31 @@
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgende
' Attributgruppe gesteuert. Ändern Sie diese Attributwerte, um Informationen,
' die mit einer Assembly verknüpft sind, zu bearbeiten.
' Die Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("EDOKA.Common")>
<Assembly: AssemblyDescription("Common classes of EDOKA")>
<Assembly: AssemblyCompany("TKB")>
<Assembly: AssemblyProduct("EDOKA")>
<Assembly: AssemblyCopyright("TKB")>
<Assembly: AssemblyTrademark("-")>
<Assembly: CLSCompliant(True)>
'Die folgende GUID ist für die ID der Typbibliothek, wenn dieses Projekt in COM angezeigt wird
<Assembly: Guid("F2EA4A43-02E3-4E62-8131-D928B2663D09")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Haupversion
' Nebenversion
' Buildnummer
' Revisionsnummer
'
' Sie können alle Werte angeben oder auf die standardmäßigen Build- und Revisionsnummern
' zurückgreifen, indem Sie '*' wie unten angezeigt verwenden:
<Assembly: AssemblyVersion("1.0.*")>

198
Backup/Common/Common.vbproj Normal file
View File

@@ -0,0 +1,198 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{67E15143-9CF6-4595-8A52-A01A16370E51}</ProjectGuid>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>EDOKALib.Common</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<OptionCompare>Binary</OptionCompare>
<OptionExplicit>On</OptionExplicit>
<OptionStrict>Off</OptionStrict>
<RootNamespace>EDOKALib.Common</RootNamespace>
<StartupObject>EDOKALib.Common.%28Keine%29</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<MyType>Windows</MyType>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>EDOKALib.Common.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>EDOKALib.Common.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'EDOKA_DLLs|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>EDOKALib.Common.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>full</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
<Reference Include="TKBLib.Errorhandling.v1">
<Name>TKBLib.Errorhandling.v1</Name>
<HintPath>..\..\TKBLib\aktuellDebug\TKBLib.Errorhandling.v1.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Action.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Consts.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Crypto.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Datenbank.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Tools.vb">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,92 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastOpenVersion>7.10.3077</LastOpenVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>C:\proj\TKBLib\aktuellDebug\</ReferencePath>
<CopyProjectDestinationFolder>
</CopyProjectDestinationFolder>
<CopyProjectUncPath>
</CopyProjectUncPath>
<CopyProjectOption>0</CopyProjectOption>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
<PublishUrlHistory>
</PublishUrlHistory>
<InstallUrlHistory>
</InstallUrlHistory>
<SupportUrlHistory>
</SupportUrlHistory>
<UpdateUrlHistory>
</UpdateUrlHistory>
<BootstrapperUrlHistory>
</BootstrapperUrlHistory>
<ErrorReportUrlHistory>
</ErrorReportUrlHistory>
<FallbackCulture>de-DE</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>true</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>true</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'EDOKA_DLLs|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>true</StartWithIE>
</PropertyGroup>
</Project>

10
Backup/Common/Consts.vb Normal file
View File

@@ -0,0 +1,10 @@
'''<summary>Diese klasse beinhaltet Konstanten welche im der gesamten EDOKAApp verwendet werden</summary>
Public Class Consts
Public Shared ReadOnly WARNUNG As String = "Warnung"
Public Shared ReadOnly FEHLER As String = "Fehler"
Public Shared ReadOnly INFO As String = "Information"
Public Shared ReadOnly ACTION_FILE_EXTENSION As String = "edk"
End Class

50
Backup/Common/Crypto.vb Normal file
View File

@@ -0,0 +1,50 @@
'''<summary>Diese klasse beinhaltet Methoden welche für den Kryptografischen Teil im EDOKA verwendet werden</summary>
Public Class Crypto
Const CRYPTO_PASSWORD As String = "HutterundMueller"
'''<summary>Verschlüsselt einen Text mit dem angegebenen Passwort</summary>
'''<param name="strText">Zu verschlüsselnder Text</param>
'''<includesource>yes</includesource>
Public Shared Function EncryptText(ByVal strText As String)
Dim i As Integer, c As Integer
Dim strBuff As String
Dim strPwd As String = CRYPTO_PASSWORD
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
'''<summary>Entschlüsselt einen Text</summary>
'''<param name="strText">Zu verschlüsselnder Text</param>
'''<includesource>yes</includesource>
Public Shared Function DecryptText(ByVal strText As String)
Dim i As Integer, c As Integer
Dim strBuff As String
Dim strPwd As String = CRYPTO_PASSWORD
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 Class
'End Namespace

View File

@@ -0,0 +1,29 @@
Imports System.IO
'''<summary>Diese klasse beinhaltet Methoden welche für den Datenbank Zugriff im DataAccess verwendet werden</summary>
Public Class Datenbank
'''<summary>Liest aus dem Connection String file edokaconn.cfg aus</summary>
'''<returns>Den entschlüsseleten DSN string</returns>
Overloads Shared Function GetDSN() As String
Try
Dim file As System.IO.File
Dim reader As System.IO.StreamReader
Dim connectionString As String
reader = file.OpenText(AppDomain.CurrentDomain.BaseDirectory + "edokaconn.cfg")
connectionString = reader.ReadLine
connectionString = Crypto.DecryptText(connectionString)
connectionString = Left(connectionString, Len(connectionString) - 1)
reader.Close()
GetDSN = connectionString
Catch ex As Exception
Throw ex
End Try
End Function
End Class

131
Backup/Common/Tools.vb Normal file
View File

@@ -0,0 +1,131 @@
'''<summary>Diese klasse beinhaltet Methoden, welche im gesamten Edoka über alle Layers verwendet werden</summary>
Public Class Tools
Public Shared Function CToInt16(ByVal o As Object) As Int16
If o Is System.DBNull.Value Then
Return 0
Else
If TypeOf o Is Int16 Then
Return CShort(o)
End If
End If
End Function
Public Shared Function CToInt32(ByVal o As Object) As Int32
If o Is System.DBNull.Value Then
Return 0
Else
If TypeOf o Is Int32 Then
Return CInt(o)
End If
End If
End Function
Public Shared Function CToInt64(ByVal o As Object) As Int64
If o Is System.DBNull.Value Then
Return 0
Else
If TypeOf o Is Int64 Then
Return CLng(o)
End If
End If
End Function
Public Shared Function CToSingle(ByVal o As Object) As Single
If o Is System.DBNull.Value Then
Return 0
Else
If TypeOf o Is Single Then
Return CSng(o)
End If
End If
End Function
Public Shared Function CToDouble(ByVal o As Object) As Double
If o Is System.DBNull.Value Then
Return 0
Else
If TypeOf o Is Double Then
Return CDbl(o)
End If
End If
End Function
Public Shared Function CToDecimal(ByVal o As Object) As Decimal
If o Is System.DBNull.Value Then
Return 0
Else
If TypeOf o Is Decimal Then
Return CDec(o)
End If
End If
End Function
Public Shared Function CToByte(ByVal o As Object) As Byte
If o Is System.DBNull.Value Then
Return New Byte()
Else
If TypeOf o Is Byte Then
Return CByte(o)
End If
End If
End Function
Public Shared Function CToByteArr(ByVal o As Object) As Byte()
If o Is System.DBNull.Value Then
Return New Byte() {}
Else
If TypeOf o Is Byte() Then
Return CType(o, Byte())
End If
End If
End Function
Public Shared Function CToString(ByVal o As Object) As String
If o Is System.DBNull.Value Then
Return ""
Else
If TypeOf o Is String Then
Return CStr(o)
End If
End If
End Function
Public Shared Function CToBool(ByVal o As Object) As Boolean
If o Is System.DBNull.Value Then
Return False
Else
If TypeOf o Is Boolean Then
Return CBool(o)
End If
End If
End Function
Public Shared Function CToDateTime(ByVal o As Object) As DateTime
If o Is System.DBNull.Value Then
Return DateTime.MinValue
Else
If TypeOf o Is DateTime Then
Return CDate(o)
End If
End If
End Function
'''<summary>Überprüft TableCount und RowCount eines DataSet</summary>
'''<param name="ds"></param>
'''<returns>True wenn table- und rowcount > 0</returns>
Public Shared Function ValidateDS(ByVal ds As DataSet) As Boolean
Try
If ds.Tables.Count > 0 Then
If ds.Tables(0).Rows.Count > 0 Then
Return True
End If
End If
Return False
Catch ex As Exception
TKBLib.Errorhandling.TraceHelper.Msg("EDOKALib.Common.Tools.ValidateDS", ex.Message + " " + ex.StackTrace, TraceLevel.Error)
End Try
End Function
End Class