commit d9ddc61f1085ea4229ba3594289a396b8083fcfb Author: Digital Data - Marlon Schreiber Date: Wed Nov 1 13:54:33 2017 +0100 MS diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1bc915c --- /dev/null +++ b/.gitignore @@ -0,0 +1,156 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets +!packages/*/build/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..5ddea5d --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,7 @@ +{ + "ExpandedNodes": [ + "" + ], + "SelectedNode": "\\.gitignore", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..4ad3d83 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/app/DD_PM_Server.sln b/app/DD_PM_Server.sln new file mode 100644 index 0000000..c82e8f4 --- /dev/null +++ b/app/DD_PM_Server.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.9 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DD_PM_Server", "DD_PM_Server\DD_PM_Server.vbproj", "{7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + CD_ROM|x86 = CD_ROM|x86 + Debug|x86 = Debug|x86 + DVD-5|x86 = DVD-5|x86 + Release|x86 = Release|x86 + SingleImage|x86 = SingleImage|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.CD_ROM|x86.ActiveCfg = Release|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.CD_ROM|x86.Build.0 = Release|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.Debug|x86.ActiveCfg = Debug|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.Debug|x86.Build.0 = Debug|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.DVD-5|x86.ActiveCfg = Debug|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.DVD-5|x86.Build.0 = Debug|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.Release|x86.ActiveCfg = Release|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.Release|x86.Build.0 = Release|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.SingleImage|x86.ActiveCfg = Release|x86 + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9}.SingleImage|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/app/DD_PM_Server/ClassDatabase.vb b/app/DD_PM_Server/ClassDatabase.vb new file mode 100644 index 0000000..2811fab --- /dev/null +++ b/app/DD_PM_Server/ClassDatabase.vb @@ -0,0 +1,76 @@ +Imports System.Data.SqlClient + +Public Class ClassDatabase + Public Shared Function Execute_MSSQL(Sql As String) + Try + Dim Connection As SqlConnection + Connection = New SqlConnection(My.Settings.SQLConnection) + Dim Command As SqlCommand + Command = New SqlCommand(Sql, Connection) + ' Verbindung zur Datenbank aufbauen + Try + Connection.Open() + Catch ex As Exception + ClassLogger.Add("Fehler in Execute_MSSQL DB aufbauen - Fehler: " & ex.Message, False) + Connection.Close() + Return False + End Try + + ' SQL ausführen + Command.ExecuteNonQuery() + Connection.Close() + Return True + Catch ex As Exception + ' an dieser Stelle sollte jeder unvorhergesehene Fehler der Funktion abgefangen werden + ClassLogger.Add("Unbekannter Fehler in Execute_MSSQL - Fehler: " & ex.Message, False) + ClassLogger.Add("## SQL " & Sql, False) + Return False + End Try + End Function + Public Shared Function Execute_Scalar(Sql As String) + Try + Dim Connection As SqlConnection + Connection = New SqlConnection(My.Settings.SQLConnection) + Dim Command As SqlCommand + Command = New SqlCommand(Sql, Connection) + Dim result + ' Verbindung zur Datenbank aufbauen + Try + Connection.Open() + Catch ex As Exception + ClassLogger.Add("Fehler in Execute_MSSQL DB aufbauen - Fehler: " & ex.Message, False) + Connection.Close() + Return False + End Try + + 'SQL ausführen + result = Command.ExecuteScalar() + Connection.Close() + Return result + Catch ex As Exception + ' an dieser Stelle sollte jeder unvorhergesehene Fehler der Funktion abgefangen werden + ClassLogger.Add("Unbekannter Fehler in Execute_MSSQL - Fehler: " & ex.Message, False) + ClassLogger.Add("## SQL " & Sql, False) + Return False + End Try + End Function + Public Shared Function Return_Datatable(Sql As String) + Try + Dim Connection As SqlConnection + Connection = New SqlConnection(My.Settings.SQLConnection) + Dim Command As SqlCommand + Command = New SqlCommand(Sql, Connection) + + + Dim adapter1 As SqlDataAdapter = New SqlDataAdapter(Command) + Dim dt As DataTable = New DataTable() + adapter1.Fill(dt) + Connection.Close() + Return dt + Catch ex As Exception + ClassLogger.Add("Unbekannter Fehler in Return_Datatable - Fehler: " & ex.Message, False) + ClassLogger.Add("## SQL " & Sql, False) + Return Nothing + End Try + End Function +End Class diff --git a/app/DD_PM_Server/ClassEmail.vb b/app/DD_PM_Server/ClassEmail.vb new file mode 100644 index 0000000..038101c --- /dev/null +++ b/app/DD_PM_Server/ClassEmail.vb @@ -0,0 +1,94 @@ +Imports System.Net.Mail +Public Class ClassEmail + Public Sub Send_Error_Mail(ByVal vBody As String) + '#### E-MAIL NACHRICHT VERSENDEN + Try + Dim empfaenger As String() + If My.Settings.Email_Empfaenger <> "" Then + If My.Settings.Email_Empfaenger.Contains(";") Then + empfaenger = My.Settings.Email_Empfaenger.Split(";") + Else + ReDim Preserve empfaenger(0) + empfaenger(0) = My.Settings.Email_Empfaenger + End If + 'Für jeden Empfänger eine Neue Mail erzeugen + For Each _mailempfaenger As String In empfaenger + ' Neue Nachricht erzeugen: + Dim message As New MailMessage(My.Settings.Email_From, _mailempfaenger, My.Settings.Email_Betreff & " Domain: " & Environment.UserDomainName, _ + "" & My.Settings.Email_Body & vBody & "
>> Maschine: " & Environment.MachineName & "
" & "
>> Domain-Name: " & Environment.UserDomainName & "
" & _ + "
>> Gesendet am: " & My.Computer.Clock.LocalTime.ToShortDateString & "-" & _ + My.Computer.Clock.LocalTime.ToLongTimeString & "
") + ' create and add the attachment(s) */ + 'Dim logfile As String = ClassLogger.DateiSpeicherort & "\" & ClassLogger.DateiPrefix & System.DateTime.Now.ToString("yyyy_MM_dd") & ".txt" + 'If logfile.Contains("\\") Then + ' logfile = logfile.Replace("\\", "\") + 'End If + 'Dim Attachment As Attachment = New Attachment(logfile) + 'message.Attachments.Add(Attachment) + + With message + .IsBodyHtml = True + End With + + 'Einen SMTP Client erzeugen und Anmeldungsinformationen hinterlegen + Dim emailClient As New SmtpClient(My.Settings.Email_SMTP) + 'Email mit Authentifizierung + Dim SMTPUserInfo As New System.Net.NetworkCredential(My.Settings.Email_User, My.Settings.Email_PW) ', My.Settings.vDomain) + emailClient.UseDefaultCredentials = False + emailClient.Credentials = SMTPUserInfo + emailClient.Port = 25 + + '*Send the message */ + emailClient.Send(message) + ClassLogger.Add("==> Fehler Email erfolgreich an " & _mailempfaenger & " versendet!", False) + ClassLogger.Add("==> Text: " & vBody, False) + Next + End If + + Catch ex As Exception + ClassLogger.Add("### Fehler im Mailversand: " & ex.Message) + End Try + End Sub + Public Shared Function Send_Reminder_Mail(ByVal vBody As String, ByVal emailfrom As String, ByVal emailsmtp As String, ByVal emailuser As String, ByVal emailpw As String, ByVal email_empf As String, ByVal ReminderHeader As String, ByVal ReminderFooter As String) + '#### E-MAIL NACHRICHT VERSENDEN + Try + Dim empfaenger As String() + If email_empf.Contains(";") Then + empfaenger = email_empf.Split(";") + Else + ReDim Preserve empfaenger(0) + empfaenger(0) = email_empf + End If + 'Für jeden Empfänger eine Neue Mail erzeugen + For Each _mailempfaenger As String In empfaenger + ' Neue Nachricht erzeugen: + Dim message As New MailMessage(My.Settings.Email_From, _mailempfaenger, My.Settings.Email_ReminderBetreff, _ + "" & ReminderHeader & vBody & ReminderFooter & "

