This commit is contained in:
SchreiberM
2017-01-25 10:19:44 +01:00
parent 44ef127125
commit 399ef6d985
10 changed files with 322 additions and 323 deletions

View File

@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<configSections> <configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DD_PROXY_SYNC.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="DD_PROXY_SYNC.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<connectionStrings> <connectionStrings />
<add name="DD_PROXY_SYNC.My.MySettings.MyConnectionString" connectionString="Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=dd" <startup>
providerName="System.Data.SqlClient" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</connectionStrings> </startup>
<startup> <applicationSettings>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> <DD_PROXY_SYNC.My.MySettings>
</startup> <setting name="LOG_ERRORS_ONLY" serializeAs="String">
<applicationSettings> <value>False</value>
<DD_PROXY_SYNC.My.MySettings> </setting>
<setting name="LOG_ERRORS_ONLY" serializeAs="String"> <setting name="MyConnectionString" serializeAs="String">
<value>False</value> <value>Server=172.24.12.41\tests;Database=DD_ECM_RENOLIT;User Id=sa;Password=dd;</value>
</setting> </setting>
</DD_PROXY_SYNC.My.MySettings> </DD_PROXY_SYNC.My.MySettings>
</applicationSettings> </applicationSettings>
</configuration> </configuration>

View File

@@ -1,93 +1,91 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' Dieser Code wurde von einem Tool generiert. ' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.36366 ' Laufzeitversion:4.0.30319.36366
' '
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
Option Strict On Option Strict On
Option Explicit On Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "Funktion zum automatischen Speichern von My.Settings" #Region "Funktion zum automatischen Speichern von My.Settings"
#If _MyType = "WindowsForms" Then #If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then If My.Application.SaveMySettingsOnExit Then
My.Settings.Save() My.Settings.Save()
End If End If
End Sub End Sub
#End If #End If
#End Region #End Region
Public Shared ReadOnly Property [Default]() As MySettings Public Shared ReadOnly Property [Default]() As MySettings
Get Get
#If _MyType = "WindowsForms" Then #If _MyType = "WindowsForms" Then
If Not addedHandler Then If Not addedHandler Then
SyncLock addedHandlerLockObject SyncLock addedHandlerLockObject
If Not addedHandler Then If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True addedHandler = True
End If End If
End SyncLock End SyncLock
End If End If
#End If #End If
Return defaultInstance Return defaultInstance
End Get End Get
End Property End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _ <Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False")> _ Global.System.Configuration.DefaultSettingValueAttribute("False")> _
Public ReadOnly Property LOG_ERRORS_ONLY() As Boolean Public ReadOnly Property LOG_ERRORS_ONLY() As Boolean
Get Get
Return CType(Me("LOG_ERRORS_ONLY"),Boolean) Return CType(Me("LOG_ERRORS_ONLY"),Boolean)
End Get End Get
End Property End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _ <Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.SpecialSettingAttribute(Global.System.Configuration.SpecialSetting.ConnectionString), _ Global.System.Configuration.DefaultSettingValueAttribute("Server=172.24.12.41\tests;Database=DD_ECM_RENOLIT;User Id=sa;Password=dd;")> _
Global.System.Configuration.DefaultSettingValueAttribute("Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=d"& _ Public ReadOnly Property MyConnectionString() As String
"d")> _ Get
Public ReadOnly Property MyConnectionString() As String Return CType(Me("MyConnectionString"),String)
Get End Get
Return CType(Me("MyConnectionString"),String) End Property
End Get End Class
End Property End Namespace
End Class
End Namespace Namespace My
Namespace My <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Friend Module MySettingsProperty
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.DD_PROXY_SYNC.My.MySettings
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _ Get
Friend ReadOnly Property Settings() As Global.DD_PROXY_SYNC.My.MySettings Return Global.DD_PROXY_SYNC.My.MySettings.Default
Get End Get
Return Global.DD_PROXY_SYNC.My.MySettings.Default End Property
End Get End Module
End Property End Namespace
End Module
End Namespace

View File

@@ -1,17 +1,12 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true"> <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="LOG_ERRORS_ONLY" Type="System.Boolean" Scope="Application"> <Setting Name="LOG_ERRORS_ONLY" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="MyConnectionString" Type="(Connection string)" Scope="Application"> <Setting Name="MyConnectionString" Type="System.String" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt; <Value Profile="(Default)">Server=172.24.12.41\tests;Database=DD_ECM_RENOLIT;User Id=sa;Password=dd;</Value>
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; </Setting>
&lt;ConnectionString&gt;Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=dd&lt;/ConnectionString&gt; </Settings>
&lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=dd</Value>
</Setting>
</Settings>
</SettingsFile> </SettingsFile>

