ms
This commit is contained in:
parent
44ef127125
commit
399ef6d985
@ -1,22 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<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" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<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>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
<applicationSettings>
|
||||
<DD_PROXY_SYNC.My.MySettings>
|
||||
<setting name="LOG_ERRORS_ONLY" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</DD_PROXY_SYNC.My.MySettings>
|
||||
</applicationSettings>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<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" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<connectionStrings />
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
<applicationSettings>
|
||||
<DD_PROXY_SYNC.My.MySettings>
|
||||
<setting name="LOG_ERRORS_ONLY" serializeAs="String">
|
||||
<value>False</value>
|
||||
</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>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
184
DD_PROXY_SYNC/My Project/Settings.Designer.vb
generated
184
DD_PROXY_SYNC/My Project/Settings.Designer.vb
generated
@ -1,93 +1,91 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.36366
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Funktion zum automatischen Speichern von My.Settings"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<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)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
|
||||
Public ReadOnly Property LOG_ERRORS_ONLY() As Boolean
|
||||
Get
|
||||
Return CType(Me("LOG_ERRORS_ONLY"),Boolean)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.SpecialSettingAttribute(Global.System.Configuration.SpecialSetting.ConnectionString), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=d"& _
|
||||
"d")> _
|
||||
Public ReadOnly Property MyConnectionString() As String
|
||||
Get
|
||||
Return CType(Me("MyConnectionString"),String)
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
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
|
||||
Get
|
||||
Return Global.DD_PROXY_SYNC.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.36366
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Funktion zum automatischen Speichern von My.Settings"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<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)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
|
||||
Public ReadOnly Property LOG_ERRORS_ONLY() As Boolean
|
||||
Get
|
||||
Return CType(Me("LOG_ERRORS_ONLY"),Boolean)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("Server=172.24.12.41\tests;Database=DD_ECM_RENOLIT;User Id=sa;Password=dd;")> _
|
||||
Public ReadOnly Property MyConnectionString() As String
|
||||
Get
|
||||
Return CType(Me("MyConnectionString"),String)
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
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
|
||||
Get
|
||||
Return Global.DD_PROXY_SYNC.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
|
||||
@ -1,17 +1,12 @@
|
||||
<?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">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LOG_ERRORS_ONLY" Type="System.Boolean" Scope="Application">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="MyConnectionString" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=dd</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=SDD-VMX04-DB01\TESTS;Persist Security Info=True;User ID=sa;Password=dd</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
<?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">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LOG_ERRORS_ONLY" Type="System.Boolean" Scope="Application">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="MyConnectionString" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Server=172.24.12.41\tests;Database=DD_ECM_RENOLIT;User Id=sa;Password=dd;</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -1,103 +1,111 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Data.SqlClient
|
||||
Public Class DD_PROXY_SERV
|
||||
#Region "+++++ Variablen +++++"
|
||||
'Variablen
|
||||
Public Shared threadRunner As BackgroundWorker
|
||||
#End Region
|
||||
Protected Overrides Sub OnStart(ByVal args() As String)
|
||||
' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge
|
||||
' ausführen, damit der Dienst gestartet werden kann.
|
||||
' Start the thread.
|
||||
Try
|
||||
clsLogger.Init(My.Application.Info.DirectoryPath & "\Log", "logPROXY_SYNC_")
|
||||
clsLogger.Add("## PMO-Service started - " & Now & " ## ", False)
|
||||
|
||||
If My.Settings.MyConnectionString = String.Empty Then
|
||||
clsLogger.Add("NO CONNECTIONSTRING CONFIGURED.", True)
|
||||
Else
|
||||
If clsDatabase.Init = False Then
|
||||
clsLogger.Add("ATTENTION: No Connection was established '" & My.Settings.MyConnectionString & "'!", True)
|
||||
Else
|
||||
If My.Settings.LOG_ERRORS_ONLY = False Then
|
||||
clsLogger.Add(">> Detail-Log is on!", False)
|
||||
End If
|
||||
'### Thread für Durchlauf generieren
|
||||
DD_PROXY_SERV.threadRunner = New BackgroundWorker()
|
||||
DD_PROXY_SERV.threadRunner.WorkerReportsProgress = True
|
||||
DD_PROXY_SERV.threadRunner.WorkerSupportsCancellation = True
|
||||
AddHandler threadRunner.DoWork, AddressOf RUN_THREAD
|
||||
AddHandler threadRunner.RunWorkerCompleted, AddressOf Thread_Completed
|
||||
' Und den Durchlauf das erste Mal starten
|
||||
threadRunner.RunWorkerAsync()
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError(ex.Message, "OnStart")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
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
|
||||
Try
|
||||
Dim result As String = ""
|
||||
If e.Cancelled Then
|
||||
clsLogger.Add("## The thread was cancelled", False)
|
||||
ElseIf e.Error IsNot Nothing Then
|
||||
clsLogger.Add("Unexpected Error in Run Thread. The run will be terminated.", True, "Thread_Completed")
|
||||
clsLogger.Add(e.Error.Message, True, "Thread_Completed")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError(ex.Message, "Thread_Completed")
|
||||
End Try
|
||||
clsLogger.WriteLog()
|
||||
End Sub
|
||||
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.
|
||||
'EventLog1.WriteEntry("Dienst 'DD windream Result Handler' gestoppt")
|
||||
clsLogger.Add("", False)
|
||||
clsLogger.Add("## Service was stopped - " & Now & " ## ", False)
|
||||
clsLogger.Add("", False)
|
||||
clsLogger.WriteLog()
|
||||
End Sub
|
||||
Public Shared Sub RUN_THREAD(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
|
||||
Try
|
||||
If clsDatabase.Init() = True Then
|
||||
Dim sql = "select * from TBPROXY_SYNC_PROCEDURES"
|
||||
Dim DT_PROCEDURES As DataTable = clsDatabase.Return_Datatable(sql)
|
||||
If Not IsNothing(DT_PROCEDURES) Then
|
||||
If DT_PROCEDURES.Rows.Count > 0 Then
|
||||
'Wenn Zeilen enthalten.....
|
||||
For Each syncRow As DataRow In DT_PROCEDURES.Rows
|
||||
clsLogger.AddDetailLog(">> Executing Procedure: " & syncRow.Item("PROC_NAME").ToString & " ...")
|
||||
EXECUTE_ROCEDURE(syncRow.Item("PROC_NAME").ToString)
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
clsLogger.Add("- NO SYNC PROCEDURES!", False)
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError("Uncexpected Error: " & ex.Message, "RUN_THREAD")
|
||||
Finally
|
||||
clsLogger.WriteLog()
|
||||
End Try
|
||||
End Sub
|
||||
Public Shared Function EXECUTE_ROCEDURE(PROXY_PROCEDURE As String)
|
||||
Dim sel = String.Format("DECLARE @return_value int" & vbNewLine & _
|
||||
"EXEC @return_value = [dbo].[{0}]" & vbNewLine & _
|
||||
"SELECT 'Return Value' = @return_value", PROXY_PROCEDURE)
|
||||
clsLogger.AddDetailLog(">> ExecuteCommand: " & sel)
|
||||
Dim Result As DataTable = clsDatabase.Return_Datatable(sel)
|
||||
If Not IsNothing(Result) Then
|
||||
If Result.Rows(0).Item(0) = 0 Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
Imports System.ComponentModel
|
||||
Imports System.Data.SqlClient
|
||||
Public Class DD_PROXY_SERV
|
||||
#Region "+++++ Variablen +++++"
|
||||
'Variablen
|
||||
Public Shared threadRunner As BackgroundWorker
|
||||
#End Region
|
||||
Protected Overrides Sub OnStart(ByVal args() As String)
|
||||
' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge
|
||||
' ausführen, damit der Dienst gestartet werden kann.
|
||||
' Start the thread.
|
||||
Try
|
||||
clsLogger.Init(My.Application.Info.DirectoryPath & "\Log", "logPROXY_SYNC_")
|
||||
clsLogger.Add("## PMO-Service started - " & Now & " ## ", False)
|
||||
|
||||
If My.Settings.MyConnectionString = String.Empty Then
|
||||
clsLogger.Add("NO CONNECTIONSTRING CONFIGURED.", True)
|
||||
Else
|
||||
If clsDatabase.Init = False Then
|
||||
clsLogger.Add("ATTENTION: No Connection was established '" & My.Settings.MyConnectionString & "'!", True)
|
||||
Else
|
||||
If My.Settings.LOG_ERRORS_ONLY = False Then
|
||||
clsLogger.Add(">> Detail-Log is on!", False)
|
||||
End If
|
||||
'### Thread für Durchlauf generieren
|
||||
DD_PROXY_SERV.threadRunner = New BackgroundWorker()
|
||||
DD_PROXY_SERV.threadRunner.WorkerReportsProgress = True
|
||||
DD_PROXY_SERV.threadRunner.WorkerSupportsCancellation = True
|
||||
AddHandler threadRunner.DoWork, AddressOf RUN_THREAD
|
||||
AddHandler threadRunner.RunWorkerCompleted, AddressOf Thread_Completed
|
||||
' Und den Durchlauf das erste Mal starten
|
||||
threadRunner.RunWorkerAsync()
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError(ex.Message, "OnStart")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
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
|
||||
Try
|
||||
Dim result As String = ""
|
||||
If e.Cancelled Then
|
||||
clsLogger.Add("## The thread was cancelled", False)
|
||||
ElseIf e.Error IsNot Nothing Then
|
||||
clsLogger.Add("Unexpected Error in Run Thread. The run will be terminated.", True, "Thread_Completed")
|
||||
clsLogger.Add(e.Error.Message, True, "Thread_Completed")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError(ex.Message, "Thread_Completed")
|
||||
End Try
|
||||
clsLogger.WriteLog()
|
||||
End Sub
|
||||
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.
|
||||
'EventLog1.WriteEntry("Dienst 'DD windream Result Handler' gestoppt")
|
||||
clsLogger.Add("", False)
|
||||
clsLogger.Add("## Service was stopped - " & Now & " ## ", False)
|
||||
clsLogger.Add("", False)
|
||||
clsLogger.WriteLog()
|
||||
End Sub
|
||||
Public Shared Sub RUN_THREAD(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
|
||||
Try
|
||||
If clsDatabase.Init() = True Then
|
||||
Dim sql = "select * from TBPROXY_SYNC_PROCEDURES"
|
||||
Dim DT_PROCEDURES As DataTable = clsDatabase.Return_Datatable(sql)
|
||||
If Not IsNothing(DT_PROCEDURES) Then
|
||||
If DT_PROCEDURES.Rows.Count > 0 Then
|
||||
'Wenn Zeilen enthalten.....
|
||||
For Each syncRow As DataRow In DT_PROCEDURES.Rows
|
||||
Dim GUID = syncRow.Item("GUID")
|
||||
clsLogger.AddDetailLog(">> Executing Procedure: " & syncRow.Item("PROC_NAME").ToString & " ...")
|
||||
clsLogger.WriteLog()
|
||||
Dim upd = "UPDATE TBPROXY_SYNC_PROCEDURES SET SYNCHRONIZED_WHEN = NULL WHERE GUID = " & GUID
|
||||
clsDatabase.Execute_non_Query(upd)
|
||||
If EXECUTE_ROCEDURE(syncRow.Item("PROC_NAME").ToString) = True Then
|
||||
upd = "UPDATE TBPROXY_SYNC_PROCEDURES SET SYNCHRONIZED_WHEN = GETDATE() WHERE GUID = " & GUID
|
||||
clsDatabase.Execute_non_Query(upd)
|
||||
End If
|
||||
clsLogger.WriteLog()
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
clsLogger.Add("- NO SYNC PROCEDURES!", False)
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError("Uncexpected Error: " & ex.Message, "RUN_THREAD")
|
||||
Finally
|
||||
clsLogger.WriteLog()
|
||||
End Try
|
||||
End Sub
|
||||
Public Shared Function EXECUTE_ROCEDURE(PROXY_PROCEDURE As String)
|
||||
Dim sel = String.Format("DECLARE @return_value int" & vbNewLine & _
|
||||
"EXEC @return_value = [dbo].[{0}]" & vbNewLine & _
|
||||
"SELECT 'Return Value' = @return_value", PROXY_PROCEDURE)
|
||||
clsLogger.AddDetailLog(">> ExecuteCommand: " & sel)
|
||||
Dim Result As DataTable = clsDatabase.Return_Datatable(sel)
|
||||
If Not IsNothing(Result) Then
|
||||
If Result.Rows(0).Item(0) = 0 Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -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" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<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>
|
||||
<connectionStrings />
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
@ -17,6 +14,9 @@
|
||||
<setting name="LOG_ERRORS_ONLY" serializeAs="String">
|
||||
<value>False</value>
|
||||
</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>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
@ -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" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<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>
|
||||
<connectionStrings />
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
@ -17,6 +14,9 @@
|
||||
<setting name="LOG_ERRORS_ONLY" serializeAs="String">
|
||||
<value>False</value>
|
||||
</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>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
@ -1,78 +1,79 @@
|
||||
Public Class clsDatabase
|
||||
Private Shared connectionString As String
|
||||
|
||||
Public Shared Function Init()
|
||||
Try
|
||||
connectionString = My.Settings.MyConnectionString
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLconnect.Close()
|
||||
clsLogger.AddDetailLog("Database initialized")
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
clsLogger.Add("Unexpected Error in DatabaseInit: " & ex.Message, True)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function Return_Datatable(Select_anweisung As String)
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
SQLcommand.CommandText = Select_anweisung
|
||||
|
||||
Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(SQLcommand)
|
||||
Dim dt As DataTable = New DataTable()
|
||||
adapter1.Fill(dt)
|
||||
SQLconnect.Close()
|
||||
Return dt
|
||||
Catch ex As Exception
|
||||
clsLogger.Add("Unexpected Error in Return_Datatable: " & ex.Message, True)
|
||||
clsLogger.Add("SQL: " & Select_anweisung, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_non_Query(ExecuteCMD As String)
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = ExecuteCMD
|
||||
SQLcommand.ExecuteNonQuery()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
clsLogger.Add("Unexpected Error in Execute_non_Query: " & ex.Message, True)
|
||||
clsLogger.Add("SQL: " & ExecuteCMD, False)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_Scalar(cmdscalar As String)
|
||||
Dim result
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = cmdscalar
|
||||
result = SQLcommand.ExecuteScalar()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
Return result
|
||||
Catch ex As Exception
|
||||
clsLogger.Add("Unexpected Error Execute_Scalar: " & ex.Message, True)
|
||||
clsLogger.Add("SQL: " & cmdscalar, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
Public Class clsDatabase
|
||||
Private Shared connectionString As String
|
||||
|
||||
Public Shared Function Init()
|
||||
Try
|
||||
connectionString = My.Settings.MyConnectionString
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLconnect.Close()
|
||||
clsLogger.AddDetailLog("Database initialized")
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
clsLogger.Add("Unexpected Error in DatabaseInit: " & ex.Message, True)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function Return_Datatable(Select_anweisung As String)
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
SQLcommand.CommandText = Select_anweisung
|
||||
SQLcommand.CommandTimeout = 180
|
||||
|
||||
Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(SQLcommand)
|
||||
Dim dt As DataTable = New DataTable()
|
||||
adapter1.Fill(dt)
|
||||
SQLconnect.Close()
|
||||
Return dt
|
||||
Catch ex As Exception
|
||||
clsLogger.Add("Unexpected Error in Return_Datatable: " & ex.Message, True)
|
||||
clsLogger.Add("SQL: " & Select_anweisung, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_non_Query(ExecuteCMD As String)
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = ExecuteCMD
|
||||
SQLcommand.ExecuteNonQuery()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
clsLogger.Add("Unexpected Error in Execute_non_Query: " & ex.Message, True)
|
||||
clsLogger.Add("SQL: " & ExecuteCMD, False)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_Scalar(cmdscalar As String)
|
||||
Dim result
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = cmdscalar
|
||||
result = SQLcommand.ExecuteScalar()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
Return result
|
||||
Catch ex As Exception
|
||||
clsLogger.Add("Unexpected Error Execute_Scalar: " & ex.Message, True)
|
||||
clsLogger.Add("SQL: " & cmdscalar, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -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.xml
|
||||
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:\SchreiberM\Visual Studio\GIT\DDProxySync\DD_PROXY_SYNC\bin\Debug\DD_PROXY_SYNC.exe.config
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user