" & _ + "Starten Sie den Process-Manager " & "hier
" & _ + "

>> Gesendet am: " & My.Computer.Clock.LocalTime.ToShortDateString & "-" & _ + My.Computer.Clock.LocalTime.ToLongTimeString & "") + + With message + .IsBodyHtml = True + End With + + 'Einen SMTP Client erzeugen und Anmeldungsinformationen hinterlegen + Dim emailClient As New SmtpClient(emailsmtp) + 'Email mit Authentifizierung + Dim SMTPUserInfo As New System.Net.NetworkCredential(emailuser, emailpw) ', My.Settings.vDomain) + emailClient.UseDefaultCredentials = False + emailClient.Credentials = SMTPUserInfo + emailClient.Port = 25 + + '*Send the message */ + emailClient.Send(message) + ClassLogger.Add("==> Reminder Email erfolgreich an " & _mailempfaenger & " versendet!", False) + Next + Return True + Catch ex As Exception + ClassLogger.Add("### Fehler im Reminder-Mailversand: " & ex.Message) + Return False + End Try + End Function +End Class + diff --git a/app/DD_PM_Server/ClassLogger.vb b/app/DD_PM_Server/ClassLogger.vb new file mode 100644 index 0000000..4d96ca0 --- /dev/null +++ b/app/DD_PM_Server/ClassLogger.vb @@ -0,0 +1,205 @@ +Imports System.IO +Public Class ClassLogger + Public Shared DateiSpeicherort As String = Nothing + Public Shared DateiPrefix As String = "" + Private Shared Datei As IO.File = Nothing + Private Shared Dateiname As String = "" + Private Shared StreamWriter As IO.StreamWriter = Nothing + Private Shared HasInformedAboutError As Boolean = False + ' eine Art Konstruktor + Public Shared Sub Init(ByVal speicherort As String, Optional ByVal prefix As String = "", Optional ByVal appendFile As Boolean = True) + ' initialisiert den Speicherort + ClassLogger.SetSpeicherort(speicherort) + ' wenn ein Prfix gesetzt wurde + If Not prefix = "" Then + ' initialisiert das Prefix + ClassLogger.SetPrefix(prefix) + End If + Dim str As String = ClassLogger.DateiSpeicherort & "\" & ClassLogger.DateiPrefix & System.DateTime.Now.ToString("yyyy_MM_dd") & ".txt" + If str.Contains("\\") Then + str = str.Replace("\\", "\") + End If + Dim anz As Integer = 1 + Do While File.Exists(str) + Dim info As New FileInfo(str) + Dim length As Long = info.Length + If length > 5000000 Then + str = IO.Path.GetDirectoryName(str) + str = str & "\" & ClassLogger.DateiPrefix & System.DateTime.Now.ToString("yyyy_MM_dd") & "(" & anz.ToString & ").txt" + anz = anz + 1 + Else + Exit Do + End If + Loop + If str.Contains("\\") Then + str = str.Replace("\\", "\") + End If + ClassLogger.Dateiname = str + If Not appendFile Then + ' der Versuch die Datei zu löschen + 'Try + ' My.Computer.FileSystem.DeleteFile(ClassNILogger.Dateiname, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently) + 'Catch ex As Exception + ' ' bei Fehler besteht kein Schreibrecht auf die Datei oder Datei existiert nicht + ' ' ALSO: alles Okay soweit + 'End Try + My.Computer.FileSystem.WriteAllText(ClassLogger.Dateiname, String.Empty, False) + End If + ' testen ob sich die Datei öffnen und beschreiben lässt + 'ClassNILogger.CheckIsLogWritable() + End Sub + + ' legt den Speicherort fest + Public Shared Sub SetSpeicherort(ByVal speicherort As String) + Dim f As New IO.DirectoryInfo(My.Application.Info.DirectoryPath & "\Log") + If speicherort = "" Then + If f.Exists = False Then + IO.Directory.CreateDirectory(My.Application.Info.DirectoryPath & "\Log") + End If + ClassLogger.DateiSpeicherort = My.Application.Info.DirectoryPath & "\Log\" + Else + ClassLogger.DateiSpeicherort = speicherort + End If + End Sub + + ' legt das Prefix für den Dateinamen fest + Public Shared Sub SetPrefix(ByVal prefix As String) + ClassLogger.DateiPrefix = prefix + End Sub + + Public Shared Sub Add(ByVal information As String, Optional ByVal mit_prefix As Boolean = True) + If ClassLogger.OpenFile Then + Try + If mit_prefix Then + ClassLogger.StreamWriter.WriteLine("Nachricht (" & System.DateTime.Now & "): " & information) + Else + ClassLogger.StreamWriter.WriteLine(information) + End If + ClassLogger.CloseFile() + Catch e As Exception + ClassLogger.ShowErrorMessage() + End Try + Else + ClassLogger.ShowErrorMessage() + End If + End Sub + Public Shared Sub Add(ByVal ex As Exception) + If ClassLogger.OpenFile Then + Try + ClassLogger.StreamWriter.WriteLine("##### Exception (" & System.DateTime.Now & ")") + ClassLogger.StreamWriter.WriteLine("##### Fehler: " & ex.Message & " Source [" & ex.Source & "]") + ClassLogger.CloseFile() + Catch e As Exception + ClassLogger.ShowErrorMessage() + End Try + Else + ClassLogger.ShowErrorMessage() + End If + End Sub + ' öffnet eine Datei zum Schreiben + Private Shared Function OpenFile() + Try + ' wenn ein Speicherort festgelegt wurde + If Not ClassLogger.DateiSpeicherort = Nothing Then + ' den Dateienamen definieren + Dim dateiname As String = ClassLogger.Dateiname + ' Datei anlegen wenn noch nicht vorhanden + My.Computer.FileSystem.WriteAllText(dateiname, String.Empty, True) + ' die Datei zum Schreiben öffnen + ClassLogger.StreamWriter = New IO.StreamWriter(dateiname, True, System.Text.Encoding.UTF8) + End If + ' wenn die Datei erfolgreich geöffnet wurde + If ClassLogger.StreamWriter IsNot Nothing Then + Return True + Else + Return False + End If + Catch ex As Exception + Return False + End Try + + End Function + + ' öffnet eine Datei zum Schreiben + Private Shared Function OpenFile(ByVal DateiSpeicherort As String, ByVal DateiPrefix As String) + Try + ' wenn ein Speicherort festgelegt wurde + If Not DateiSpeicherort = Nothing And ClassLogger.CheckIsLogWritable() Then + ' den Dateienamen definieren + Dim dateiname As String = ClassLogger.Dateiname + ' Datei anlegen wenn noch nicht vorhanden + My.Computer.FileSystem.WriteAllText(dateiname, String.Empty, True) + ' die Datei zum Schreiben öffnen + ClassLogger.StreamWriter = New IO.StreamWriter(dateiname, True, System.Text.Encoding.UTF8) + End If + ' wenn die Datei erfolgreich geöffnet wurde + If ClassLogger.StreamWriter IsNot Nothing Then + Return True + Else + Return False + End If + + Catch ex As Exception + Return False + End Try + + End Function + + + ' schliesst die geöffnete Datei + Private Shared Sub CloseFile() + + ' wenn eine Datei geöffnet ist + If ClassLogger.StreamWriter IsNot Nothing Then + ' die Datei schliessen + ClassLogger.StreamWriter.Close() + ClassLogger.StreamWriter = Nothing + End If + End Sub + + + Public Shared Function CheckIsLogWritable() + + If ClassLogger.OpenFile Then + Try + ClassLogger.CloseFile() + Catch e As Exception + ClassLogger.ShowErrorMessage() + Return False + End Try + Else + ClassLogger.ShowErrorMessage() + Return False + End If + + Return True + End Function + + + Public Shared Function CheckIsLogWritable(ByVal vDateiSpeicherort As String, ByVal vDateiPrefix As String) + + If ClassLogger.OpenFile(vDateiSpeicherort, vDateiPrefix) Then + Try + ClassLogger.CloseFile() + Catch e As Exception + ClassLogger.ShowErrorMessage() + Return False + End Try + Else + ClassLogger.ShowErrorMessage() + Return False + End If + + Return True + End Function + + + Private Shared Sub ShowErrorMessage() + If Not ClassLogger.HasInformedAboutError Then + 'MsgBox("Beim Öffnen der Logdatei ist ein Fehler aufgetreten. Bitte stellen Sie sicher das Sie sowohl über entsprechende Schreibrechte im Verzeichnis, als auch über ausreichend Speicherplatz zum Speichern der Logdatei verfügen." & _ + ' vbNewLine & vbNewLine & "Es wird keine Logdatei angelegt oder beschrieben." & vbNewLine & vbNewLine & "Im folgenden werden Sie über Fehler, den Log betreffend nicht weiter informiert, um den Ablauf von " & My.Application.Info.ProductName & " nicht zu stören.", _ + ' MsgBoxStyle.Information, "Fehler beim Öffnen der Logdatei") + ClassLogger.HasInformedAboutError = True + End If + End Sub +End Class diff --git a/app/DD_PM_Server/ClassPMWindream.vb b/app/DD_PM_Server/ClassPMWindream.vb new file mode 100644 index 0000000..3d5467f --- /dev/null +++ b/app/DD_PM_Server/ClassPMWindream.vb @@ -0,0 +1,188 @@ +Imports WINDREAMLib +Imports WMOSRCHLib +Public Class ClassPMWindream + Inherits ClassWindream_allgemein + Private email As New ClassEmail + +#Region "+++++ Konstanten +++++" + Protected Const WMObjectEditModeObject = &H1F + Protected Const WMObjectStreamOpenModeReadWrite = 2 + Protected Const WMEntityObjectType = 10 + Protected Const WMEntityDocument = 1 + + Const WMObjectVariableValueTypeUndefined = 0 + Const WMObjectVariableValueTypeString = 1 + Const WMObjectVariableValueTypeInteger = 2 + Const WMObjectVariableValueTypeFloat = 3 + Const WMObjectVariableValueTypeBoolean = 4 + Const WMObjectVariableValueTypeDate = 5 + Const WMObjectVariableValueTypeFixedPoint = 6 + Const WMObjectVariableValueTypeTimeStamp = 7 + Const WMObjectVariableValueTypeCurrency = 8 + Const WMObjectVariableValueTypeTime = 9 + Const WMObjectVariableValueTypeVariant = 10 + Const WMObjectVariableValueTypeMask = &HFFF + Const WMObjectVariableValueFlagMask = &HFFFFF000 + Const WMObjectVariableValueTypeVector = &H1000 + Const WMObjectVariableValueTypeFulltext = &H2000 + Const WMObjectVariableValueTypeDefaultValue = &H4000 +#End Region + +#Region "+++++ Variablen +++++" + Private oController As New WMOSearchController +#End Region + +#Region "+++++ Allgemeine Methoden und Funktionen +++++" + Sub New() + MyBase.New() + End Sub + Private Function IsNotEmpty(ByVal aValue As Object) + + If aValue IsNot Nothing Then + Dim itsType As Type = aValue.GetType + If itsType Is GetType(String) Then + + If Not aValue = "" Then + Return True + End If + + Return False + Else + Return True + End If + Else + Return False + End If + + End Function + Private Function return_type(ByVal _wert As Object) + Return _wert.GetType + End Function + + +#End Region + + +#Region "+++++ Allgemeine Funktionen die Informationen zurückliefern +++++" + + Public Function Get_No_Documents(Profil As String, WD_Search As String) + Try + + If System.IO.File.Exists(WD_Search) = False Then + ClassLogger.Add(">> Windream Suche für Profil: '" & Profil & "' konnte nicht ausgeführt werden! Die Datei '" & WD_Search & "' existiert nicht!", False) + 'MsgBox("Windream Suche für Profil: '" & Profil & "' konnte nicht ausgeführt werden!" & vbNewLine & "Die Datei '" & WD_Search & "' existiert nicht!", MsgBoxStyle.Exclamation, "Achtung:") + 'wenn die gesuchte File eine Suche ist: per Mail informierne und Indexierung abbrechen + If My.Settings.Email_senden = True Then + email.Send_Error_Mail("Fehler in Get_No_Documents:
>> Profil: '" & Profil & "'
>> die windream-Suche : " & WD_Search & " konnte nicht gefunden werden!" & _ + "
>> Mögliche Fehlerursache: Das " & My.Settings.WD_LW & "-Laufwerk ist nicht verfügbar!") + End If + Return 0 + Else + ' windream-Suche für Profil starten + Dim windreamSucheErgebnisse As WMObjects = Me.GetSearchDocuments(WD_Search) + + If windreamSucheErgebnisse.Count > 0 Then + ' neue Anzahl von Dateien + Return windreamSucheErgebnisse.Count + Else + ' keine Dateien zum Importieren + Return 0 + End If + End If + Catch ex As Exception + ClassLogger.Add("Achtung: Fehler in Get_No_Documents: " & ex.Message) + Return 0 + End Try + + End Function + + Public Function GetSearchDocuments(ByVal wdfLocation As String) + + If System.IO.File.Exists(wdfLocation) Then + Dim Marker As String + Try + Dim ProfileName = wdfLocation.Substring(wdfLocation.LastIndexOf("\") + 1) + Marker = "ProfileName: " & ProfileName + Dim ProfilePath = wdfLocation.Substring(0, wdfLocation.Length - ProfileName.Length) + Marker &= "ProfilePath: " & ProfilePath + Me.oController.CheckSearchProfile(wdfLocation.ToLower) + Dim suchTyp = Me.oController.SearchProfileTargetProgID + Dim ExSettings As Object + Dim oSearch As Object + ExSettings = Me.oController.SearchProfileExSettings + If ExSettings = 0 Then ExSettings = 7 + Dim srchQuick As WMOSRCHLib.WMQuickSearch = CreateObject("WMOSrch.WMQuickSearch") + Dim srchIndex As WMOSRCHLib.WMIndexSearch = CreateObject("WMOSrch.WMIndexSearch") + Dim srchObjectType As WMOSRCHLib.WMObjectTypeSearch = CreateObject("WMOSrch.WMObjectTypeSearch") + Marker &= "SuchTyp: " & suchTyp.ToString.ToUpper + Select Case suchTyp.ToString.ToUpper + Case "WMOSRCH.WMQUICKSEARCH" + srchQuick.WMSession = CreateObject("Windream.WMSession", Me.GetCurrentServer) + Marker &= "Session Created" + Me.oConnect.LoginSession(srchQuick.WMSession) + Marker &= "login erfolgreich" + srchQuick.ClearSearch() + srchQuick.SearchProfilePath = ProfilePath + srchQuick.LoadSearchProfile(ProfileName) + Marker &= "Parameter / Profile geladen" + oSearch = srchQuick.GetSearch() + Marker &= "oSearch geladen" + Case "WMOSRCH.WMINDEXSEARCH" + srchIndex.WMSession = CreateObject("Windream.WMSession", Me.GetCurrentServer) + Marker &= "Session Created" + Me.oConnect.LoginSession(srchIndex.WMSession) + Marker &= "login erfolgreich" + srchIndex.ClearSearch() + srchIndex.SearchProfilePath = ProfilePath + srchIndex.LoadSearchProfile(ProfileName) + Marker &= "Parameter / Profile geladen" + oSearch = srchIndex.GetSearch() + Marker &= "oSearch geladen" + Case "WMOSRCH.WMOBJECTTYPESEARCH" + srchObjectType.WMSession = CreateObject("Windream.WMSession", Me.GetCurrentServer) + Marker &= "Session Created" + Me.oConnect.LoginSession(srchObjectType.WMSession) + Marker &= "login erfolgreich" + srchObjectType.ClearSearch() + srchObjectType.SearchProfilePath = ProfilePath + srchObjectType.LoadSearchProfile(ProfileName) + Marker &= "Parameter / Profile geladen" + oSearch = srchObjectType.GetSearch() + Marker &= "oSearch geladen" + Case Else + ClassLogger.Add("KEIN GÜLTIGER WINDREAM-SUCHTYP") + Return Nothing + End Select + Return oSearch.execute + + Catch ex As Exception + ' bei einem Fehler einen Eintrag in der Logdatei machen + ClassLogger.Add("Unvorhergesehener Fehler in Klasse PMWindream - GetSearchDocuments - " & ex.Message, True) + ClassLogger.Add("Bisheriger Marker: " & Marker, False) + Return Nothing + End Try + Else + ClassLogger.Add("Achtung: windream-Suche '" & wdfLocation & "' existiert nicht!", False) + End If + + Return Nothing + + End Function + ''' Liefert den Wert eines Indexes als String + ''' _indexname = Name des zu überprüfenden Indexfeldes + Public Function GetValueforIndex(ByVal _fullfilepath As String, _indexname As String) + Try + Const WMEntityDocument = 1 + Dim IndexwertAusWindream As Object = Nothing + Dim _dok As WINDREAMLib.WMObject + _dok = Nothing + _dok = oSession.GetWMObjectByPath(WMEntityDocument, _fullfilepath) 'WINDREAMLib.WMEntity.WMEntityDocument + IndexwertAusWindream = _dok.GetVariableValue(_indexname) + Return IndexwertAusWindream.ToString + Catch ex As Exception + 'MsgBox(ex.Message) + Return Nothing + End Try + End Function +#End Region +End Class diff --git a/app/DD_PM_Server/ClassWindream_allgemein.vb b/app/DD_PM_Server/ClassWindream_allgemein.vb new file mode 100644 index 0000000..35df333 --- /dev/null +++ b/app/DD_PM_Server/ClassWindream_allgemein.vb @@ -0,0 +1,321 @@ +Imports WINDREAMLib +Imports WINDREAMLib.WMCOMEvent +Imports WINDREAMLib.WMEntity +Imports WINDREAMLib.WMObjectEditMode +Imports WINDREAMLib.WMSearchOperator +Imports WINDREAMLib.WMSearchRelation +Imports WMOBRWSLib + +Public Class ClassWindream_allgemein + +#Region "+++++ Konstanten +++++" + Const DEBUG = AUS + Const AUS = 0 + Const WINDREAM = 1 + Const VARIABLEN = 2 +#End Region + +#Region "+++++ Variablen +++++" + Public oConnect ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht) + Public oSession 'As WINDREAMLib.WMSession ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht) + Public oBrowser As New WMOBRWSLib.ServerBrowser + Public oDokumentTypen As WINDREAMLib.WMObjects +#End Region + + +#Region "+++++ Allgemeine Methoden und Funktionen +++++" + + '''