View File

@@ -1,103 +1,111 @@
Imports System.ComponentModel Imports System.ComponentModel
Imports System.Data.SqlClient Imports System.Data.SqlClient
Public Class DD_PROXY_SERV Public Class DD_PROXY_SERV
#Region "+++++ Variablen +++++" #Region "+++++ Variablen +++++"
'Variablen 'Variablen
Public Shared threadRunner As BackgroundWorker Public Shared threadRunner As BackgroundWorker
#End Region #End Region
Protected Overrides Sub OnStart(ByVal args() As String) Protected Overrides Sub OnStart(ByVal args() As String)
' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge ' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge
' ausführen, damit der Dienst gestartet werden kann. ' ausführen, damit der Dienst gestartet werden kann.
' Start the thread. ' Start the thread.
Try Try
clsLogger.Init(My.Application.Info.DirectoryPath & "\Log", "logPROXY_SYNC_") clsLogger.Init(My.Application.Info.DirectoryPath & "\Log", "logPROXY_SYNC_")
clsLogger.Add("## PMO-Service started - " & Now & " ## ", False) clsLogger.Add("## PMO-Service started - " & Now & " ## ", False)
If My.Settings.MyConnectionString = String.Empty Then If My.Settings.MyConnectionString = String.Empty Then
clsLogger.Add("NO CONNECTIONSTRING CONFIGURED.", True) clsLogger.Add("NO CONNECTIONSTRING CONFIGURED.", True)
Else Else
If clsDatabase.Init = False Then If clsDatabase.Init = False Then
clsLogger.Add("ATTENTION: No Connection was established '" & My.Settings.MyConnectionString & "'!", True) clsLogger.Add("ATTENTION: No Connection was established '" & My.Settings.MyConnectionString & "'!", True)
Else Else
If My.Settings.LOG_ERRORS_ONLY = False Then If My.Settings.LOG_ERRORS_ONLY = False Then
clsLogger.Add(">> Detail-Log is on!", False) clsLogger.Add(">> Detail-Log is on!", False)
End If End If
'### Thread für Durchlauf generieren '### Thread für Durchlauf generieren
DD_PROXY_SERV.threadRunner = New BackgroundWorker() DD_PROXY_SERV.threadRunner = New BackgroundWorker()
DD_PROXY_SERV.threadRunner.WorkerReportsProgress = True DD_PROXY_SERV.threadRunner.WorkerReportsProgress = True
DD_PROXY_SERV.threadRunner.WorkerSupportsCancellation = True DD_PROXY_SERV.threadRunner.WorkerSupportsCancellation = True
AddHandler threadRunner.DoWork, AddressOf RUN_THREAD AddHandler threadRunner.DoWork, AddressOf RUN_THREAD
AddHandler threadRunner.RunWorkerCompleted, AddressOf Thread_Completed AddHandler threadRunner.RunWorkerCompleted, AddressOf Thread_Completed
' Und den Durchlauf das erste Mal starten ' Und den Durchlauf das erste Mal starten
threadRunner.RunWorkerAsync() threadRunner.RunWorkerAsync()
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
clsLogger.AddError(ex.Message, "OnStart") clsLogger.AddError(ex.Message, "OnStart")
End Try End Try
End Sub End Sub
Private Shared Sub Thread_Completed(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) 'Handles threadDateiimport.RunWorkerCompleted Private Shared Sub Thread_Completed(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) 'Handles threadDateiimport.RunWorkerCompleted
' This event fires when the DoWork event completes ' This event fires when the DoWork event completes
Try Try
Dim result As String = "" Dim result As String = ""
If e.Cancelled Then If e.Cancelled Then
clsLogger.Add("## The thread was cancelled", False) clsLogger.Add("## The thread was cancelled", False)
ElseIf e.Error IsNot Nothing Then ElseIf e.Error IsNot Nothing Then
clsLogger.Add("Unexpected Error in Run Thread. The run will be terminated.", True, "Thread_Completed") clsLogger.Add("Unexpected Error in Run Thread. The run will be terminated.", True, "Thread_Completed")
clsLogger.Add(e.Error.Message, True, "Thread_Completed") clsLogger.Add(e.Error.Message, True, "Thread_Completed")
End If End If
Catch ex As Exception Catch ex As Exception
clsLogger.AddError(ex.Message, "Thread_Completed") clsLogger.AddError(ex.Message, "Thread_Completed")
End Try End Try
clsLogger.WriteLog() clsLogger.WriteLog()
End Sub End Sub
Protected Overrides Sub OnStop() Protected Overrides Sub OnStop()
' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen. ' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen.
' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen. ' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen.
'EventLog1.WriteEntry("Dienst 'DD windream Result Handler' gestoppt") 'EventLog1.WriteEntry("Dienst 'DD windream Result Handler' gestoppt")
clsLogger.Add("", False) clsLogger.Add("", False)
clsLogger.Add("## Service was stopped - " & Now & " ## ", False) clsLogger.Add("## Service was stopped - " & Now & " ## ", False)
clsLogger.Add("", False) clsLogger.Add("", False)
clsLogger.WriteLog() clsLogger.WriteLog()
End Sub End Sub
Public Shared Sub RUN_THREAD(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Public Shared Sub RUN_THREAD(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
Try Try
If clsDatabase.Init() = True Then If clsDatabase.Init() = True Then
Dim sql = "select * from TBPROXY_SYNC_PROCEDURES" Dim sql = "select * from TBPROXY_SYNC_PROCEDURES"
Dim DT_PROCEDURES As DataTable = clsDatabase.Return_Datatable(sql) Dim DT_PROCEDURES As DataTable = clsDatabase.Return_Datatable(sql)
If Not IsNothing(DT_PROCEDURES) Then If Not IsNothing(DT_PROCEDURES) Then
If DT_PROCEDURES.Rows.Count > 0 Then If DT_PROCEDURES.Rows.Count > 0 Then
'Wenn Zeilen enthalten..... 'Wenn Zeilen enthalten.....
For Each syncRow As DataRow In DT_PROCEDURES.Rows For Each syncRow As DataRow In DT_PROCEDURES.Rows
clsLogger.AddDetailLog(">> Executing Procedure: " & syncRow.Item("PROC_NAME").ToString & " ...") Dim GUID = syncRow.Item("GUID")
EXECUTE_ROCEDURE(syncRow.Item("PROC_NAME").ToString) clsLogger.AddDetailLog(">> Executing Procedure: " & syncRow.Item("PROC_NAME").ToString & " ...")
Next clsLogger.WriteLog()
End If Dim upd = "UPDATE TBPROXY_SYNC_PROCEDURES SET SYNCHRONIZED_WHEN = NULL WHERE GUID = " & GUID
Else clsDatabase.Execute_non_Query(upd)
clsLogger.Add("- NO SYNC PROCEDURES!", False) If EXECUTE_ROCEDURE(syncRow.Item("PROC_NAME").ToString) = True Then
End If upd = "UPDATE TBPROXY_SYNC_PROCEDURES SET SYNCHRONIZED_WHEN = GETDATE() WHERE GUID = " & GUID
End If clsDatabase.Execute_non_Query(upd)
Catch ex As Exception End If
clsLogger.AddError("Uncexpected Error: " & ex.Message, "RUN_THREAD") clsLogger.WriteLog()
Finally Next
clsLogger.WriteLog() End If
End Try Else
End Sub clsLogger.Add("- NO SYNC PROCEDURES!", False)
Public Shared Function EXECUTE_ROCEDURE(PROXY_PROCEDURE As String) End If
Dim sel = String.Format("DECLARE @return_value int" & vbNewLine & _ End If
"EXEC @return_value = [dbo].[{0}]" & vbNewLine & _ Catch ex As Exception
"SELECT 'Return Value' = @return_value", PROXY_PROCEDURE) clsLogger.AddError("Uncexpected Error: " & ex.Message, "RUN_THREAD")
clsLogger.AddDetailLog(">> ExecuteCommand: " & sel) Finally
Dim Result As DataTable = clsDatabase.Return_Datatable(sel) clsLogger.WriteLog()
If Not IsNothing(Result) Then End Try
If Result.Rows(0).Item(0) = 0 Then End Sub
Return True Public Shared Function EXECUTE_ROCEDURE(PROXY_PROCEDURE As String)
Else Dim sel = String.Format("DECLARE @return_value int" & vbNewLine & _
Return False "EXEC @return_value = [dbo].[{0}]" & vbNewLine & _
End If "SELECT 'Return Value' = @return_value", PROXY_PROCEDURE)
Else clsLogger.AddDetailLog(">> ExecuteCommand: " & sel)
Return False Dim Result As DataTable = clsDatabase.Return_Datatable(sel)
End If If Not IsNothing(Result) Then
End Function If Result.Rows(0).Item(0) = 0 Then
End Class Return True
Else
Return False
End If
Else
Return False
End If
End Function
End Class

View File

@@ -5,10 +5,7 @@
<section name="DD_PROXY_SYNC.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="DD_PROXY_SYNC.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<connectionStrings> <connectionStrings />
<add name="DD_PROXY_SYNC.My.MySettings.MyConnectionString" connectionString="Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=dd"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup> </startup>
@@ -17,6 +14,9 @@
<setting name="LOG_ERRORS_ONLY" serializeAs="String"> <setting name="LOG_ERRORS_ONLY" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="MyConnectionString" serializeAs="String">
<value>Server=172.24.12.41\tests;Database=DD_ECM_RENOLIT;User Id=sa;Password=dd;</value>
</setting>
</DD_PROXY_SYNC.My.MySettings> </DD_PROXY_SYNC.My.MySettings>
</applicationSettings> </applicationSettings>
</configuration> </configuration>

View File

@@ -5,10 +5,7 @@
<section name="DD_PROXY_SYNC.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="DD_PROXY_SYNC.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<connectionStrings> <connectionStrings />
<add name="DD_PROXY_SYNC.My.MySettings.MyConnectionString" connectionString="Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=dd"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup> </startup>
@@ -17,6 +14,9 @@
<setting name="LOG_ERRORS_ONLY" serializeAs="String"> <setting name="LOG_ERRORS_ONLY" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="MyConnectionString" serializeAs="String">
<value>Server=172.24.12.41\tests;Database=DD_ECM_RENOLIT;User Id=sa;Password=dd;</value>
</setting>
</DD_PROXY_SYNC.My.MySettings> </DD_PROXY_SYNC.My.MySettings>
</applicationSettings> </applicationSettings>
</configuration> </configuration>

View File

@@ -1,78 +1,79 @@
Public Class clsDatabase Public Class clsDatabase
Private Shared connectionString As String Private Shared connectionString As String
Public Shared Function Init() Public Shared Function Init()
Try Try
connectionString = My.Settings.MyConnectionString connectionString = My.Settings.MyConnectionString
Dim SQLconnect As New SqlClient.SqlConnection Dim SQLconnect As New SqlClient.SqlConnection
SQLconnect.ConnectionString = connectionString SQLconnect.ConnectionString = connectionString
SQLconnect.Open() SQLconnect.Open()
SQLconnect.Close() SQLconnect.Close()
clsLogger.AddDetailLog("Database initialized") clsLogger.AddDetailLog("Database initialized")
Return True Return True
Catch ex As Exception Catch ex As Exception
clsLogger.Add("Unexpected Error in DatabaseInit: " & ex.Message, True) clsLogger.Add("Unexpected Error in DatabaseInit: " & ex.Message, True)
Return False Return False
End Try End Try
End Function End Function
Public Shared Function Return_Datatable(Select_anweisung As String) Public Shared Function Return_Datatable(Select_anweisung As String)
Try Try
Dim SQLconnect As New SqlClient.SqlConnection Dim SQLconnect As New SqlClient.SqlConnection
Dim SQLcommand As SqlClient.SqlCommand Dim SQLcommand As SqlClient.SqlCommand
SQLconnect.ConnectionString = connectionString SQLconnect.ConnectionString = connectionString
SQLconnect.Open() SQLconnect.Open()
SQLcommand = SQLconnect.CreateCommand SQLcommand = SQLconnect.CreateCommand
SQLcommand.CommandText = Select_anweisung SQLcommand.CommandText = Select_anweisung
SQLcommand.CommandTimeout = 180
Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(SQLcommand)
Dim dt As DataTable = New DataTable() Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(SQLcommand)
adapter1.Fill(dt) Dim dt As DataTable = New DataTable()
SQLconnect.Close() adapter1.Fill(dt)
Return dt SQLconnect.Close()
Catch ex As Exception Return dt
clsLogger.Add("Unexpected Error in Return_Datatable: " & ex.Message, True) Catch ex As Exception
clsLogger.Add("SQL: " & Select_anweisung, False) clsLogger.Add("Unexpected Error in Return_Datatable: " & ex.Message, True)
Return Nothing clsLogger.Add("SQL: " & Select_anweisung, False)
End Try Return Nothing
End Function End Try
Public Shared Function Execute_non_Query(ExecuteCMD As String) End Function
Try Public Shared Function Execute_non_Query(ExecuteCMD As String)
Dim SQLconnect As New SqlClient.SqlConnection Try
Dim SQLcommand As SqlClient.SqlCommand Dim SQLconnect As New SqlClient.SqlConnection
SQLconnect.ConnectionString = connectionString Dim SQLcommand As SqlClient.SqlCommand
SQLconnect.Open() SQLconnect.ConnectionString = connectionString
SQLcommand = SQLconnect.CreateCommand SQLconnect.Open()
'Update Last Created Record in Foo SQLcommand = SQLconnect.CreateCommand
SQLcommand.CommandText = ExecuteCMD 'Update Last Created Record in Foo
SQLcommand.ExecuteNonQuery() SQLcommand.CommandText = ExecuteCMD
SQLcommand.Dispose() SQLcommand.ExecuteNonQuery()
SQLconnect.Close() SQLcommand.Dispose()
Return True SQLconnect.Close()
Catch ex As Exception Return True
clsLogger.Add("Unexpected Error in Execute_non_Query: " & ex.Message, True) Catch ex As Exception
clsLogger.Add("SQL: " & ExecuteCMD, False) clsLogger.Add("Unexpected Error in Execute_non_Query: " & ex.Message, True)
Return False clsLogger.Add("SQL: " & ExecuteCMD, False)
End Try Return False
End Function End Try
Public Shared Function Execute_Scalar(cmdscalar As String) End Function
Dim result Public Shared Function Execute_Scalar(cmdscalar As String)
Try Dim result
Dim SQLconnect As New SqlClient.SqlConnection Try
Dim SQLcommand As SqlClient.SqlCommand Dim SQLconnect As New SqlClient.SqlConnection
SQLconnect.ConnectionString = connectionString Dim SQLcommand As SqlClient.SqlCommand
SQLconnect.Open() SQLconnect.ConnectionString = connectionString
SQLcommand = SQLconnect.CreateCommand SQLconnect.Open()
'Update Last Created Record in Foo SQLcommand = SQLconnect.CreateCommand
SQLcommand.CommandText = cmdscalar 'Update Last Created Record in Foo
result = SQLcommand.ExecuteScalar() SQLcommand.CommandText = cmdscalar
SQLcommand.Dispose() result = SQLcommand.ExecuteScalar()
SQLconnect.Close() SQLcommand.Dispose()
Return result SQLconnect.Close()
Catch ex As Exception Return result
clsLogger.Add("Unexpected Error Execute_Scalar: " & ex.Message, True) Catch ex As Exception
clsLogger.Add("SQL: " & cmdscalar, False) clsLogger.Add("Unexpected Error Execute_Scalar: " & ex.Message, True)
Return Nothing clsLogger.Add("SQL: " & cmdscalar, False)
End Try Return Nothing
End Function End Try
End Class End Function
End Class

View File

@@ -9,8 +9,5 @@ E:\SchreiberM\Visual Studio\GIT\DD_PROXY_SYNC\DD_PROXY_SYNC\obj\Debug\DD_PROXY_S
E:\SchreiberM\Visual Studio\GIT\DD_PROXY_SYNC\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.exe E:\SchreiberM\Visual Studio\GIT\DD_PROXY_SYNC\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.exe
E:\SchreiberM\Visual Studio\GIT\DD_PROXY_SYNC\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.xml E:\SchreiberM\Visual Studio\GIT\DD_PROXY_SYNC\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.xml
E:\SchreiberM\Visual Studio\GIT\DD_PROXY_SYNC\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.pdb E:\SchreiberM\Visual Studio\GIT\DD_PROXY_SYNC\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.pdb
E:\SchreiberM\Visual Studio\GIT\DDProxySync\DD_PROXY_SYNC\bin\Debug\DD_PROXY_SYNC.exe.config
E:\SchreiberM\Visual Studio\GIT\DDProxySync\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.exe
E:\SchreiberM\Visual Studio\GIT\DDProxySync\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.xml
E:\SchreiberM\Visual Studio\GIT\DDProxySync\DD_PROXY_SYNC\obj\Debug\DD_PROXY_SYNC.pdb
E:\JenneJ\Visual Studio\Git\DDProxySync\DD_PROXY_SYNC\bin\Debug\DD_PROXY_SYNC.exe.config E:\JenneJ\Visual Studio\Git\DDProxySync\DD_PROXY_SYNC\bin\Debug\DD_PROXY_SYNC.exe.config
E:\SchreiberM\Visual Studio\GIT\DDProxySync\DD_PROXY_SYNC\bin\Debug\DD_PROXY_SYNC.exe.config