MS
This commit is contained in:
parent
cea9afcc22
commit
ed3f4a1cd2
@ -1,6 +1,42 @@
|
||||
<?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="ZSG_Import.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="ZSG_Import.My.MySettings.MyConnectionString" connectionString="Data Source=172.24.12.41\tests;Initial Catalog=DD_ECM_RENOLIT;User ID=sa;Password=dd" />
|
||||
</connectionStrings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
<applicationSettings>
|
||||
<ZSG_Import.My.MySettings>
|
||||
<setting name="LOG_ERRORS_ONLY" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="OBJEKTTYP" serializeAs="String">
|
||||
<value>ZSG-Geschäftsprozess</value>
|
||||
</setting>
|
||||
<setting name="IDX_Doctype" serializeAs="String">
|
||||
<value>sdsd</value>
|
||||
</setting>
|
||||
<setting name="IDX_RECORD_ID" serializeAs="String">
|
||||
<value>vktRecordID</value>
|
||||
</setting>
|
||||
<setting name="AD_DOMAIN" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="AD_SERVER" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="AD_USER" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="AD_USER_PW" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</ZSG_Import.My.MySettings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
4
app/ZSG_Import/CURRENT.vb
Normal file
4
app/ZSG_Import/CURRENT.vb
Normal file
@ -0,0 +1,4 @@
|
||||
Module CURRENT
|
||||
Public LOG_ERRORS_ONLY As Boolean = True
|
||||
Public CURRENT_FILEIN_WD As String
|
||||
End Module
|
||||
97
app/ZSG_Import/My Project/Settings.Designer.vb
generated
97
app/ZSG_Import/My Project/Settings.Designer.vb
generated
@ -1,10 +1,10 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.34209
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.34209
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
@ -15,14 +15,14 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
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 "My.Settings Auto-Save Functionality"
|
||||
#Region "Funktion zum automatischen Speichern von My.Settings"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
@ -53,6 +53,89 @@ Namespace My
|
||||
Return defaultInstance
|
||||
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=172.24.12.41\tests;Initial Catalog=DD_ECM_RENOLIT;User ID=sa;Password"& _
|
||||
"=dd")> _
|
||||
Public ReadOnly Property MyConnectionString() As String
|
||||
Get
|
||||
Return CType(Me("MyConnectionString"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
|
||||
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("ZSG-Geschäftsprozess")> _
|
||||
Public ReadOnly Property OBJEKTTYP() As String
|
||||
Get
|
||||
Return CType(Me("OBJEKTTYP"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("sdsd")> _
|
||||
Public ReadOnly Property IDX_Doctype() As String
|
||||
Get
|
||||
Return CType(Me("IDX_Doctype"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("vktRecordID")> _
|
||||
Public ReadOnly Property IDX_RECORD_ID() As String
|
||||
Get
|
||||
Return CType(Me("IDX_RECORD_ID"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
Public ReadOnly Property AD_DOMAIN() As String
|
||||
Get
|
||||
Return CType(Me("AD_DOMAIN"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
Public ReadOnly Property AD_SERVER() As String
|
||||
Get
|
||||
Return CType(Me("AD_SERVER"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
Public ReadOnly Property AD_USER() As String
|
||||
Get
|
||||
Return CType(Me("AD_USER"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
Public ReadOnly Property AD_USER_PW() As String
|
||||
Get
|
||||
Return CType(Me("AD_USER_PW"),String)
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
|
||||
@ -1,7 +1,37 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<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=172.24.12.41\tests;Initial Catalog=DD_ECM_RENOLIT;User ID=sa;Password=dd</ConnectionString>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=172.24.12.41\tests;Initial Catalog=DD_ECM_RENOLIT;User ID=sa;Password=dd</Value>
|
||||
</Setting>
|
||||
<Setting Name="LOG_ERRORS_ONLY" Type="System.Boolean" Scope="Application">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="OBJEKTTYP" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">ZSG-Geschäftsprozess</Value>
|
||||
</Setting>
|
||||
<Setting Name="IDX_Doctype" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">sdsd</Value>
|
||||
</Setting>
|
||||
<Setting Name="IDX_RECORD_ID" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">vktRecordID</Value>
|
||||
</Setting>
|
||||
<Setting Name="AD_DOMAIN" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="AD_SERVER" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="AD_USER" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="AD_USER_PW" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -1,7 +1,7 @@
|
||||
Imports System.ServiceProcess
|
||||
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class Service1
|
||||
Partial Class MyService
|
||||
Inherits System.ServiceProcess.ServiceBase
|
||||
|
||||
'UserService überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
||||
@ -28,7 +28,7 @@ Partial Class Service1
|
||||
'
|
||||
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
|
||||
'
|
||||
ServicesToRun = New System.ServiceProcess.ServiceBase() {New Service1}
|
||||
ServicesToRun = New System.ServiceProcess.ServiceBase() {New MyService}
|
||||
|
||||
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
|
||||
End Sub
|
||||
139
app/ZSG_Import/MyService.vb
Normal file
139
app/ZSG_Import/MyService.vb
Normal file
@ -0,0 +1,139 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
|
||||
Public Class MyService
|
||||
'Variablen
|
||||
Public Shared threadRunner As BackgroundWorker
|
||||
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.
|
||||
' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge
|
||||
' ausführen, damit der Dienst gestartet werden kann.
|
||||
Try
|
||||
clsLogger.Init(My.Application.Info.DirectoryPath & "\Log", "")
|
||||
clsLogger.Add("## ZSGImport 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
|
||||
LOG_ERRORS_ONLY = My.Settings.LOG_ERRORS_ONLY
|
||||
|
||||
'### Thread für das nachträgliche Setzen von Rechten generieren
|
||||
MyService.threadRunner = New BackgroundWorker()
|
||||
MyService.threadRunner.WorkerReportsProgress = True
|
||||
MyService.threadRunner.WorkerSupportsCancellation = True
|
||||
AddHandler threadRunner.DoWork, AddressOf RUN_THREAD
|
||||
AddHandler threadRunner.RunWorkerCompleted, AddressOf Thread1_Completed
|
||||
|
||||
' Und den Durchlauf das erste Mal starten
|
||||
threadRunner.RunWorkerAsync()
|
||||
End If
|
||||
End If
|
||||
clsLogger.WriteLog()
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError(ex.Message, "OnStart")
|
||||
clsLogger.WriteLog()
|
||||
End Try
|
||||
End Sub
|
||||
Public Shared Sub RUN_THREAD(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
|
||||
Try
|
||||
'erst einmal die Technischen Plätze bestimmen die noch nciht importiert wurden
|
||||
Dim DT_TP As DataTable = clsDatabase.Return_Datatable("SELECT DISTINCT [UNIQUE_STR] FROM [EXPORT_COMOS] where dokumentart is not null and imported = 0 and [UNIQUE_STR] LIKE '472%' order by [UNIQUE_STR]")
|
||||
Try
|
||||
If Not IsNothing(DT_TP) Then
|
||||
If DT_TP.Rows.Count > 0 Then
|
||||
clsLogger.Add(String.Format(">> {0} TPs need to be worked - {1}", DT_TP.Rows.Count.ToString, Now), False)
|
||||
'Jeden Technischen Platz einzeln durchlaufen weil für diesen ein Record existiert
|
||||
For Each TP As DataRow In DT_TP.Rows
|
||||
Dim _TP As String = TP.Item(0)
|
||||
clsLogger.AddDetailLog(String.Format(">> Working on technical place: '{0}'", _TP))
|
||||
Dim selrecid = String.Format("SELECT [Record-ID] FROM VWTEMP_PMO_FORM3 where UPPER(TPLNR) = UPPER('{0}')", _TP)
|
||||
Dim _RECORD_ID = clsDatabase.Execute_Scalar(selrecid)
|
||||
If Not IsNothing(_RECORD_ID) Then
|
||||
'Jede Datei einzeln durchlaufen
|
||||
Dim sel = String.Format("SELECT * FROM [EXPORT_COMOS] WHERE IMPORTED = 0 AND [UNIQUE_STR] = '{0}'", TP.Item("UNIQUE_STR"))
|
||||
Dim DT_TP_DOCS As DataTable = clsDatabase.Return_Datatable(sel)
|
||||
If Not IsNothing(DT_TP_DOCS) Then
|
||||
If DT_TP_DOCS.Rows.Count > 0 Then
|
||||
For Each _docRow As DataRow In DT_TP_DOCS.Rows
|
||||
Dim GUID = _docRow.Item("GUID")
|
||||
Dim filename = _docRow.Item("Link")
|
||||
If File.Exists(filename) Then
|
||||
|
||||
Else
|
||||
clsLogger.Add(String.Format(">> File not found: {0}", filename), False)
|
||||
Update_COMMENT_GUID(GUID, "FILE NOT FOUND")
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
clsLogger.Add(String.Format(">> No Record found for TP: {0}", _TP), False)
|
||||
Update_COMMENT(_TP, "NO RECORD-ID FOUND")
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
'DD_Rights.clsLogger.Init(My.Application.Info.DirectoryPath & "\Log", "")
|
||||
'If DD_Rights.ClassRights.Init_Service(LOG_ERRORS_ONLY, DT_RIGHTS_2b_WORKED.Rows.Count) Then
|
||||
' If DD_Rights.ClassRights.WORK_RIGHT2B_CHANGED(DT_RIGHTS_2b_WORKED) = True Then
|
||||
' clsLogger.Add(">> All rights were worked - " & Now, False)
|
||||
' End If
|
||||
'End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError("Uncexpected Error in working rights: " & ex.Message, "DT_RIGHTS_2b_WORKED")
|
||||
End Try
|
||||
|
||||
clsLogger.WriteLog()
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError("Uncexpected Error: " & ex.Message, "RUN_THREAD")
|
||||
End Try
|
||||
End Sub
|
||||
Private Shared Sub Update_COMMENT(UNIQUE_STR As String, comment As String)
|
||||
Try
|
||||
Dim upd = String.Format("UPDATE EXPORT_COMOS_472 SET COMMENT = '{0}' where UPPER(UNIQUE_STR) = UPPER('{1}') AND IMPORTED = 0")
|
||||
clsDatabase.Execute_non_Query(upd)
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError("Uncexpected Error in Update_COMMENT: " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
Private Shared Sub Update_COMMENT_GUID(GUID As Integer, comment As String)
|
||||
Try
|
||||
Dim upd = String.Format("UPDATE EXPORT_COMOS_472 SET COMMENT = '{0}' where GUID = {1}")
|
||||
clsDatabase.Execute_non_Query(upd)
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError("Uncexpected Error in Update_COMMENT_GUID: " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
Protected Overrides Sub OnStop()
|
||||
' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen.
|
||||
|
||||
clsLogger.Add("## ZSGImport Service was stopped manually - " & Now & " ## ", False)
|
||||
clsLogger.WriteLog()
|
||||
End Sub
|
||||
Private Shared Sub Thread1_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)
|
||||
clsLogger.WriteLog()
|
||||
ElseIf e.Error IsNot Nothing Then
|
||||
clsLogger.Add("Fehler bei Durchlauf. Der Vorgang wird abgebrochen.", True, "Thread_Completed")
|
||||
clsLogger.Add(e.Error.Message, True, "Thread_Completed")
|
||||
clsLogger.WriteLog()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
clsLogger.AddError(ex.Message, "Thread_Completed")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@ -1,12 +0,0 @@
|
||||
Public Class Service1
|
||||
|
||||
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.
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnStop()
|
||||
' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen.
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@ -6,7 +6,7 @@
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{4591D818-6F38-4FBB-918D-76259EBBD7C6}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>ZSG_Import.Service1</StartupObject>
|
||||
<StartupObject>ZSG_Import.MyService</StartupObject>
|
||||
<RootNamespace>ZSG_Import</RootNamespace>
|
||||
<AssemblyName>ZSG_Import</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@ -47,6 +47,18 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Interop.WINDREAMLib">
|
||||
<HintPath>..\..\lib\Interop.WINDREAMLib.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.WMOBRWSLib">
|
||||
<HintPath>..\..\lib\Interop.WMOBRWSLib.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.WMOTOOLLib">
|
||||
<HintPath>..\..\lib\Interop.WMOTOOLLib.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
@ -68,15 +80,19 @@
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="clsDatabase.vb" />
|
||||
<Compile Include="clsLogger.vb" />
|
||||
<Compile Include="clsWindream.vb" />
|
||||
<Compile Include="CURRENT.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Service1.vb">
|
||||
<Compile Include="MyService.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Service1.Designer.vb">
|
||||
<DependentUpon>Service1.vb</DependentUpon>
|
||||
<Compile Include="MyService.Designer.vb">
|
||||
<DependentUpon>MyService.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
|
||||
78
app/ZSG_Import/clsDatabase.vb
Normal file
78
app/ZSG_Import/clsDatabase.vb
Normal file
@ -0,0 +1,78 @@
|
||||
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 DDRightService 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, Optional Userinput As Boolean = False)
|
||||
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
|
||||
156
app/ZSG_Import/clsLogger.vb
Normal file
156
app/ZSG_Import/clsLogger.vb
Normal file
@ -0,0 +1,156 @@
|
||||
Imports System.IO
|
||||
|
||||
Public Class clsLogger
|
||||
Private Shared LogPath As String
|
||||
Private Shared LogFilename As String
|
||||
Private Shared logErr_name As String
|
||||
Private Shared log_string As String
|
||||
Public Shared Function Init(ByVal speicherort As String, ByVal prefix As String)
|
||||
Try
|
||||
'Den Speicherort festlegen
|
||||
SetSpeicherort()
|
||||
Dim logf_name As String = LogPath & "\" & prefix & System.DateTime.Now.ToString("yyyy_MM_dd") & ".txt"
|
||||
logErr_name = LogPath & "\" & "ErrorLog_" & System.DateTime.Now.ToString("yyyy_MM_dd") & ".txt"
|
||||
Dim anz As Integer = 1
|
||||
Do While File.Exists(logf_name)
|
||||
Dim info As New FileInfo(logf_name)
|
||||
Dim length As Long = info.Length
|
||||
If length > 5000000 Then
|
||||
logf_name = IO.Path.GetDirectoryName(logf_name)
|
||||
logf_name = logf_name & "\" & prefix & System.DateTime.Now.ToString("yyyy_MM_dd") & "(" & anz.ToString & ").txt"
|
||||
anz = anz + 1
|
||||
Else
|
||||
Exit Do
|
||||
End If
|
||||
Loop
|
||||
LogFilename = logf_name
|
||||
Try
|
||||
'Veruch das Log zu öffnen
|
||||
Dim fs As FileStream = New FileStream(LogFilename, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
' --- Stream öffnen
|
||||
Dim w As StreamWriter = New StreamWriter(fs)
|
||||
' --- Anfügen am Ende
|
||||
w.BaseStream.Seek(0, SeekOrigin.End)
|
||||
' --- Zeilen schreiben
|
||||
' --- Writer und Stream schließen
|
||||
w.Close()
|
||||
fs.Close()
|
||||
Catch ex As Exception
|
||||
LogEscalation_Error("The Logfile could not be created - Error: " & ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
'Alles Ok
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
LogEscalation_Error("Unexpected Error in init Logger - Error: " & ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
Private Shared Sub LogEscalation_Error(msg As String)
|
||||
Try
|
||||
'Veruch das Log zu öffnen
|
||||
Dim fs As FileStream = New FileStream(logErr_name, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
' --- Stream öffnen
|
||||
Dim w As StreamWriter = New StreamWriter(fs)
|
||||
' --- Anfügen am Ende
|
||||
w.BaseStream.Seek(0, SeekOrigin.End)
|
||||
' --- Zeilen schreiben
|
||||
w.WriteLine(msg)
|
||||
' --- Writer und Stream schließen
|
||||
w.Close()
|
||||
fs.Close()
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
' legt den Speicherort fest
|
||||
Public Shared Sub SetSpeicherort()
|
||||
Dim f As New IO.DirectoryInfo(My.Application.Info.DirectoryPath & "\Log")
|
||||
If f.Exists = False Then
|
||||
IO.Directory.CreateDirectory(My.Application.Info.DirectoryPath & "\Log")
|
||||
End If
|
||||
LogPath = My.Application.Info.DirectoryPath & "\Log\"
|
||||
End Sub
|
||||
Public Shared Sub Add(ByVal text As String, ByVal _error As Boolean, Optional ByVal Funktion As String = "")
|
||||
Dim msg As String
|
||||
If log_string <> "" Then
|
||||
log_string &= vbNewLine
|
||||
End If
|
||||
'Präfixe schreiben
|
||||
If _error = True And Funktion <> "" Then
|
||||
msg = ">> Attention Error in Funktion '" & Funktion & "'" & vbNewLine & "error-message: "
|
||||
ElseIf _error = True Then
|
||||
msg = ">> Attention Error:" & vbNewLine & "error-message: "
|
||||
End If
|
||||
'Präfix und Meldung zusammenstellen
|
||||
msg &= text
|
||||
log_string &= msg
|
||||
End Sub
|
||||
Public Shared Sub AddError(ByVal error_string As String, Optional ByVal Funktion As String = "")
|
||||
Try
|
||||
'Zuerst mal die Details schreiben
|
||||
WriteLog()
|
||||
'Nun den eigentlichen Fehler loggen
|
||||
Dim msg As String
|
||||
'Präfixe schreiben
|
||||
If Funktion <> "" Then
|
||||
msg = ">> Attention Error in function/Class '" & Funktion & "'" & vbNewLine & "error-message: "
|
||||
Else
|
||||
msg = ">> Attention Error:" & vbNewLine & "error-message: "
|
||||
End If
|
||||
'Präfix und Meldung zusammenstellen
|
||||
msg &= error_string
|
||||
'Veruch das Log zu öffnen
|
||||
Dim fs As FileStream = New FileStream(LogFilename, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
' --- Stream öffnen
|
||||
Dim w As StreamWriter = New StreamWriter(fs)
|
||||
' --- Anfügen am Ende
|
||||
w.BaseStream.Seek(0, SeekOrigin.End)
|
||||
' --- Zeilen schreiben
|
||||
w.WriteLine(msg)
|
||||
' --- Writer und Stream schließen
|
||||
w.Close()
|
||||
fs.Close()
|
||||
Catch ex As Exception
|
||||
LogEscalation_Error("Unexpected Error in AddError - Error: " & ex.Message)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Sub AddDetailLog(ByVal text As String)
|
||||
Try
|
||||
If LOG_ERRORS_ONLY = False Then
|
||||
If log_string <> "" Then
|
||||
log_string &= vbNewLine
|
||||
End If
|
||||
log_string &= " >> " & text
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LogEscalation_Error("Unexpected Error in AddDetailLog - Error: " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Shared Sub WriteLog()
|
||||
Try
|
||||
If log_string <> "" Then
|
||||
'Veruch das Log zu öffnen
|
||||
Dim fs As FileStream = New FileStream(LogFilename, FileMode.OpenOrCreate, FileAccess.Write)
|
||||
' --- Stream öffnen
|
||||
Dim w As StreamWriter = New StreamWriter(fs)
|
||||
' --- Anfügen am Ende
|
||||
w.BaseStream.Seek(0, SeekOrigin.End)
|
||||
' --- Zeilen schreiben
|
||||
w.WriteLine(log_string)
|
||||
' --- Writer und Stream schließen
|
||||
w.Close()
|
||||
fs.Close()
|
||||
SetSpeicherort()
|
||||
'Den Meldungsstring wieder leeren
|
||||
log_string = ""
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LogEscalation_Error("Unexpected Error in WriteLog - Error: " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
1690
app/ZSG_Import/clsWindream.vb
Normal file
1690
app/ZSG_Import/clsWindream.vb
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lib/Interop.WINDREAMLib.dll
Normal file
BIN
lib/Interop.WINDREAMLib.dll
Normal file
Binary file not shown.
BIN
lib/Interop.WMOBRWSLib.dll
Normal file
BIN
lib/Interop.WMOBRWSLib.dll
Normal file
Binary file not shown.
BIN
lib/Interop.WMOTOOLLib.dll
Normal file
BIN
lib/Interop.WMOTOOLLib.dll
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user