+ ''' Konstruktor für die windream-Klasse + ''' + ''' + Sub New() + ' wenn ein Fehler bei der Initialisierung auftrat + If Not Me.Init() Then + ' Nachricht ausgeben + ClassLogger.Add("Achtung Es trat ein Fehler bei der Initialisierung der Klasse windream auf. Bitte prüfen Sie ob der windream-Server aktiv ist und alle Dienste gestartet sind.", True) + ' das Programm "abschießen" + Process.GetCurrentProcess.Kill() + End If + End Sub + + + ''' + ''' Initialisiert die statische Klasse (Login, Session starten, usw.) + ''' + ''' Liefert True wenn das Anmelden erfolgreich war, sonst False + ''' + Public Function Init() As Boolean + + Try + + Try + ' Session-Objekt instanziieren und mit dem im Client ausgewählten Server belegen + Me.oSession = CreateObject("Windream.WMSession", Me.GetCurrentServer) + ' Connection-Objekt instanziieren + Me.oConnect = CreateObject("Windream.WMConnect") + 'MsgBox("windrem init 'ed") + Catch ex As Exception + Return False + End Try + + + ' wenn windream nicht angemeldet ist + If Not Me.IsLoggedIn Then + + ' Art der Anmeldung an windream festlegen + ' 0x0L (also 0) = Standard windream Benutzer + ' WM_MODULE_ID_DOCTYPEEDITOR_LIC = ermöglicht Zugriff auf die windream Management Funktionen (Z.B. zur Verwaltung der windream Dokumententypen, Auswahllisten, etc.) + ' WM_MODULE_ID_INDEXSERVICE = ermöglicht der Session die Indexierungs-Events vom windream DMS-Service zu empfangen + Me.oConnect.ModuleID = 0 + + ' setzt die minimal erwartete windream-Version + Me.oConnect.MinReqVersion = "3" + + + ' -- Impersonifizierung nur möglich mit registry-eintrag -- + ' oConnect.UserName "\schulung\windream" + ' oConnect.Password "windream" + + ' Verbindung mit Session-Objekt (und dem ausgewählten Server) aufbauen + Me.oConnect.LoginSession(Me.oSession) + + If Me.oSession.aLoggedin = False Then + ClassLogger.Add("Achtung: Es konnte keine Verbindung mit dem windream-Server hergestellt werden", True) + Return False + End If + + ' AUSGABE VON SYSTEMINFORMATIONEN + ' Gibt die Versionsart (Lizenztyp) also Small-Business-Edition (SBE), Small-Business-Extension (SBX) + ' oder Business-Edition (BE) aus + 'MsgBox("WindreamVersion: " & oSession.GetSystemInfo("WindreamVersion") & vbNewLine & "LicenceKey: " & oSession.GetSystemInfo("LicenceKey") & vbNewLine & _ + ' vbNewLine & "LicenceName: " & oSession.GetSystemInfo("LicenceName")) + + 'Dim WMCtrl As AISCONTROLDATACOMLib.AISControlData + 'WMCtrl = New AISCONTROLDATACOMLib.AISControlData + + '' liefert die Versionsnummer des Clients + 'MsgBox(WMCtrl.WMWorkstationBuildNo) + 'MsgBox(WMCtrl.W + '' liefert den Servernamen des angemeldeten windreams + 'MsgBox(WMCtrl.WMServerName) + + Try + Me.oSession.SwitchEvents(WMCOMEventWMSessionNeedIndex, False) + ' der Parameter WMEntityDocument definiert, dass nur Dokumenttypen und keine + ' Ordnertypen ausgelesen werden + Me.oDokumentTypen = Me.oSession.GetWMObjectTypes(WINDREAMLib.WMEntity.WMEntityDocument) + Catch ex As Exception + Return False + End Try + + End If + + Return True + + Catch ex As Exception + ClassLogger.Add("Achtung Fehler beim Login an windream - Evtl. Keine Verbindung zu windream: " & ex.Message, True) + 'If Err.Number = -2147220985 Then + ' ClassLogger.Add("Achtung Fehler beim Login an windream - Keine Verbindung zu windream: " & ex.Message, True) + ' MsgBox("Die installierte windream-Version ist nicht ausreichend für den Betrieb der Tool Collection für windream." & vbNewLine & _ + ' "Bitte kontaktieren Sie Digital Data." & vbNewLine & vbNewLine & "Fehlernachricht:" & vbNewLine & Err.Description, MsgBoxStyle.Exclamation, "Unzureichende windream-Version") + 'Else + ' ClassLogger.Add("Achtung Fehler beim Login an windream - Keine Verbindung zu windream: " & ex.Message, True) + 'End If + Return False + End Try + + End Function + +#End Region + + + +#Region "+++++ Funktionen die für den Objekttyp relevate Informationen zurückliefern +++++" + + ''' + ''' Liefert alle Indexe eines Objekttypen. + ''' + ''' Name des Objekttyps + ''' Array mit allen Objekttyp zugeordneten Indexen als String + ''' + Public Function GetIndicesByObjecttype(ByVal name As String) As String() + Try + Dim oObjectType As WMObject + Dim oIndexAttributes As WMObjectRelation + Dim oIndexAttribute As WMObject + Dim oIndex As WMObject + Dim oRelProperties As WMObjectRelationClass + + ' den Objekttyp laden + oObjectType = Me.oSession.GetWMObjectByName(WMEntityObjectType, name) + + ' Beziehung zu Indizes des Objekttyp auslesen + oIndexAttributes = oObjectType.GetWMObjectRelationByName("TypeAttributes") + + ' Array für Indizes vorbereiten + Dim aIndexNames(oIndexAttributes.Count - 1) As String + + ' alle Indizes durchlaufen + For j As Integer = 0 To oIndexAttributes.Count - 1 + + ' aktuellen Index auslesen + oIndexAttribute = oIndexAttributes.Item(j) + + ' Eigenschaften des Index auslesen + oRelProperties = oIndexAttribute.GetWMObjectRelationByName("Attribute") + + ' Index aus den Eigenschaften auslesen + oIndex = oRelProperties.Item(0) + + ' Indexname speichern + aIndexNames(j) = oIndex.aName + Next + + ' Indexarray zurückgeben + Return aIndexNames + + Catch ex As Exception + ClassLogger.Add("Achtung: Fehler beim Auslesen der windream-Indexe: " & ex.Message) + Return Nothing + End Try + End Function + ''' + ''' Liefert einen Objekttyp als WMObject an Hand dessen Name. + ''' + ''' Name des Objekttyps + ''' Objekttyp als WMObject + ''' + Public Function GetObjecttypeByName(ByVal objekttypName As String) As WMObject + Try + ' alle Objekttypen auslesen + Dim oObjectTypes As WMObjects = Me.oSession.GetWMObjectTypes(WINDREAMLib.WMEntity.WMEntityDocument) + + ' alle Objekttypen durchlaufen und nach dem mit dem angegebenen Namen suchen + For Each oObjectType As WMObject In oObjectTypes + If oObjectType.aName = objekttypName Then + Return oObjectType + End If + Next + + Return Nothing + + Catch ex As Exception + ClassLogger.Add("Achtung: Fehler in GetObjecttypeByName: " & ex.Message) + Return Nothing + End Try + End Function + + ''' + ''' Überprüft ob der angegebene Index im Objekttyp existiert + ''' + ''' Name des zu durchsuchenden Objekttyps + ''' Name des zu suchenden Indexes + ''' Liefert True wenn der Index im Objekttyp existiert, sonst False + ''' + Public Function ExistIndexInObjekttyp(ByVal objekttyp As String, ByVal indexname As String) As Boolean + Try + Dim indexnamen() As String = Me.GetIndicesByObjecttype(objekttyp) + + If indexnamen Is Nothing Then Return False + + For Each index As String In indexnamen + If index = indexname Then Return True + Next + + Catch ex As Exception + ClassLogger.Add("Achtung: Fehler in ExistIndexInObjekttyp: " & ex.Message) + End Try + + Return False + + End Function + +#End Region + + + +#Region "+++++ Allgemeine Funktionen die Informationen zurückliefern +++++" + + ''' + ''' Liefert True wenn die windream-Session angemeldet ist und False für den Fall, dass die Session nicht eingeloggt ist. + ''' + ''' Anmeldestatus als Boolean + ''' + Public Function IsLoggedIn() As Boolean + Try + Return Me.oSession.aLoggedin + Catch ex As Exception + ClassLogger.Add("Achtung: Fehler in IsLoggedIn: " & ex.Message) + End Try + + Return False + End Function + + ''' + ''' Liefert den Servernamen an dem windream aktuell angemeldet ist. + ''' + ''' Servername als String + ''' + Public Function GetCurrentServer() As String + Try + Return Me.oBrowser.GetCurrentServer 'ClassWindream.oBrowser.GetCurrentServer + Catch ex As Exception + ClassLogger.Add("Achtung: Fehler in GetCurrentServer: " & ex.Message) + End Try + + Return "" + End Function + + 'Public Function GetSharedCurrentServer() As String + ' Try + ' Return ClassWindream.oBrowser.GetCurrentServer + ' Catch ex As Exception + ' MsgBox("Der aktuell gewählte windream-Server konnte nicht ausgelesen werden." & vbNewLine & vbNewLine & "Fehlernachricht:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Fehler beim Auslesen des windream-Servers") + ' End Try + + ' Return "" + 'End Function + + + ''' + ''' Liefert das Windream-Laufwerk des windream-Servers, in Form '[Laufwerksbuchstabe]:'. (z.B. 'W:') + ''' + ''' Laufwerksbuchstabe mit Doppelpunkt als String + ''' + 'Public Function GetWindreamDriveLetter() As String + + ' Try + ' Dim oControl As AISCONTROLDATACOMLib.AISControlData + ' Dim sDrive As String = "" + + ' oControl = New AISCONTROLDATACOMLib.AISControlData + + ' sDrive = oControl.GetStringValue(&H10040003) + + ' Return sDrive & ":" + + ' Catch ex As Exception + ' MsgBox("Fehlernachricht: " & ex.Message, MsgBoxStyle.Critical, "Fehler beim Auslesen des windream-Laufwerks") + ' End Try + + ' Return "" + 'End Function + + ''' + ''' Liefert den Typen eines Indexes als Integer. + ''' + ''' Name des zu überprüfenden Indexfeldes + ''' Liefert eine Zahl, die einen Typen beschreibt + ''' + Public Function GetTypeOfIndexAsIntByName(ByVal indexname As String) As Integer + Try + Dim oAttribute = Me.oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname) + Dim vType = oAttribute.getVariableValue("dwAttrType") + Return vType + Catch ex As Exception + Return Nothing + End Try + End Function +#End Region +End Class diff --git a/app/DD_PM_Server/DD_PM_Server.vbproj b/app/DD_PM_Server/DD_PM_Server.vbproj new file mode 100644 index 0000000..bf478a0 --- /dev/null +++ b/app/DD_PM_Server/DD_PM_Server.vbproj @@ -0,0 +1,138 @@ + + + + Debug + x86 + + + + + {7ED90CF1-7B5B-403A-A138-7CCB9F8963E9} + Exe + DD_PM_Server.Modul_Main + DD_PM_Server + DD_PM_Server + 512 + Console + v4.0 + Client + + + x86 + true + full + true + true + bin\Debug\ + DD_PM_Server.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + x86 + pdbonly + false + true + true + bin\Release\ + DD_PM_Server.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + ..\..\..\..\..\DLL\windreamDLL\Interop.WINDREAMLib.dll + False + + + P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMOBRWSLib.dll + True + + + P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMOSRCHLib.dll + True + + + P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMOTOOLLib.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + \ No newline at end of file diff --git a/app/DD_PM_Server/Modul_Main.vb b/app/DD_PM_Server/Modul_Main.vb new file mode 100644 index 0000000..f9a3dab --- /dev/null +++ b/app/DD_PM_Server/Modul_Main.vb @@ -0,0 +1,306 @@ +Imports System.Data.SqlClient +Imports WINDREAMLib +Imports System.Globalization +Module Modul_Main + Public vIntervall As Integer + Private _windreamPM As ClassPMWindream + Private _wdDokument As WMObject + Private email As New ClassEmail + Private email_Reminder As Boolean + Private email_from, email_user, email_pw, email_smtp, Reminder_Head, Reminder_Footer As String + + Sub Main() + Try + ClassLogger.Init("", "logPM_Server", True) + ClassLogger.Add(" ######## ProcessManager - Server gestartet - " & Now, False) + Catch ex As System.Exception + 'MsgBox("Fehler bei Log Create: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") + End Try + Try + ' Windream instanziieren + _windreamPM = New ClassPMWindream() + 'Windream initialisieren (Connection, Session, ... aufbauen) + _windreamPM.Init() + ClassLogger.Add(" >> windream initialisiert", False) + Catch ex As Exception + ClassLogger.Add("Fehler in windream-Init: " & ex.Message, True) + If My.Settings.Email_senden = True Then + email.Send_Error_Mail("Fehler in windream-Init (Modul main):
>> Fehlermeldung:
" & ex.Message) + End If + End Try + Load_Konfig() + Check_Profiles() + Send_Reminder() + End Sub + Sub Run_Timer_Refresh_Files() + ClassLogger.Add(">> Timer Refresh_Files gestartet!", False) + Check_Profiles() + End Sub + Sub Send_Reminder() + Try + If email_Reminder = True Then + Dim list As New List(Of Integer) + list.Add(8) + list.Add(9) + list.Add(10) + list.Add(12) + list.Add(14) + list.Add(16) + list.Add(18) + Dim hour As Integer = My.Computer.Clock.LocalTime.Hour + Dim start As Boolean = False + Dim i As Integer + For i = 0 To list.Count - 1 + If list.Item(i) = hour Then + start = True + End If + Next i + 'Wenn diese Stunde eine Email versendet werden soll + If start = True Then + Dim DT As DataTable = ClassDatabase.Return_Datatable("Select * from VWPM_EMAIL_PROFIL where ANZ_FILES > 0") + If DT Is Nothing = False Then + If DT.Rows.Count > 0 Then + For Each Row As DataRow In DT.Rows + 'If Row.Item("LAST_HOUR") = 0 Then + If Row.Item("LAST_HOUR") <> hour Then + If CBool(Row.Item("EMAIL_ONCE_DAY")) = True Then + If hour = 12 Then + Dim Body As String = "- Profilnam: '" & Row.Item("PROFIL_TITLE") & "' - Anzahl der Dokumente: " & Row.Item("ANZ_FILES") + If ClassEmail.Send_Reminder_Mail(Body, email_from, email_smtp, email_user, email_pw, Row.Item("EMAIL"), Reminder_Head, Reminder_Footer) = True Then + ClassDatabase.Execute_MSSQL("UPDATE TBPM_USER SET LAST_EMAIL_SEND = " & hour & " WHERE GUID = " & Row.Item("USER_ID")) + End If + End If + Else + Dim Body As String = "- Profilnam: '" & Row.Item("PROFIL_TITLE") & "' - Anzahl der Dokumente: " & Row.Item("ANZ_FILES") + If ClassEmail.Send_Reminder_Mail(Body, email_from, email_smtp, email_user, email_pw, Row.Item("EMAIL"), Reminder_Head, Reminder_Footer) = True Then + ClassDatabase.Execute_MSSQL("UPDATE TBPM_USER SET LAST_EMAIL_SEND = " & hour & " WHERE GUID = " & Row.Item("USER_ID")) + End If + End If + + End If + 'End If + Next + End If + End If + End If + End If + + + + Catch ex As Exception + ClassLogger.Add("###Fehler in Send_Reminder: " & ex.Message) + If My.Settings.Email_senden = True Then + email.Send_Error_Mail("Fehler in Send_Reminder (Modul main):
>> Fehlermeldung:
" & ex.Message) + End If + End Try + End Sub + Sub Load_Konfig() + Try + Dim myConnection As SqlConnection + myConnection = New SqlConnection(My.Settings.SQLConnection) + Dim mySQLcommand As SqlCommand + mySQLcommand = New SqlCommand("SELECT * FROM TBPM_KONFIGURATION WHERE GUID = 1", myConnection) + + ' mySQLcommand.CommandText = "SELECT * FROM TBPM_KONFIGURATION WHERE GUID = 1" + Try + myConnection.Open() + Catch ex As Exception + ClassLogger.Add("Fehler in Load_Konfig DB aufbauen - Fehler: " & ex.Message, False) + ClassLogger.Add("Prüfen Sie die Anwendungsdatei-Angaben für die Connection", False) + myConnection.Close() + Exit Sub + End Try + Dim adapter1 As SqlDataAdapter = New SqlDataAdapter(mySQLcommand) + Dim dt As DataTable = New DataTable() + adapter1.Fill(dt) + + If dt.Rows.Count = 1 Then + Dim Konfig_Row As System.Data.DataRow + '---------------------- für jedes Profil die Dateien überprüfen ------------------------ + For Each Konfig_Row In dt.Rows + If CBool(Konfig_Row.Item("EMAIL_ACTIVE")) = True Then + email_Reminder = CBool(Konfig_Row.Item("EMAIL_ACTIVE")) + email_from = Konfig_Row.Item("EMAIL_FROM") + email_user = Konfig_Row.Item("EMAIL_USER") + email_pw = Konfig_Row.Item("EMAIL_PW") + email_smtp = Konfig_Row.Item("EMAIL_SMTP") + Reminder_Head = Konfig_Row.Item("EMAIL_REMINDER_HEADER") + Reminder_Footer = Konfig_Row.Item("EMAIL_REMINDER_FOOTER") + Else + email_Reminder = False + End If + Next + End If + Catch ex As Exception + ClassLogger.Add("###Fehler in Load_Konfig: " & ex.Message) + If My.Settings.Email_senden = True Then + email.Send_Error_Mail("Fehler in Load_Konfig (Modul main):
>> Fehlermeldung:
" & ex.Message) + End If + End Try + End Sub + Sub Check_Profiles() + Dim stp As String + ' windream-Suche für Profil starten + _windreamPM = New ClassPMWindream() + stp = 1 + Try + ClassLogger.Add(" >> Check_Profiles gestartet", False) + Dim WD_Search As String + Dim myConnection As SqlConnection + stp = 2 + myConnection = New SqlConnection(My.Settings.SQLConnection) + stp = 3 + Dim mySQLcommand As SqlCommand + mySQLcommand = New SqlCommand("SELECT GUID,NAME,WD_OBJECTTYPE,WD_SEARCH FROM TBPM_PROFILE WHERE ACTIVE = 1", myConnection) + stp = 4 + mySQLcommand.CommandText = "SELECT GUID,NAME,WD_OBJECTTYPE,WD_SEARCH FROM TBPM_PROFILE WHERE ACTIVE = 1" + stp = 5 + Try + myConnection.Open() + Catch ex As Exception + ClassLogger.Add("Fehler in Check_Profiles DB aufbauen - Fehler: " & ex.Message, False) + myConnection.Close() + Exit Sub + End Try + stp = 6 + Dim adapter1 As SqlDataAdapter = New SqlDataAdapter(mySQLcommand) + stp = 7 + Dim dt As DataTable = New DataTable() + stp = 8 + adapter1.Fill(dt) + stp = 9 + + Console.WriteLine(">> Evtl alte nicht aktualisierte PROFILE-FILE Daten werden gelöscht") + '---------------------- Evtl alte nicht aktualisierte PROFILE-FILE Daten werden gelöscht ------------------------ + Dim delete As String = "DELETE FROM TBPM_PROFILE_FILES WHERE ACTIVE = 0 AND IN_WORK = 0" + ClassDatabase.Execute_MSSQL(delete) + + Dim sel4 = "select count(*) from TBPM_PROFILE_FILES" + Dim EMPTYTABLE = ClassDatabase.Execute_Scalar(sel4) + If EMPTYTABLE = 0 Then + ClassLogger.Add(">> Tabelle ist noch komplett leer", False) + End If + 'delete = "DELETE FROM TBPM_PROFILE_FILES_TEMP" + 'ClassDatabase.Execute_MSSQL(delete) + stp = 10 + + If dt.Rows.Count > 0 Then + Dim Profile_Row As System.Data.DataRow + '---------------------- für jedes Profil die Dateien überprüfen ------------------------ + For Each Profile_Row In dt.Rows + stp = "a" + Console.WriteLine(">> Dateien für Profil '" & Profile_Row.Item("NAME") & "' eintragen") + ClassLogger.Add(">> Dateien für Profil '" & Profile_Row.Item("NAME") & "' eintragen", False) + Dim ID As Integer = Profile_Row.Item("GUID") + WD_Search = Nothing + WD_Search = Profile_Row.Item("WD_SEARCH") + stp = "b" + If WD_Search Is Nothing = False Then + '---------------------- Die Dateien auslesen ------------------------ + Dim windreamSucheErgebnisse As WMObjects + stp = "c" + windreamSucheErgebnisse = _windreamPM.GetSearchDocuments(WD_Search) + stp = "d" + Dim Anzahl_Doks As Integer = 0 + If windreamSucheErgebnisse Is Nothing = False Then + If windreamSucheErgebnisse.Count > 0 Then + stp = "e" + 'Die aktuellen Files auf refreshed = 0 setzten + Dim upd As String = "UPDATE TBPM_PROFILE_FILES SET REFRESHED = 0 WHERE PROFIL_ID = " & ID + If ClassDatabase.Execute_MSSQL(upd) = True Then + stp = "e-1" + 'Ein Array mit Dateiinformationen anlegen + Dim Profil_Docs(windreamSucheErgebnisse.Count - 1, 2) As String + For Each dok As WMObject In windreamSucheErgebnisse + Profil_Docs(Anzahl_Doks, 0) = ID + Profil_Docs(Anzahl_Doks, 1) = My.Settings.WD_LW & ":" & dok.aPath + '------DMS Erstell-Datum holen -------- + Dim DMSErstellt = dok.GetVariableValue(My.Settings.vIDX_DMS_ERSTELLT) + Dim DOC_ID + Try + DOC_ID = dok.GetVariableValue("Dokument-ID") + Catch ex As Exception + DOC_ID = 0 + End Try + + 'ClassLogger.Add(">> DMSErstellt: '" & DMSErstellt.ToString, False) + Dim date_EN As String + If My.Settings.vIDX_DMS_ERSTELLT.EndsWith("reated") Then + Dim arr() = DMSErstellt.ToString.Split(".") + If arr.Length = 3 Then + date_EN = arr(2).Replace(" 00:00:00", "") & "-" & arr(1) & "-" & arr(0) + ClassLogger.Add(">> date_EN: '" & date_EN, False) + DMSErstellt = date_EN + End If + End If + '-------------------- Überprüfen ob das Dokument bereits enthalten ist? Kann nur passieren wenn das Dok gerade in Bearbeitung ist ---------- + Dim sel1 As String = "SELECT GUID FROM TBPM_PROFILE_FILES WHERE PROFIL_ID = " & ID & " AND FILE_PATH = '" & My.Settings.WD_LW & ":" & dok.aPath & "'" + Dim check = ClassDatabase.Execute_Scalar(sel1) + '---------------------- Das Dokument inserten ------------------------ + Try + If check Is Nothing Or EMPTYTABLE = 0 Then + Dim insert As String = "INSERT INTO TBPM_PROFILE_FILES (PROFIL_ID, FILE_PATH, ACTIVE, DMS_ERSTELLT_DATE,DOC_ID) VALUES (" & ID & ", '" & My.Settings.WD_LW & ":" & dok.aPath & "',1, CONVERT(DATE,'" & DMSErstellt & "')," & DOC_ID & ")" + If ClassDatabase.Execute_MSSQL(insert) = False Then + ClassLogger.Add("### Unexpected Error while Inserting File-Record") + End If + ' aktuelles Dokument der Klasse mitteilen + Else + If CInt(check) > 0 Then + Dim upd1 As String = "UPDATE TBPM_PROFILE_FILES SET REFRESHED = 1, EDIT = 0 WHERE GUID = " & CInt(check) + ClassDatabase.Execute_MSSQL(upd1) + End If + + End If + Catch ex As Exception + ClassLogger.Add("###Fehler IN Insert or Update File-Record - ast step: " & stp) + ClassLogger.Add("###Fehler-Nachricht: " & ex.Message) + End Try + + Anzahl_Doks += 1 + Next + stp = "f - vor Delete Refreshed = 0" + Dim Del As String = "DELETE FROM TBPM_PROFILE_FILES WHERE PROFIL_ID = " & ID & " AND REFRESHED = 0" + ClassDatabase.Execute_MSSQL(Del) + '---------------------- Aktuelle Anzahl in Profiltabelle updaten ------------------------ + Dim update As String = "UPDATE TBPM_PROFILE SET NO_OF_DOCUMENTS = " & Anzahl_Doks & " WHERE GUID = " & ID + stp = "g - " & Anzahl_Doks.ToString + ClassDatabase.Execute_MSSQL(update) + ClassLogger.Add(">> Profil '" & Profile_Row.Item("NAME") & "' aktualisiert - Anzahl Dateien: " & Anzahl_Doks.ToString, False) + Else + ClassLogger.Add(">> ACHTUNG: Refresh konnte nicht ausgeführt werden: " & upd, False) + End If + Else + stp = "g" + ClassLogger.Add(">> KEINE DATEIEN FÜR PROFIL VORHANDEN.", False) + End If + Else + ClassLogger.Add(">> ACHTUNG: WINDREAM-SUCHE ist NOTHING.", False) + End If + End If + Next + stp = "h" + ''------------------------------- Bearbeitete Daten löschen ------------------------ + If ClassDatabase.Execute_MSSQL("DELETE FROM TBPM_PROFILE_FILES WHERE EDIT = 1") = True Then + ' stp = "i" + ' Console.WriteLine(">> Alte PROFILE-FILE Daten geleert") + ' '---------------------- DIE NEUEN DATEN AUF ACTIVE SETZEN ------------------------ + ' Dim update As String = "UPDATE TBPM_PROFILE_FILES SET ACTIVE = 1 WHERE ACTIVE = 0" + ' ClassDatabase.Execute_MSSQL(update) + ' stp = "j" + ' Console.WriteLine(">> Neue PROFILE-FILE Daten aktiv gesetzt") + End If + ClassDatabase.Execute_MSSQL("EXEC PRPM_REMOVE_NE_FILES") + End If + myConnection.Close() + stp = "k" + Catch ex As Exception + ClassLogger.Add("###Fehler IN Check_Profiles - last step: " & stp) + ClassLogger.Add("###Fehler IN Check_Profiles: " & ex.Message) + If ex.Message.Contains("Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.") = False Then + If My.Settings.Email_senden = True Then + email.Send_Error_Mail("Fehler in Check_Profiles (Modul main):
>> Fehlermeldung:
" & ex.Message) + End If + End If + End Try + End Sub +End Module diff --git a/app/DD_PM_Server/My Project/Application.Designer.vb b/app/DD_PM_Server/My Project/Application.Designer.vb new file mode 100644 index 0000000..1358e09 --- /dev/null +++ b/app/DD_PM_Server/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.261 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/app/DD_PM_Server/My Project/Application.myapp b/app/DD_PM_Server/My Project/Application.myapp new file mode 100644 index 0000000..e62f1a5 --- /dev/null +++ b/app/DD_PM_Server/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 2 + true + diff --git a/app/DD_PM_Server/My Project/AssemblyInfo.vb b/app/DD_PM_Server/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..23dee72 --- /dev/null +++ b/app/DD_PM_Server/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' Allgemeine Informationen über eine Assembly werden über die folgenden +' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +' die mit einer Assembly verknüpft sind. + +' Die Werte der Assemblyattribute überprüfen + + + + + + + + + + +'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird + + +' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +' +' Hauptversion +' Nebenversion +' Buildnummer +' Revision +' +' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +' übernehmen, indem Sie "*" eingeben: +' + + + diff --git a/app/DD_PM_Server/My Project/Resources.Designer.vb b/app/DD_PM_Server/My Project/Resources.Designer.vb new file mode 100644 index 0000000..6514473 --- /dev/null +++ b/app/DD_PM_Server/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.261 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DD_PM_Server.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/app/DD_PM_Server/My Project/Resources.resx b/app/DD_PM_Server/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/app/DD_PM_Server/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/app/DD_PM_Server/My Project/Settings.Designer.vb b/app/DD_PM_Server/My Project/Settings.Designer.vb new file mode 100644 index 0000000..c26642c --- /dev/null +++ b/app/DD_PM_Server/My Project/Settings.Designer.vb @@ -0,0 +1,203 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.34014 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + 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 + + _ + 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 + + _ + Public ReadOnly Property SQLConnection() As String + Get + Return CType(Me("SQLConnection"),String) + End Get + End Property + + _ + Public ReadOnly Property Email_senden() As Boolean + Get + Return CType(Me("Email_senden"),Boolean) + End Get + End Property + + _ + Public ReadOnly Property Email_Empfaenger() As String + Get + Return CType(Me("Email_Empfaenger"),String) + End Get + End Property + + _ + Public ReadOnly Property Email_From() As String + Get + Return CType(Me("Email_From"),String) + End Get + End Property + + _ + Public ReadOnly Property Email_User() As String + Get + Return CType(Me("Email_User"),String) + End Get + End Property + + _ + Public ReadOnly Property Email_PW() As String + Get + Return CType(Me("Email_PW"),String) + End Get + End Property + + _ + Public ReadOnly Property Email_Betreff() As String + Get + Return CType(Me("Email_Betreff"),String) + End Get + End Property + + ")> _ + Public ReadOnly Property Email_Body() As String + Get + Return CType(Me("Email_Body"),String) + End Get + End Property + + _ + Public ReadOnly Property Email_SMTP() As String + Get + Return CType(Me("Email_SMTP"),String) + End Get + End Property + + _ + Public ReadOnly Property WD_LW() As String + Get + Return CType(Me("WD_LW"),String) + End Get + End Property + + _ + Public ReadOnly Property vIDX_DMS_ERSTELLT() As String + Get + Return CType(Me("vIDX_DMS_ERSTELLT"),String) + End Get + End Property + + ")> _ + Public ReadOnly Property vBodyTag() As String + Get + Return CType(Me("vBodyTag"),String) + End Get + End Property + + _ + Public ReadOnly Property Email_ReminderBetreff() As String + Get + Return CType(Me("Email_ReminderBetreff"),String) + End Get + End Property + + _ + Public ReadOnly Property Email_ReminderStartup() As String + Get + Return CType(Me("Email_ReminderStartup"),String) + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.DD_PM_Server.My.MySettings + Get + Return Global.DD_PM_Server.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/app/DD_PM_Server/My Project/Settings.settings b/app/DD_PM_Server/My Project/Settings.settings new file mode 100644 index 0000000..57b7876 --- /dev/null +++ b/app/DD_PM_Server/My Project/Settings.settings @@ -0,0 +1,53 @@ + + + + + + <?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_DMS;Persist Security Info=True;User ID=sa;Password=dd</ConnectionString> + <ProviderName>System.Data.SqlClient</ProviderName> +</SerializableConnectionString> + Data Source=172.24.12.41\tests;Initial Catalog=DD_DMS;Persist Security Info=True;User ID=sa;Password=dd + + + True + + + + + + + + + + + + + + + Fehler in DD Process Manager - Server + + + Das Modul 'DD Process Manager - Server' meldet folgenden unvorhergesehen Fehler: <p> + + + + + + W + + + DMS erstellt + + + <table border="0"> + + + Hinweis Process-Manager Digital Data + + + E:\SchreiberM\Visual Studio\Kunden - Produktiv\PROCESSMANAGER\DD_PM_Server\DD_PM_Server\bin\Debug + + + \ No newline at end of file diff --git a/app/DD_PM_Server/app.config b/app/DD_PM_Server/app.config new file mode 100644 index 0000000..d9a15c4 --- /dev/null +++ b/app/DD_PM_Server/app.config @@ -0,0 +1,77 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + + + + + + + + + + + + + Fehler in DD Process Manager - Server + + + Das Modul 'DD Process Manager - Server' meldet folgenden unvorhergesehen Fehler: <p> + + + + + + W + + + DMS erstellt + + + <table border="0"> + + + Hinweis Process-Manager Digital Data + + + E:\SchreiberM\Visual Studio\Kunden - Produktiv\PROCESSMANAGER\DD_PM_Server\DD_PM_Server\bin\Debug + + + +