MS
This commit is contained in:
parent
8313ce9d7e
commit
e09488a06b
3
.vs/ProjectSettings.json
Normal file
3
.vs/ProjectSettings.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"CurrentProjectSetting": null
|
||||||
|
}
|
||||||
6
.vs/VSWorkspaceState.json
Normal file
6
.vs/VSWorkspaceState.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
||||||
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
@ -1,4 +1,7 @@
|
|||||||
Module CURRENT
|
Module CURRENT
|
||||||
Public LOG_ERRORS_ONLY As Boolean = True
|
Public LOG_ERRORS_ONLY As Boolean = True
|
||||||
Public CURRENT_FILEIN_WD As String
|
Public CURRENT_FILEIN_WD As String
|
||||||
|
Public CURRENT_IMPORT_ID As Integer
|
||||||
|
Public CURRENT_DOC_ID As Integer
|
||||||
|
Public AD_DOMAIN, AD_USER, AD_SERVER, AD_USER_PW As String
|
||||||
End Module
|
End Module
|
||||||
|
|||||||
68
app/ZSG_Import/ClassEncryption.vb
Normal file
68
app/ZSG_Import/ClassEncryption.vb
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
Imports System.Security.Cryptography
|
||||||
|
Public Class ClassEncryption
|
||||||
|
Private TripleDes As New TripleDESCryptoServiceProvider
|
||||||
|
Sub New(ByVal key As String)
|
||||||
|
' Initialize the crypto provider.
|
||||||
|
TripleDes.Key = TruncateHash(key, TripleDes.KeySize \ 8)
|
||||||
|
TripleDes.IV = TruncateHash("", TripleDes.BlockSize \ 8)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function TruncateHash(
|
||||||
|
ByVal key As String,
|
||||||
|
ByVal length As Integer) As Byte()
|
||||||
|
|
||||||
|
Dim sha1 As New SHA1CryptoServiceProvider
|
||||||
|
|
||||||
|
' Hash the key.
|
||||||
|
Dim keyBytes() As Byte =
|
||||||
|
System.Text.Encoding.Unicode.GetBytes(key)
|
||||||
|
Dim hash() As Byte = sha1.ComputeHash(keyBytes)
|
||||||
|
|
||||||
|
' Truncate or pad the hash.
|
||||||
|
ReDim Preserve hash(length - 1)
|
||||||
|
Return hash
|
||||||
|
End Function
|
||||||
|
Public Function EncryptData(
|
||||||
|
ByVal plaintext As String) As String
|
||||||
|
|
||||||
|
' Convert the plaintext string to a byte array.
|
||||||
|
Dim plaintextBytes() As Byte =
|
||||||
|
System.Text.Encoding.Unicode.GetBytes("!Didalog35452Heuchelheim=" & plaintext)
|
||||||
|
|
||||||
|
' Create the stream.
|
||||||
|
Dim ms As New System.IO.MemoryStream
|
||||||
|
' Create the encoder to write to the stream.
|
||||||
|
Dim encStream As New CryptoStream(ms,
|
||||||
|
TripleDes.CreateEncryptor(),
|
||||||
|
System.Security.Cryptography.CryptoStreamMode.Write)
|
||||||
|
|
||||||
|
' Use the crypto stream to write the byte array to the stream.
|
||||||
|
encStream.Write(plaintextBytes, 0, plaintextBytes.Length)
|
||||||
|
encStream.FlushFinalBlock()
|
||||||
|
|
||||||
|
' Convert the encrypted stream to a printable string.
|
||||||
|
Return Convert.ToBase64String(ms.ToArray)
|
||||||
|
End Function
|
||||||
|
'Entschlüsselt die Zeichenfolge
|
||||||
|
Public Function DecryptData(
|
||||||
|
ByVal encryptedtext As String) As String
|
||||||
|
|
||||||
|
' Convert the encrypted text string to a byte array.
|
||||||
|
Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext)
|
||||||
|
|
||||||
|
' Create the stream.
|
||||||
|
Dim ms As New System.IO.MemoryStream
|
||||||
|
' Create the decoder to write to the stream.
|
||||||
|
Dim decStream As New CryptoStream(ms,
|
||||||
|
TripleDes.CreateDecryptor(),
|
||||||
|
System.Security.Cryptography.CryptoStreamMode.Write)
|
||||||
|
|
||||||
|
' Use the crypto stream to write the byte array to the stream.
|
||||||
|
decStream.Write(encryptedBytes, 0, encryptedBytes.Length)
|
||||||
|
decStream.FlushFinalBlock()
|
||||||
|
Dim result = System.Text.Encoding.Unicode.GetString(ms.ToArray)
|
||||||
|
result = result.Replace("!Didalog35452Heuchelheim=", "")
|
||||||
|
' Convert the plaintext stream to a string.
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
252
app/ZSG_Import/ClassWDRights.vb
Normal file
252
app/ZSG_Import/ClassWDRights.vb
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
Imports WINDREAMLib
|
||||||
|
Imports DD_LIB_Standards
|
||||||
|
Public Class ClassWDRights
|
||||||
|
#Region "+++++ Konstanten +++++"
|
||||||
|
Const REL_Document_AccessRight = "AccessRight"
|
||||||
|
Const COL_AccessRight_AccessRightID = "dwAccessRightID"
|
||||||
|
Const COL_AccessRight_AccessRight = "dwAccessRight"
|
||||||
|
Const REL_AccessRight_UserOrGroup = "AccessRightUserOrGroup"
|
||||||
|
|
||||||
|
|
||||||
|
Const WMAccessRightUndefined = 0
|
||||||
|
Const WMAccessRightRead = 1
|
||||||
|
Const WMAccessRightWrite = 2
|
||||||
|
Const WMAccessRightReadWrite = 3
|
||||||
|
Const WMAccessRightAdmin = 4
|
||||||
|
Const WMAccessRightAllRights = 7 ' doc+folder: read, write and admin access
|
||||||
|
|
||||||
|
Const WMUserTypeMain = 1
|
||||||
|
Const WMUserTypeNormal = 4
|
||||||
|
Const WMUserTypeInactive = 8
|
||||||
|
|
||||||
|
Const WMGroupTypeAdmin = 2
|
||||||
|
|
||||||
|
Const WMEntityGroups = 13
|
||||||
|
Const WMEntityUser = 18
|
||||||
|
Const WMGroupTypeAll = 127
|
||||||
|
|
||||||
|
#End Region
|
||||||
|
#Region "+++++ Variables +++++"
|
||||||
|
Public Shared AD_DOMAIN As String
|
||||||
|
Public Shared AD_USER As String
|
||||||
|
Public Shared AD_USER_PW As String
|
||||||
|
Public Shared AD_SERVER As String
|
||||||
|
Public Shared WD_RIGHT_ADMIN As Integer
|
||||||
|
Public Shared MSG_RESULT = ""
|
||||||
|
#End Region
|
||||||
|
Public Shared Function Init()
|
||||||
|
Try
|
||||||
|
MSG_RESULT = ""
|
||||||
|
Dim DT_KONFIG As DataTable = clsDatabase.Return_Datatable("SELECT * FROM TBPMO_SERVICE_RIGHT_CONFIG WHERE GUID = 1")
|
||||||
|
AD_DOMAIN = DT_KONFIG.Rows(0).Item("AD_DOMAIN")
|
||||||
|
AD_USER = DT_KONFIG.Rows(0).Item("AD_USER")
|
||||||
|
WD_RIGHT_ADMIN = DT_KONFIG.Rows(0).Item("WD_RIGHT")
|
||||||
|
AD_SERVER = DT_KONFIG.Rows(0).Item("AD_SERVER")
|
||||||
|
|
||||||
|
|
||||||
|
Dim PWplainText As String
|
||||||
|
Dim wrapper As New ClassEncryption("!35452didalog=")
|
||||||
|
' DecryptData throws if the wrong password is used.
|
||||||
|
Try
|
||||||
|
PWplainText = wrapper.DecryptData(DT_KONFIG.Rows(0).Item("AD_USER_PW"))
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.Add("The Userpassword could not be decrypted", False)
|
||||||
|
PWplainText = ""
|
||||||
|
End Try
|
||||||
|
AD_USER_PW = PWplainText
|
||||||
|
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.Add("Unexpected Error in ClassRights Init: " & vbNewLine & ex.Message, True)
|
||||||
|
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
'''Renews all rights of the passed doc-file
|
||||||
|
''' </summary>
|
||||||
|
''' <returns>Returns Boolean True when successfull</returns>
|
||||||
|
''' <remarks></remarks>
|
||||||
|
Public Shared Function Doc_Renew_Rights() As Boolean
|
||||||
|
Try
|
||||||
|
|
||||||
|
Dim DT_USER_RIGHT As DataTable
|
||||||
|
|
||||||
|
Dim UserGroupRelation
|
||||||
|
Dim UserOrGroup
|
||||||
|
Dim oUSer
|
||||||
|
|
||||||
|
|
||||||
|
Dim sql = String.Format("SELECT * FROM [dbo].[FNPMO_GET_RIGHTS_FOR_DOC] ({0})", CURRENT_DOC_ID)
|
||||||
|
DT_USER_RIGHT = clsDatabase.Return_Datatable(sql)
|
||||||
|
If IsNothing(DT_USER_RIGHT) Then
|
||||||
|
Dim msg = "Error while receiving rights for DocID"
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim lret
|
||||||
|
Try
|
||||||
|
' Objekt muss zur Rechteänderung gelockt werden
|
||||||
|
lret = clsWindream.aktWMObject.LockRights()
|
||||||
|
Catch ex As Exception
|
||||||
|
Dim msg = "Error while locking file" & ex.Message
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
|
||||||
|
If CBool(lret) = False Then
|
||||||
|
Dim msg = "Error in setting lock .LockRights - Err.Number: " & Err.Number & vbCrLf & Err.Description
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Rechteträger-Liste holen
|
||||||
|
Dim AccessRights
|
||||||
|
AccessRights = clsWindream.aktWMObject.GetWMObjectRelationByName(REL_Document_AccessRight)
|
||||||
|
'Bei Fehler in Rechteauswertung
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
Dim msg = "Error in setting REL_Document_AccessRight - Err.Number: " & Err.Number & vbCrLf & Err.Description
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
'############################# Rechte löschen ################################################################################
|
||||||
|
'#############################################################################################################################
|
||||||
|
|
||||||
|
'Erst einmal alle anderen Rechte löschen
|
||||||
|
Dim i As Integer = 1
|
||||||
|
' und nun jeden Rechteträger verarbeiten
|
||||||
|
For Each aRightRelation In AccessRights
|
||||||
|
|
||||||
|
' Auflistung der Rechteträger-Informationen holen
|
||||||
|
UserGroupRelation = aRightRelation.GetWMObjectRelationByName(REL_AccessRight_UserOrGroup)
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
Dim msg = "Error in setting REL_AccessRight_UserOrGroup - Err.Number: " & Err.Number & vbCrLf & Err.Description
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Zugriff auf das Benutzer/Gruppen-Objekt
|
||||||
|
UserOrGroup = UserGroupRelation.item(0)
|
||||||
|
Dim _msg As String
|
||||||
|
|
||||||
|
If (UserOrGroup.aWMEntity = WMEntityGroups) Then
|
||||||
|
_msg = "Right for Group '" & UserOrGroup.aName & "'"""
|
||||||
|
Else
|
||||||
|
_msg = "Right for User: '" & UserOrGroup.aName & "'"""
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
Dim msg = "Error in setting UserGroupRelation - Err.Number: " & Err.Number & vbCrLf & Err.Description
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
'einem Rechteträger ALLE Rechte zu entziehen
|
||||||
|
'entfernt ihn gleichzeitig aus der Auflistung der Rechteträger
|
||||||
|
Try
|
||||||
|
AccessRights.Delete2(UserOrGroup, WMAccessRightAllRights)
|
||||||
|
Catch ex As Exception
|
||||||
|
Dim msg = "Error in AccessRights.Delete2: " & ex.Message
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
Continue For
|
||||||
|
End Try
|
||||||
|
i += 1
|
||||||
|
_msg = _msg.Replace("'", "")
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
Err.Clear()
|
||||||
|
' Wenn ALLE Rechteträger entfernt werden (FOR EACH),
|
||||||
|
' dann muss mindestens EIN Rechteträger mit dem Recht zur Rechteänderung
|
||||||
|
' wieder zugefügt werden!!!!! Dies ist der ADDI-Right User!
|
||||||
|
'Für jeden User das Recht einzeln hinzufügen
|
||||||
|
For Each User_Row As DataRow In DT_USER_RIGHT.Rows
|
||||||
|
Dim fileright 'Recht als Integer
|
||||||
|
Dim StringUserRight
|
||||||
|
Try
|
||||||
|
StringUserRight = AD_DOMAIN & "\" & User_Row.Item("USR_NAME")
|
||||||
|
fileright = User_Row.Item("USR_RIGHT")
|
||||||
|
|
||||||
|
Try
|
||||||
|
' User holen
|
||||||
|
oUSer = clsWindream.oSession.GetWMObjectByName(WMEntityUser, StringUserRight)
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Dim msg = String.Format(">> Could not create windream-Usersession for user '{0}' - check whether user is part of windream-group!", StringUserRight)
|
||||||
|
clsLogger.Add(msg, False)
|
||||||
|
|
||||||
|
MSG_RESULT &= msg & vbNewLine
|
||||||
|
Continue For
|
||||||
|
End Try
|
||||||
|
If Not IsNothing(oUSer) Then
|
||||||
|
Try
|
||||||
|
AccessRights.Insert2(oUSer, fileright) 'WMAccessRightAllRights)
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Dim msg = String.Format(">> Could not set right for user {0} - AccessRights.Insert2: {1}", StringUserRight, ex.Message)
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
|
||||||
|
Continue For
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Dim _right
|
||||||
|
Select Case fileright
|
||||||
|
Case WMAccessRightRead
|
||||||
|
_right = "READ"
|
||||||
|
Case WMAccessRightWrite
|
||||||
|
_right = "WRITE"
|
||||||
|
Case WMAccessRightAdmin
|
||||||
|
_right = "ADMIN"
|
||||||
|
Case WMAccessRightAllRights
|
||||||
|
_right = "ALL RIGHTS"
|
||||||
|
Case WMAccessRightReadWrite
|
||||||
|
_right = "READ WRITE"
|
||||||
|
End Select
|
||||||
|
MSG_RESULT &= String.Format("Error while working on RightChange:" & vbNewLine & "Fileright: {0}" & vbNewLine & "User: {1} " & vbNewLine & "File: {2}", _right, StringUserRight, CURRENT_FILEIN_WD) & vbNewLine
|
||||||
|
clsLogger.Add(ex.Message, True)
|
||||||
|
|
||||||
|
End Try
|
||||||
|
Next
|
||||||
|
Try
|
||||||
|
'Speichern nicht vergessen
|
||||||
|
clsWindream.aktWMObject.Save()
|
||||||
|
Catch ex As Exception
|
||||||
|
Dim msg = String.Format("Error at Object2Change.Save - DocID ({0}): {1}", CURRENT_DOC_ID, ex.Message)
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
If clsWindream.aktWMObject.aLocked = True Then
|
||||||
|
clsWindream.aktWMObject.unlock()
|
||||||
|
End If
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
|
||||||
|
'und der Vollständigkeit halber auch ein Unlock
|
||||||
|
If clsWindream.aktWMObject.aLocked = True Then
|
||||||
|
Try
|
||||||
|
clsWindream.aktWMObject.unlock()
|
||||||
|
Catch ex As Exception
|
||||||
|
Dim msg = "Fehler bei Unlock - Error: " & ex.Message
|
||||||
|
clsLogger.Add(msg, True)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
'jetzt True zurückgeben
|
||||||
|
Return True
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.Add(String.Format("Unexpected Error while Doc_Renew_Rightss DocID: {0}", CURRENT_DOC_ID), True)
|
||||||
|
Dim msg = "ErrorMessage: " & vbNewLine & ex.Message
|
||||||
|
clsLogger.Add(msg, False)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Class
|
||||||
@ -1,9 +1,24 @@
|
|||||||
Imports System.ComponentModel
|
Imports System.ComponentModel
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
|
||||||
Public Class MyService
|
Public Class MyService
|
||||||
'Variablen
|
'Variablen
|
||||||
Public Shared threadRunner As BackgroundWorker
|
Public Shared threadRunner As BackgroundWorker
|
||||||
|
Public Shared Function GetLnkTarget(lnkPath As String) As String
|
||||||
|
Try
|
||||||
|
Dim shl = New Shell32.Shell()
|
||||||
|
' Move this to class scope
|
||||||
|
lnkPath = System.IO.Path.GetFullPath(lnkPath)
|
||||||
|
Dim dir = shl.[NameSpace](System.IO.Path.GetDirectoryName(lnkPath))
|
||||||
|
Dim itm = dir.Items().Item(System.IO.Path.GetFileName(lnkPath))
|
||||||
|
Dim lnk = DirectCast(itm.GetLink, Shell32.ShellLinkObject)
|
||||||
|
Return lnk.Target.Path
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.AddError(ex.Message, "GetLnkTarget")
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
Return Nothing
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End Function
|
||||||
Protected Overrides Sub OnStart(ByVal args() As String)
|
Protected Overrides Sub OnStart(ByVal args() As String)
|
||||||
' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge
|
' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge
|
||||||
' ausführen, damit der Dienst gestartet werden kann.
|
' ausführen, damit der Dienst gestartet werden kann.
|
||||||
@ -20,7 +35,9 @@ Public Class MyService
|
|||||||
clsLogger.Add("ATTENTION: No Connection was established '" & My.Settings.MyConnectionString & "'!", True)
|
clsLogger.Add("ATTENTION: No Connection was established '" & My.Settings.MyConnectionString & "'!", True)
|
||||||
Else
|
Else
|
||||||
LOG_ERRORS_ONLY = My.Settings.LOG_ERRORS_ONLY
|
LOG_ERRORS_ONLY = My.Settings.LOG_ERRORS_ONLY
|
||||||
|
If LOG_ERRORS_ONLY = False Then
|
||||||
|
clsLogger.Add("DETAIL-LOG IS ACTIVE", False)
|
||||||
|
End If
|
||||||
'### Thread für das nachträgliche Setzen von Rechten generieren
|
'### Thread für das nachträgliche Setzen von Rechten generieren
|
||||||
MyService.threadRunner = New BackgroundWorker()
|
MyService.threadRunner = New BackgroundWorker()
|
||||||
MyService.threadRunner.WorkerReportsProgress = True
|
MyService.threadRunner.WorkerReportsProgress = True
|
||||||
@ -39,80 +56,284 @@ Public Class MyService
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
Public Shared Sub RUN_THREAD(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
|
Public Shared Sub RUN_THREAD(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
|
||||||
|
Dim step_ As String
|
||||||
Try
|
Try
|
||||||
'erst einmal die Technischen Plätze bestimmen die noch nciht importiert wurden
|
Dim DT_KONFIG As DataTable = clsDatabase.Return_Datatable("SELECT * FROM TBPMO_SERVICE_RIGHT_CONFIG WHERE GUID = 1")
|
||||||
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]")
|
AD_DOMAIN = DT_KONFIG.Rows(0).Item("AD_DOMAIN")
|
||||||
|
AD_USER = DT_KONFIG.Rows(0).Item("AD_USER")
|
||||||
|
AD_SERVER = DT_KONFIG.Rows(0).Item("AD_SERVER")
|
||||||
|
Dim PWplainText As String
|
||||||
|
Dim wrapper As New ClassEncryption("!35452didalog=")
|
||||||
|
' DecryptData throws if the wrong password is used.
|
||||||
Try
|
Try
|
||||||
If Not IsNothing(DT_TP) Then
|
PWplainText = wrapper.DecryptData(DT_KONFIG.Rows(0).Item("AD_USER_PW"))
|
||||||
If DT_TP.Rows.Count > 0 Then
|
Catch ex As Exception
|
||||||
clsLogger.Add(String.Format(">> {0} TPs need to be worked - {1}", DT_TP.Rows.Count.ToString, Now), False)
|
clsLogger.Add("The Userpassword could not be decrypted", False)
|
||||||
'Jeden Technischen Platz einzeln durchlaufen weil für diesen ein Record existiert
|
PWplainText = ""
|
||||||
For Each TP As DataRow In DT_TP.Rows
|
End Try
|
||||||
Dim _TP As String = TP.Item(0)
|
AD_USER_PW = PWplainText
|
||||||
clsLogger.AddDetailLog(String.Format(">> Working on technical place: '{0}'", _TP))
|
Dim logcount As Integer = 0
|
||||||
Dim selrecid = String.Format("SELECT [Record-ID] FROM VWTEMP_PMO_FORM3 where UPPER(TPLNR) = UPPER('{0}')", _TP)
|
'erst einmal die Technischen Plätze bestimmen die noch nciht importiert wurden
|
||||||
Dim _RECORD_ID = clsDatabase.Execute_Scalar(selrecid)
|
Dim DTIMPORT_COMOS As DataTable = clsDatabase.Return_Datatable("SELECT * FROM VWPMO_TEMP_IMPORT_COMOS_FILES")
|
||||||
If Not IsNothing(_RECORD_ID) Then
|
'SELECT DISTINCT [UNIQUE_STR] FROM [EXPORT_COMOS] where dokumentart is not null and imported = 0 and [UNIQUE_STR] LIKE '472%' order by [UNIQUE_STR]
|
||||||
'Jede Datei einzeln durchlaufen
|
Try
|
||||||
Dim sel = String.Format("SELECT * FROM [EXPORT_COMOS] WHERE IMPORTED = 0 AND [UNIQUE_STR] = '{0}'", TP.Item("UNIQUE_STR"))
|
Dim selrecid
|
||||||
Dim DT_TP_DOCS As DataTable = clsDatabase.Return_Datatable(sel)
|
If Not IsNothing(DTIMPORT_COMOS) Then
|
||||||
If Not IsNothing(DT_TP_DOCS) Then
|
If DTIMPORT_COMOS.Rows.Count > 0 Then
|
||||||
If DT_TP_DOCS.Rows.Count > 0 Then
|
clsLogger.Add(String.Format("{0} FILES need to be worked", DTIMPORT_COMOS.Rows.Count.ToString), False)
|
||||||
For Each _docRow As DataRow In DT_TP_DOCS.Rows
|
Dim DTTBPMO_WD_OBJECTTYPE As DataTable
|
||||||
Dim GUID = _docRow.Item("GUID")
|
Dim Sql = "Select Top 1 * from TBPMO_WD_OBJECTTYPE where Upper(object_type) = Upper('ZSG - Geschäftsprozess')"
|
||||||
Dim filename = _docRow.Item("Link")
|
clsWindream._WDObjekttyp = "ZSG - Geschäftsprozess"
|
||||||
If File.Exists(filename) Then
|
DTTBPMO_WD_OBJECTTYPE = clsDatabase.Return_Datatable(Sql)
|
||||||
|
Dim WD_Session = clsWindream.GetWMSessionAsUser(AD_DOMAIN, AD_SERVER, AD_USER, AD_USER_PW)
|
||||||
|
If Not IsNothing(WD_Session) Then
|
||||||
|
If DTTBPMO_WD_OBJECTTYPE.Rows.Count = 1 Then
|
||||||
|
If ClassWDRights.Init = True Then
|
||||||
|
Dim filecount = 1
|
||||||
|
'Jeden Technischen Platz einzeln durchlaufen weil für diesen ein Record existiert
|
||||||
|
For Each FILE_ROW As DataRow In DTIMPORT_COMOS.Rows
|
||||||
|
clsLogger.Add(String.Format("Working on File {0}/{1} - ID: {2}", filecount, DTIMPORT_COMOS.Rows.Count, FILE_ROW.Item("GUID")), False)
|
||||||
|
filecount += 1
|
||||||
|
Dim MYOBJECT As String = FILE_ROW.Item("OBJEKT")
|
||||||
|
clsLogger.AddDetailLog(String.Format("Working on OBJEKT: '{0}'", MYOBJECT))
|
||||||
|
|
||||||
Else
|
CURRENT_IMPORT_ID = 0
|
||||||
clsLogger.Add(String.Format(">> File not found: {0}", filename), False)
|
step_ = ""
|
||||||
Update_COMMENT_GUID(GUID, "FILE NOT FOUND")
|
logcount += 1
|
||||||
|
Dim filename = FILE_ROW.Item("Link")
|
||||||
|
filename = filename.ToString.Replace("U:", "E:")
|
||||||
|
filename = filename.ToString.Replace("\\", "\")
|
||||||
|
selrecid = String.Format("SELECT GUID FROM TBPMO_RECORD where GUID = {0}", FILE_ROW.Item("RECORD_ID"))
|
||||||
|
Dim _RECORD_ID = clsDatabase.Execute_Scalar(selrecid)
|
||||||
|
If Not IsNothing(_RECORD_ID) Then
|
||||||
|
'Jede Datei einzeln durchlaufen
|
||||||
|
step_ = ""
|
||||||
|
Dim _DISPLAYNAME = FILE_ROW.Item("DISPLAYNAME")
|
||||||
|
Dim docsql As String
|
||||||
|
CURRENT_IMPORT_ID = FILE_ROW.Item("GUID")
|
||||||
|
UpdateWORKED_GUID()
|
||||||
|
If filename.ToString.EndsWith(".lnk") Then
|
||||||
|
clsLogger.Add("FILE IS A LINK", False)
|
||||||
|
If filename = GetLnkTarget(filename) = Nothing Then
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
If File.Exists(filename) Then
|
||||||
|
Dim sql2 = String.Format("SELECT * FROM [dbo].[FN_GET_PATH_AND_CO] ('{0}')", filename)
|
||||||
|
clsLogger.AddDetailLog("sqlFN_GET_PATH_AND_CO: " & sql2)
|
||||||
|
Dim DT_PATH_RESULTS As DataTable = clsDatabase.Return_Datatable(sql2)
|
||||||
|
If DT_PATH_RESULTS.Rows.Count = 1 Then
|
||||||
|
step_ = "DT_PATH_RESULTS.Rows.Count = 1"
|
||||||
|
Dim WD_PATH = DT_PATH_RESULTS.Rows(0).Item(0)
|
||||||
|
clsLogger.AddDetailLog("WD_PATH: " & WD_PATH)
|
||||||
|
Dim Department = DT_PATH_RESULTS.Rows(0).Item(1)
|
||||||
|
Dim DoctypeSIDtring = DT_PATH_RESULTS.Rows(0).Item(2)
|
||||||
|
docsql = String.Format("select GUID from TBDD_DOKUMENTART where substring(BEZEICHNUNG,1,2) = substring('{0}',1,2)", DoctypeSIDtring)
|
||||||
|
Dim DOCTYPE_ID = clsDatabase.Execute_Scalar(docsql)
|
||||||
|
clsLogger.AddDetailLog("DOCTYPE_ID: " & DOCTYPE_ID)
|
||||||
|
Dim DOCTYPE_STRING = clsDatabase.Execute_Scalar(String.Format("SELECT [dbo].[FNPMO_GETOBJECTCAPTION] ('de-DE','DOCTYPE_TITLE' + CONVERT(VARCHAR(4),{0}),1)", DOCTYPE_ID))
|
||||||
|
If IsNothing(DOCTYPE_STRING) Then
|
||||||
|
DOCTYPE_STRING = "NO DOCTYPE"
|
||||||
|
Update_COMMENT_GUID("NO DOCTYPE: " & DoctypeSIDtring)
|
||||||
|
End If
|
||||||
|
clsLogger.AddDetailLog("DOCTYPE_STRING: " & DOCTYPE_STRING)
|
||||||
|
'Prüfen ob Datei schon referenziert wurde
|
||||||
|
docsql = String.Format("SELECT DocID, FULL_FILENAME FROM VWPMO_DOC_SYNC where UPPER(FULL_FILENAME) = UPPER('{0}')", WD_PATH)
|
||||||
|
Dim DT_FILE_EXISTS As DataTable = clsDatabase.Return_Datatable(docsql)
|
||||||
|
Dim DOC_ID
|
||||||
|
If DT_FILE_EXISTS.Rows.Count = 0 Then
|
||||||
|
Dim streamresult = clsWindream.Stream_File(filename, WD_PATH, WD_Session)
|
||||||
|
If streamresult = True Then
|
||||||
|
step_ = "streamresult = True"
|
||||||
|
If DTTBPMO_WD_OBJECTTYPE.Rows.Count = 1 Then
|
||||||
|
If clsWindream.WMFILE_existed = False Then
|
||||||
|
Dim indexname
|
||||||
|
Dim indexierung_erfolgreich = False
|
||||||
|
indexname = DTTBPMO_WD_OBJECTTYPE.Rows(0).Item("IDXNAME_DOCTYPE").ToString
|
||||||
|
'Indexierung des Dokumententyps
|
||||||
|
indexierung_erfolgreich = clsWindream.IndexaktFile(indexname, DOCTYPE_STRING)
|
||||||
|
If indexierung_erfolgreich = False Then
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
|
||||||
Next
|
indexname = DTTBPMO_WD_OBJECTTYPE.Rows(0).Item("IDXNAME_RELATION").ToString
|
||||||
End If
|
indexierung_erfolgreich = clsWindream.IndexaktFile(indexname, "ADDI-RELATION")
|
||||||
|
If indexierung_erfolgreich = False Then
|
||||||
|
clsLogger.AddDetailLog("EXIT ON indexierung_erfolgreich ADDI-RELATION=False...")
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
step_ = " streamresult = False "
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.AddDetailLog("FILE ALREADY EXISTING IN WINDREAM...")
|
||||||
|
'Datei existiert bereits in windream
|
||||||
|
If clsWindream.Create_aktWDObjekt(WD_PATH) = False Then
|
||||||
|
clsLogger.Add(String.Format("Could not create aktWDObjekt"), False)
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
DOC_ID = clsWindream.aktWMObject.GetVariableValue("Dokument-ID")
|
||||||
|
CURRENT_DOC_ID = 0
|
||||||
|
If IsNumeric(DOC_ID) And DOC_ID <> 0 Then
|
||||||
|
docsql = String.Format("SELECT COUNT(DocID) FROM VWPMO_DOC_SYNC WHERE DocID = {0}", DOC_ID)
|
||||||
|
If clsDatabase.Execute_Scalar(docsql) = 1 Then
|
||||||
|
CURRENT_DOC_ID = DOC_ID
|
||||||
|
UpdateIMPORTED_GUID()
|
||||||
|
Dim execute = String.Format("EXEC [dbo].[PRPMO_DOC_CREATE_NEW_DOC] {0},{1},'{2}'", DOC_ID, _RECORD_ID, "windream")
|
||||||
|
If clsDatabase.Execute_non_Query(execute) = True Then
|
||||||
|
If Not IsDBNull(_DISPLAYNAME) Then
|
||||||
|
Dim upd1 = String.Format("UPDATE TBPMO_DOCRESULT_LIST SET DISPLAY_NAME = '{0}' WHERE DocID = {1}", _DISPLAYNAME, CURRENT_DOC_ID)
|
||||||
|
clsDatabase.Execute_Scalar(upd1)
|
||||||
|
End If
|
||||||
|
|
||||||
|
SET_WD_RIGHTS()
|
||||||
|
Else
|
||||||
|
clsLogger.Add(String.Format("DOC-Links could not be created!"), False)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.Add(String.Format("DOC-ID not in VWPMO_DOC_SYNC"), False)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.Add(String.Format("COULD NOT GET A DOC-ID"), False)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.Add(String.Format("DT_PATH_RESULTS is nothing"), False)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.Add(String.Format("File not found: {0}", filename), False)
|
||||||
|
Update_COMMENT_GUID("FILE NOT FOUND")
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.Add(String.Format("No Record found for OBJECT: {0} " & selrecid, MYOBJECT), False)
|
||||||
|
Update_COMMENT_GUID("No Record found (IMPORT)")
|
||||||
|
End If
|
||||||
|
If logcount = 10 Then
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
logcount = 0
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
clsLogger.Add("CREATE COMOSLinks FINISHED", False)
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
|
||||||
|
Else
|
||||||
|
clsLogger.AddError("Could not initialize right-module...")
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
clsLogger.Add(String.Format(">> No Record found for TP: {0}", _TP), False)
|
clsLogger.Add(String.Format(">>WDOBJEKTTYPE IS NOTHING"), False)
|
||||||
Update_COMMENT(_TP, "NO RECORD-ID FOUND")
|
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.Add("COULD NOT CREATE A SESSION", True)
|
||||||
|
|
||||||
Next
|
End If
|
||||||
|
|
||||||
|
|
||||||
'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
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.AddError("Uncexpected Error in working rights: " & ex.Message, "DT_RIGHTS_2b_WORKED")
|
clsLogger.AddError("Uncexpected Error in working Objekts: " & ex.Message & " LAST STEP: " & step_)
|
||||||
|
clsLogger.WriteLog()
|
||||||
End Try
|
End Try
|
||||||
|
'Try
|
||||||
|
' Dim DT_DELETE As DataTable = clsDatabase.Return_Datatable("SELECT DISTINCT UPPER(LINK) FROM IMPORT_2017_Links WHERE IMPORTED = 1 AND FILE_DELETED = 0 AND DOC_ID > 0")
|
||||||
|
' If Not IsNothing(DT_DELETE) Then
|
||||||
|
' step_ = "FOR EACH DELETE ROW"
|
||||||
|
' For Each row_link As DataRow In DT_DELETE.Rows
|
||||||
|
' Dim _filename = row_link.Item(0)
|
||||||
|
' _filename = _filename.ToString.Replace("U:", "E:")
|
||||||
|
' Dim sqlex = String.Format("SELECT COUNT(*) FROM IMPORT_2017_Links WHERE UPPER(LINK) = UPPER('{0}') AND (IMPORTED = 0 OR WORKED = 0)", _filename)
|
||||||
|
' Dim DT_REST As DataTable = clsDatabase.Return_Datatable(sqlex)
|
||||||
|
' If DT_REST.Rows.Count = 0 Then
|
||||||
|
' If File.Exists(_filename) Then
|
||||||
|
' Try
|
||||||
|
' File.Delete(_filename)
|
||||||
|
' _filename = _filename.ToString.Replace("E:", "U:")
|
||||||
|
' Dim upd = String.Format("UPDATE IMPORT_2017_Links SET FILE_DELETED = 1 WHERE UPPER(LINK) = UPPER('{0}')", _filename)
|
||||||
|
' clsDatabase.Execute_non_Query(upd)
|
||||||
|
' Catch ex As Exception
|
||||||
|
' clsLogger.Add(String.Format("COULD NOT DELETE FILE: {0} - ERRO: " & ex.Message, _filename), False)
|
||||||
|
' End Try
|
||||||
|
' 'Else
|
||||||
|
' ' _filename = _filename.ToString.Replace("E:", "U:")
|
||||||
|
' ' Dim upd = String.Format("UPDATE IMPORT_2017_Links SET FILE_DELETED = 1 WHERE UPPER(LINK) = UPPER('{0}')", _filename)
|
||||||
|
' ' clsDatabase.Execute_non_Query(upd)
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
|
||||||
|
|
||||||
|
' Next
|
||||||
|
' End If
|
||||||
|
'Catch ex As Exception
|
||||||
|
' clsLogger.AddError("Uncexpected Error in Delete Docs: " & ex.Message & " LAST STEP: " & step_)
|
||||||
|
' clsLogger.WriteLog()
|
||||||
|
'End Try
|
||||||
|
|
||||||
|
|
||||||
clsLogger.WriteLog()
|
clsLogger.WriteLog()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.AddError("Uncexpected Error: " & ex.Message, "RUN_THREAD")
|
clsLogger.AddError("Uncexpected Error: " & ex.Message, "RUN_THREAD")
|
||||||
|
clsLogger.WriteLog()
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
Private Shared Sub Update_COMMENT(UNIQUE_STR As String, comment As String)
|
Public Shared Function SET_WD_RIGHTS()
|
||||||
Try
|
Try
|
||||||
Dim upd = String.Format("UPDATE EXPORT_COMOS_472 SET COMMENT = '{0}' where UPPER(UNIQUE_STR) = UPPER('{1}') AND IMPORTED = 0")
|
If ClassWDRights.Doc_Renew_Rights() Then
|
||||||
clsDatabase.Execute_non_Query(upd)
|
If ClassWDRights.MSG_RESULT <> "" Then
|
||||||
|
clsLogger.Add("Attention: some rights could Not be set: " & ClassWDRights.MSG_RESULT.MSG_RESULT, True)
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
clsLogger.Add("Error in Doc_Renew_Rights.. ", True)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.AddError("Uncexpected Error in Update_COMMENT: " & ex.Message)
|
clsLogger.AddError("Uncexpected Error in SET_WD_RIGHTS: " & ex.Message)
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Function
|
||||||
Private Shared Sub Update_COMMENT_GUID(GUID As Integer, comment As String)
|
'Private Shared Sub Update_COMMENT(UNIQUE_STR As String, comment As String)
|
||||||
|
' Try
|
||||||
|
' Dim upd = String.Format("UPDATE [IMPORT_2017_Links] SET COMMENT_IMPORT = '{0}' where UPPER(OBJEKT) = UPPER('{1}') AND IMPORTED = 0", comment, UNIQUE_STR)
|
||||||
|
' 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(comment As String)
|
||||||
Try
|
Try
|
||||||
Dim upd = String.Format("UPDATE EXPORT_COMOS_472 SET COMMENT = '{0}' where GUID = {1}")
|
Dim upd = String.Format("UPDATE IMPORT_2017_Links SET COMMENT_IMPORT = '{0}' where GUID = {1}", comment, CURRENT_IMPORT_ID)
|
||||||
clsDatabase.Execute_non_Query(upd)
|
clsDatabase.Execute_non_Query(upd)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.AddError("Uncexpected Error in Update_COMMENT_GUID: " & ex.Message)
|
clsLogger.AddError("Uncexpected Error in Update_COMMENT_GUID: " & ex.Message)
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Shared Sub UpdateIMPORTED_GUID()
|
||||||
|
Try
|
||||||
|
Dim upd = String.Format("UPDATE IMPORT_2017_Links SET IMPORTED = 1, DOC_ID = {1} where GUID = {0}", CURRENT_IMPORT_ID, CURRENT_DOC_ID)
|
||||||
|
clsDatabase.Execute_non_Query(upd)
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.AddError("Uncexpected Error in UpdateIMPORTED_GUID: " & ex.Message)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
Private Shared Sub UpdateWORKED_GUID()
|
||||||
|
Try
|
||||||
|
Dim upd = String.Format("UPDATE IMPORT_2017_Links SET WORKED = 1 where GUID = {0}", CURRENT_IMPORT_ID)
|
||||||
|
clsDatabase.Execute_non_Query(upd)
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.AddError("Uncexpected Error in UpdateIMPORTED_GUID: " & ex.Message)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
Protected Overrides Sub OnStop()
|
Protected Overrides Sub OnStop()
|
||||||
' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen.
|
' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen.
|
||||||
|
|
||||||
|
|||||||
@ -80,6 +80,8 @@
|
|||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="ClassEncryption.vb" />
|
||||||
|
<Compile Include="ClassWDRights.vb" />
|
||||||
<Compile Include="clsDatabase.vb" />
|
<Compile Include="clsDatabase.vb" />
|
||||||
<Compile Include="clsLogger.vb" />
|
<Compile Include="clsLogger.vb" />
|
||||||
<Compile Include="clsWindream.vb" />
|
<Compile Include="clsWindream.vb" />
|
||||||
@ -126,6 +128,17 @@
|
|||||||
</None>
|
</None>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<COMReference Include="Shell32">
|
||||||
|
<Guid>{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}</Guid>
|
||||||
|
<VersionMajor>1</VersionMajor>
|
||||||
|
<VersionMinor>0</VersionMinor>
|
||||||
|
<Lcid>0</Lcid>
|
||||||
|
<WrapperTool>tlbimp</WrapperTool>
|
||||||
|
<Isolated>False</Isolated>
|
||||||
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
|
</COMReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@ -79,13 +79,19 @@ Public Class clsLogger
|
|||||||
End If
|
End If
|
||||||
'Präfixe schreiben
|
'Präfixe schreiben
|
||||||
If _error = True And Funktion <> "" Then
|
If _error = True And Funktion <> "" Then
|
||||||
msg = ">> Attention Error in Funktion '" & Funktion & "'" & vbNewLine & "error-message: "
|
msg = Now.ToString & " >> Attention Error in Funktion '" & Funktion & "': "
|
||||||
ElseIf _error = True Then
|
ElseIf _error = True Then
|
||||||
msg = ">> Attention Error:" & vbNewLine & "error-message: "
|
msg = Now.ToString & " >> Attention Error: "
|
||||||
|
Else
|
||||||
|
msg = Now.ToString & " >> "
|
||||||
End If
|
End If
|
||||||
'Präfix und Meldung zusammenstellen
|
'Präfix und Meldung zusammenstellen
|
||||||
msg &= text
|
msg &= text
|
||||||
log_string &= msg
|
log_string &= msg
|
||||||
|
If _error = True Then
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Public Shared Sub AddError(ByVal error_string As String, Optional ByVal Funktion As String = "")
|
Public Shared Sub AddError(ByVal error_string As String, Optional ByVal Funktion As String = "")
|
||||||
Try
|
Try
|
||||||
@ -124,7 +130,7 @@ Public Class clsLogger
|
|||||||
If log_string <> "" Then
|
If log_string <> "" Then
|
||||||
log_string &= vbNewLine
|
log_string &= vbNewLine
|
||||||
End If
|
End If
|
||||||
log_string &= " >> " & text
|
log_string &= Now.ToString & " >>> " & text
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LogEscalation_Error("Unexpected Error in AddDetailLog - Error: " & ex.Message)
|
LogEscalation_Error("Unexpected Error in AddDetailLog - Error: " & ex.Message)
|
||||||
|
|||||||
@ -42,9 +42,10 @@ Public Class clsWindream
|
|||||||
Public Shared oBrowser As New WMOBRWSLib.ServerBrowser
|
Public Shared oBrowser As New WMOBRWSLib.ServerBrowser
|
||||||
Public Shared oDokumentTypen As WINDREAMLib.WMObjects
|
Public Shared oDokumentTypen As WINDREAMLib.WMObjects
|
||||||
Public Shared _WDObjekttyp As String
|
Public Shared _WDObjekttyp As String
|
||||||
Private Shared aktWMObject As WINDREAMLib.WMObject
|
Public Shared aktWMObject As WINDREAMLib.WMObject
|
||||||
Public Shared WD_SERVER
|
Public Shared WD_SERVER
|
||||||
Public Shared CURRENT_WMObject As WMObject
|
Public Shared CURRENT_WMObject As WMObject
|
||||||
|
Public Shared WMFILE_existed As Boolean = False
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ Public Class clsWindream
|
|||||||
Try
|
Try
|
||||||
' Session-Objekt instanziieren und mit dem im Client ausgewählten Server belegen
|
' Session-Objekt instanziieren und mit dem im Client ausgewählten Server belegen
|
||||||
oSession = CreateObject("Windream.WMSession", GetCurrentServer)
|
oSession = CreateObject("Windream.WMSession", GetCurrentServer)
|
||||||
clsLogger.AddDetailLog(" >> windream-Server: '" & GetCurrentServer() & "'")
|
clsLogger.AddDetailLog("windream-Server: '" & GetCurrentServer() & "'")
|
||||||
' Connection-Objekt instanziieren
|
' Connection-Objekt instanziieren
|
||||||
oConnect = CreateObject("Windream.WMConnect")
|
oConnect = CreateObject("Windream.WMConnect")
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ Public Class clsWindream
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'If My.Settings.vDetailLog Then
|
'If My.Settings.vDetailLog Then
|
||||||
' ClassLogger.Add(" >> windream-Version: '" & oSession.GetSystemInfo("WindreamVersion") & "'", False)
|
' ClassLogger.Add("windream-Version: '" & oSession.GetSystemInfo("WindreamVersion") & "'", False)
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
' AUSGABE VON SYSTEMINFORMATIONEN
|
' AUSGABE VON SYSTEMINFORMATIONEN
|
||||||
@ -273,7 +274,7 @@ Public Class clsWindream
|
|||||||
|
|
||||||
aSession = aConnect.Login(aUserId)
|
aSession = aConnect.Login(aUserId)
|
||||||
|
|
||||||
|
oSession = Nothing
|
||||||
If Err.Number <> 0 Then
|
If Err.Number <> 0 Then
|
||||||
Dim msg = "Error in Connect.Login(aUserId) - Err.Number: " & Err.Number & vbNewLine & Err.Description
|
Dim msg = "Error in Connect.Login(aUserId) - Err.Number: " & Err.Number & vbNewLine & Err.Description
|
||||||
clsLogger.Add(msg, True)
|
clsLogger.Add(msg, True)
|
||||||
@ -281,6 +282,7 @@ Public Class clsWindream
|
|||||||
Else
|
Else
|
||||||
SessionAsUser = aSession
|
SessionAsUser = aSession
|
||||||
If aSession.aLoggedin = True Then
|
If aSession.aLoggedin = True Then
|
||||||
|
oSession = SessionAsUser
|
||||||
Return SessionAsUser
|
Return SessionAsUser
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -292,57 +294,113 @@ Public Class clsWindream
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
Public Shared Function Stream_File(ByVal filenameQuelle As String, ByVal filenameZiel As String, Optional ImportAll As Boolean = False)
|
''' <summary>
|
||||||
|
''' Checks if folder exists in windream.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="substring_path">path to folder without drive</param>
|
||||||
|
''' <returns>Returns true if exists, fals eif not</returns>
|
||||||
|
''' <remarks></remarks>
|
||||||
|
Public Shared Function WD_PATH_EXISTS(substring_path As String)
|
||||||
Try
|
Try
|
||||||
|
Dim folder_exists = oSession.WMObjectExists(WINDREAMLib.WMEntity.WMEntityFolder, substring_path, 0, 0)
|
||||||
|
Return folder_exists
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.Add(String.Format("Unexpected error in WD_PATH_EXISTS ({0}): {1} ", substring_path, ex.Message), True)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
Public Shared Function Create_FOLDER_FROM_PATH(ByVal WM_FOLDER As String)
|
||||||
|
Try
|
||||||
|
If WM_FOLDER.Contains(":") Then
|
||||||
|
WM_FOLDER = WM_FOLDER.Substring(2)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim WMObject As WINDREAMLib.WMObject
|
||||||
|
If IsNothing(oSession) Then
|
||||||
|
clsLogger.Add(">> There is no windream session active!", True)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
Try
|
||||||
|
WMObject = oSession.GetNewWMObjectFS(WMEntityFolder, WM_FOLDER, WMObjectEditModeNoEdit)
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.Add(">> Could not create WMObject in Create_FOLDER_FROM_PATH '" & WM_FOLDER & "': " & ex.Message, True)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
Public Shared Function Stream_File(ByVal filenameQuelle As String, ByVal Ziel As String, WDSession As Object, Optional Importall As Boolean = False)
|
||||||
|
Try
|
||||||
|
clsLogger.AddDetailLog("Starting StreamFile....")
|
||||||
|
clsLogger.AddDetailLog("filenameQuelle: " & filenameQuelle)
|
||||||
|
clsLogger.AddDetailLog("filenameZiel: " & Ziel)
|
||||||
|
|
||||||
|
WMFILE_existed = False
|
||||||
aktWMObject = Nothing
|
aktWMObject = Nothing
|
||||||
Dim zielpfad = Path.GetDirectoryName(filenameZiel)
|
Dim zielpfad = Path.GetDirectoryName(Ziel)
|
||||||
If My.Computer.FileSystem.DirectoryExists(zielpfad) = False Then
|
If zielpfad.StartsWith("W:") Then
|
||||||
My.Computer.FileSystem.CreateDirectory(zielpfad)
|
zielpfad = zielpfad.Substring(2)
|
||||||
clsLogger.Add(">> Zielverzeichnis neu erzeugt!", False)
|
End If
|
||||||
|
|
||||||
|
If WD_PATH_EXISTS(zielpfad) = False Then
|
||||||
|
Dim split() As String = zielpfad.Split("\")
|
||||||
|
Dim Path_Combined As String = ""
|
||||||
|
For Each s As String In split
|
||||||
|
Path_Combined &= s & "\"
|
||||||
|
If Path_Combined <> "W:\" Then
|
||||||
|
Dim temppath = Path_Combined
|
||||||
|
Try
|
||||||
|
temppath = Path_Combined.Substring(0, temppath.Length)
|
||||||
|
clsLogger.AddDetailLog("Checking if partpath exists: " & temppath)
|
||||||
|
Select Case WD_PATH_EXISTS(temppath)
|
||||||
|
Case False
|
||||||
|
oSession.GetNewWMObjectFS(2, temppath, 0) 'WMEntityFolder,WMObjectEditModeNoEdit)
|
||||||
|
Case -10
|
||||||
|
Return False
|
||||||
|
End Select
|
||||||
|
Catch ex As Exception
|
||||||
|
If Not ex.Message.Contains("Filename exists!") Then
|
||||||
|
clsLogger.Add(String.Format(">> Could not create folder-part: {0} - Complete path is: {1}", temppath, zielpfad), True)
|
||||||
|
clsLogger.Add(String.Format(">> ErrorMessage: {0}: ", ex.Message), True)
|
||||||
|
clsLogger.WriteLog()
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
'If Create_FOLDER_FROM_PATH(zielpfad) = False Then
|
||||||
|
' Return False
|
||||||
|
'Else
|
||||||
|
' clsLogger.Add(">> Zielverzeichnis neu erzeugt!", False)
|
||||||
|
'End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Const STREAM_BinaryObject = "BinaryObject"
|
Const STREAM_BinaryObject = "BinaryObject"
|
||||||
|
clsLogger.AddDetailLog("Stream_File wurde gestartet")
|
||||||
clsLogger.AddDetailLog(" >> Stream_File wurde gestartet")
|
|
||||||
Dim endgültigerDateiname As String = ""
|
Dim endgültigerDateiname As String = ""
|
||||||
' Objekt für Datei und Zielverzeichnis anlegen
|
clsLogger.AddDetailLog("Quelldatei gelesen")
|
||||||
' Dim Quelldatei_Name As String = Path.GetFileName(filenameQuelle)
|
If Ziel.StartsWith("W:") Then
|
||||||
|
endgültigerDateiname = Ziel.Substring(2)
|
||||||
|
End If
|
||||||
|
|
||||||
clsLogger.AddDetailLog(" >> Quelldatei gelesen")
|
If WD_PATH_EXISTS(zielpfad) = True Then
|
||||||
|
clsLogger.AddDetailLog("targetPath exisitiert")
|
||||||
|
clsLogger.AddDetailLog("Datei kopieren von " & filenameQuelle & " nach " & endgültigerDateiname & ".")
|
||||||
|
|
||||||
'########
|
|
||||||
endgültigerDateiname = filenameZiel.Substring(2)
|
|
||||||
If My.Computer.FileSystem.DirectoryExists(zielpfad) Then
|
|
||||||
clsLogger.AddDetailLog(" >> targetPath exisitiert")
|
|
||||||
' Überprüfen ob der zu Kopieren notwendige Speicherplatz auf Ziellaufwerk vorhanden ist
|
|
||||||
Dim dvr As New DriveInfo("W:")
|
|
||||||
Dim freeSpace = dvr.TotalFreeSpace
|
|
||||||
|
|
||||||
Dim info As New FileInfo(filenameQuelle)
|
|
||||||
' Get length of the file.
|
|
||||||
Dim length As Long = info.Length
|
|
||||||
If freeSpace < length Then
|
|
||||||
clsLogger.Add("Not enough space on filestore", True)
|
|
||||||
Return -10
|
|
||||||
End If
|
|
||||||
|
|
||||||
clsLogger.AddDetailLog(" >> Datei kopieren von " & filenameQuelle & " nach " & endgültigerDateiname & ".")
|
|
||||||
Dim Connect
|
|
||||||
Dim Session
|
|
||||||
Dim WMObject
|
Dim WMObject
|
||||||
Dim aFileIO
|
Dim aFileIO
|
||||||
Dim aWMStream
|
Dim aWMStream
|
||||||
Dim wmbrwsr
|
Dim wmbrwsr
|
||||||
Dim dmsServer As String
|
Dim dmsServer As String
|
||||||
clsLogger.AddDetailLog(" >> Connect definieren: CreateObject('Windream.WMConnect')")
|
|
||||||
Connect = CreateObject("Windream.WMConnect")
|
|
||||||
aFileIO = New WMOTOOLLib.WMFileIO
|
aFileIO = New WMOTOOLLib.WMFileIO
|
||||||
'If My.Settings.DLL_WMOTOOL = "" Then
|
'If My.Settings.DLL_WMOTOOL = "" Then
|
||||||
' aFileIO = New WMOTOOLLib.WMFileIO
|
' aFileIO = New WMOTOOLLib.WMFileIO
|
||||||
' clsLogger.AddDetailLog(" >> Direkter Verweis auf New WMOTOOLLib.WMFileIO")
|
' clsLogger.AddDetailLog("Direkter Verweis auf New WMOTOOLLib.WMFileIO")
|
||||||
'Else
|
'Else
|
||||||
' aFileIO = CreateObject(My.Settings.DLL_WMOTOOL) 'WMOTool.WMFileIO oder WMOTOOLLib.WMFileIO
|
' aFileIO = CreateObject(My.Settings.DLL_WMOTOOL) 'WMOTool.WMFileIO oder WMOTOOLLib.WMFileIO
|
||||||
' clsLogger.AddDetailLog(" >> Verwendeter Verweis aus Anwendungsstring: '" & My.Settings.DLL_WMOTOOL & "'")
|
' clsLogger.AddDetailLog("Verwendeter Verweis aus Anwendungsstring: '" & My.Settings.DLL_WMOTOOL & "'")
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
wmbrwsr = CreateObject("WMOBrws.ServerBrowser")
|
wmbrwsr = CreateObject("WMOBrws.ServerBrowser")
|
||||||
@ -350,67 +408,48 @@ Public Class clsWindream
|
|||||||
' get the current DMS-server to log in
|
' get the current DMS-server to log in
|
||||||
'==================================================================
|
'==================================================================
|
||||||
dmsServer = wmbrwsr.GetCurrentServer
|
dmsServer = wmbrwsr.GetCurrentServer
|
||||||
'==================================================================
|
|
||||||
' create a session
|
|
||||||
'==================================================================
|
|
||||||
'Prüfen ob sich personifiziert angemeldet werden muss?
|
|
||||||
|
|
||||||
Session = GetWMSessionAsUser(My.Settings.AD_DOMAIN, My.Settings.AD_SERVER, My.Settings.AD_USER, My.Settings.AD_USER_PW)
|
|
||||||
|
|
||||||
'==================================================================
|
|
||||||
' login session
|
|
||||||
'==================================================================
|
|
||||||
Try
|
|
||||||
Connect.LoginSession(Session)
|
|
||||||
Dim LoggedIn = Session.aLoggedin
|
|
||||||
If LoggedIn Then
|
|
||||||
clsLogger.AddDetailLog(" >> Login ok. You are logged in as '" & Connect.UserName & "' on Server '" & dmsServer)
|
|
||||||
'MsgBox("Login ok. You are logged in as '" + Connect.UserName + "' on Server '" + dmsServer + "'")
|
|
||||||
Else
|
|
||||||
clsLogger.Add(">> Login on dms-Server failed", True)
|
|
||||||
' MsgBox("Login failed. ")
|
|
||||||
End If
|
|
||||||
Catch ex As Exception
|
|
||||||
clsLogger.Add(">> Persionalized session - User is already logged in!'" & Err.Description & "'", True)
|
|
||||||
End Try
|
|
||||||
|
|
||||||
Const WMCOMEventWMSessionNeedIndex = 1
|
Const WMCOMEventWMSessionNeedIndex = 1
|
||||||
|
|
||||||
'windream Objekte erstellen ohne Indexierungs-Event
|
'windream Objekte erstellen ohne Indexierungs-Event
|
||||||
Session.SwitchEvents(WMCOMEventWMSessionNeedIndex, False)
|
WDSession.SwitchEvents(WMCOMEventWMSessionNeedIndex, False)
|
||||||
'==================================================================
|
'==================================================================
|
||||||
' check if files exist
|
' check if files exist
|
||||||
'==================================================================
|
'==================================================================
|
||||||
clsLogger.AddDetailLog(" >> ÜBERPRÜFTER DATEINAME => " & endgültigerDateiname)
|
clsLogger.AddDetailLog("ÜBERPRÜFTER DATEINAME => " & endgültigerDateiname)
|
||||||
Dim wdFilexists As Boolean
|
Dim wdFilexists As Boolean
|
||||||
clsLogger.AddDetailLog(" >> Versuch auf die Datei in W: zuzugreifen und zu sperren...")
|
clsLogger.AddDetailLog("Versuch auf die Datei in windream zuzugreifen und zu sperren...")
|
||||||
wdFilexists = Session.WMObjectExists(WMEntityDocument, endgültigerDateiname, 0, 0)
|
wdFilexists = WDSession.WMObjectExists(WMEntityDocument, endgültigerDateiname, 0, 0)
|
||||||
|
|
||||||
If wdFilexists = False Then
|
If wdFilexists = False Then
|
||||||
clsLogger.AddDetailLog(" >> Datei ist NICHT vorhanden, kann also einfach neu angelegt werden")
|
clsLogger.AddDetailLog("Datei ist NICHT vorhanden, kann also einfach neu angelegt werden")
|
||||||
Err.Clear()
|
Err.Clear()
|
||||||
'==================================================================
|
'==================================================================
|
||||||
' create an object
|
' create an object
|
||||||
'==================================================================
|
'==================================================================
|
||||||
WMObject = Session.GetNewWMObjectFS(WMEntityDocument, endgültigerDateiname, WMObjectEditModeObject)
|
clsLogger.AddDetailLog("Creating WMObject '" & endgültigerDateiname & "'")
|
||||||
|
WMObject = WDSession.GetNewWMObjectFS(WMEntityDocument, endgültigerDateiname, WMObjectEditModeObject)
|
||||||
|
clsLogger.AddDetailLog("WMObject was created....")
|
||||||
If Err.Number > 0 Then
|
If Err.Number > 0 Then
|
||||||
clsLogger.Add(" FEHLER: WMObject konnte nicht erzeugt werden - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER: WMObject konnte nicht erzeugt werden - Error: '" & Err.Description & "'", True)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
' wenn auf die Datei zugeriffen werden konnte ist sie bereits vorhanden -> Datum anhängen
|
' wenn auf die Datei zugeriffen werden konnte ist sie bereits vorhanden -> Datum anhängen
|
||||||
clsLogger.AddDetailLog(" >> Es konnte zugegriffen werden -> DATEI IST BEREITS VORHANDEN")
|
clsLogger.Add("==> DATEI IST BEREITS VORHANDEN", False)
|
||||||
Err.Clear()
|
Err.Clear()
|
||||||
|
WMObject = WDSession.GetWMObjectByPath(WMEntityDocument, endgültigerDateiname)
|
||||||
WMObject = Session.GetNewWMObjectFS(WMEntityDocument, endgültigerDateiname, WMObjectEditModeObject)
|
aktWMObject = WMObject
|
||||||
|
WMFILE_existed = True
|
||||||
If Err.Number > 0 Then
|
If Err.Number > 0 Then
|
||||||
clsLogger.Add(" FEHLER: Neues WMObject (Kopie) konnte nicht erzeugt werden - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER: Neues WMObject (Kopie) konnte nicht erzeugt werden - Error: '" & Err.Description & "'", True)
|
||||||
|
|
||||||
End If
|
End If
|
||||||
clsLogger.AddDetailLog(" >> WMObject zugewiesen")
|
clsLogger.AddDetailLog("WMObject(Existing) was created....")
|
||||||
|
Return True
|
||||||
End If
|
End If
|
||||||
clsLogger.AddDetailLog(" >> ENDGÜLTIGER DATEINAME => " & endgültigerDateiname)
|
|
||||||
|
clsLogger.AddDetailLog("ENDGÜLTIGER DATEINAME => " & endgültigerDateiname)
|
||||||
If WMObject IsNot Nothing Then
|
If WMObject IsNot Nothing Then
|
||||||
|
aktWMObject = WMObject
|
||||||
' lock object for file system access (to change the file itself)
|
' lock object for file system access (to change the file itself)
|
||||||
WMObject.lock()
|
WMObject.lock()
|
||||||
' set fileIO the local source file
|
' set fileIO the local source file
|
||||||
@ -420,7 +459,7 @@ Public Class clsWindream
|
|||||||
clsLogger.Add(" FEHLER: fileIO konnte nicht gesetzt werden - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER: fileIO konnte nicht gesetzt werden - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
||||||
clsLogger.Add(" HINWEIS: Überprüfen Sie den Verweis auf die Bibliotheken 'WMOTool.WMFileIO' UND 'WMOTOOLLib.WMFileIO' und ändern diese in den Anwendungseinstellungen (DLL_WMOTOOL)'", False)
|
clsLogger.Add(" HINWEIS: Überprüfen Sie den Verweis auf die Bibliotheken 'WMOTool.WMFileIO' UND 'WMOTOOLLib.WMFileIO' und ändern diese in den Anwendungseinstellungen (DLL_WMOTOOL)'", False)
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
System.IO.File.Delete("W:\" & endgültigerDateiname)
|
Delete_WDFile(endgültigerDateiname)
|
||||||
Return False
|
Return False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@ -429,17 +468,17 @@ Public Class clsWindream
|
|||||||
If Err.Number > 0 Then
|
If Err.Number > 0 Then
|
||||||
clsLogger.Add(" FEHLER bei OpenStream - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER bei OpenStream - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
System.IO.File.Delete("W:\" & endgültigerDateiname)
|
Delete_WDFile(endgültigerDateiname)
|
||||||
Return False
|
Return False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
clsLogger.AddDetailLog(" >> oWMStream erzeugt")
|
clsLogger.AddDetailLog("oWMStream erzeugt")
|
||||||
' give fileIO helper object the windream stream
|
' give fileIO helper object the windream stream
|
||||||
aFileIO.aWMStream = aWMStream
|
aFileIO.aWMStream = aWMStream
|
||||||
If Err.Number > 0 Then
|
If Err.Number > 0 Then
|
||||||
clsLogger.Add(" FEHLER bei Zuweisen aWMStream zu aFileIO - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER bei Zuweisen aWMStream zu aFileIO - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
System.IO.File.Delete("W:\" & endgültigerDateiname)
|
Delete_WDFile(endgültigerDateiname)
|
||||||
Return False
|
Return False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@ -448,17 +487,17 @@ Public Class clsWindream
|
|||||||
If Err.Number > 0 Then
|
If Err.Number > 0 Then
|
||||||
clsLogger.Add(" FEHLER bei FileIO.ImportOriginal(True) - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER bei FileIO.ImportOriginal(True) - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
System.IO.File.Delete("W:\" & endgültigerDateiname)
|
Delete_WDFile(endgültigerDateiname)
|
||||||
Return False
|
Return False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
clsLogger.AddDetailLog(" >> Inhalt der Datei konnte übertragen werden")
|
clsLogger.AddDetailLog("Inhalt der Datei konnte übertragen werden")
|
||||||
' close the windream file stream
|
' close the windream file stream
|
||||||
aWMStream.Close()
|
aWMStream.Close()
|
||||||
If Err.Number > 0 Then
|
If Err.Number > 0 Then
|
||||||
clsLogger.Add(" FEHLER bei aWMStream.Close() - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER bei aWMStream.Close() - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
System.IO.File.Delete("W:\" & endgültigerDateiname)
|
Delete_WDFile(endgültigerDateiname)
|
||||||
Return False
|
Return False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@ -467,77 +506,42 @@ Public Class clsWindream
|
|||||||
If Err.Number > 0 Then
|
If Err.Number > 0 Then
|
||||||
clsLogger.Add(" FEHLER bei WMObject.save - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER bei WMObject.save - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
System.IO.File.Delete("W:\" & endgültigerDateiname)
|
Delete_WDFile(endgültigerDateiname)
|
||||||
|
|
||||||
Return Err.Number
|
Return Err.Number
|
||||||
|
|
||||||
End If
|
End If
|
||||||
clsLogger.AddDetailLog(" >> Datei konnte gespeichert werden")
|
clsLogger.AddDetailLog("Datei konnte gespeichert werden")
|
||||||
' unlock the windream object
|
' unlock the windream object
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
If Err.Number > 0 Then
|
If Err.Number > 0 Then
|
||||||
clsLogger.Add(" FEHLER bei WMObject.unlock - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
clsLogger.Add(" FEHLER bei WMObject.unlock - Datei wird wieder gelöscht - Error: '" & Err.Description & "'", True)
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
System.IO.File.Delete("W:\" & endgültigerDateiname)
|
Delete_WDFile(endgültigerDateiname)
|
||||||
|
|
||||||
Return False
|
Return False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
'DATEI GRÖSSE ERMITTELN - MANCHMAL KOMMT ES VOR DAS DATEIGRÖße 0 ist
|
'DATEI GRÖSSE ERMITTELN - MANCHMAL KOMMT ES VOR DAS DATEIGRÖße 0 ist
|
||||||
Dim info2 As New FileInfo("W:\" & endgültigerDateiname)
|
|
||||||
Dim length1 As Long = info2.Length
|
If endgültigerDateiname.StartsWith("\") Then
|
||||||
If length1 > 0 And Err.Number = 0 Then
|
If endgültigerDateiname.StartsWith("\\") Then
|
||||||
If endgültigerDateiname.StartsWith("\") Then
|
endgültigerDateiname = endgültigerDateiname.Replace("\\", "\")
|
||||||
If endgültigerDateiname.StartsWith("\\") Then
|
|
||||||
endgültigerDateiname = endgültigerDateiname.Replace("\\", "\")
|
|
||||||
Else
|
|
||||||
endgültigerDateiname = endgültigerDateiname
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
endgültigerDateiname = "\" & endgültigerDateiname
|
|
||||||
End If
|
End If
|
||||||
CURRENT_FILEIN_WD = "W:" & endgültigerDateiname
|
|
||||||
CURRENT_FILEIN_WD = CURRENT_FILEIN_WD.Replace("\\", "\")
|
|
||||||
clsLogger.Add(">> File '" & CURRENT_FILEIN_WD & "' was imported.", False)
|
|
||||||
|
|
||||||
|
|
||||||
aktWMObject = WMObject
|
|
||||||
Return True
|
|
||||||
Else
|
Else
|
||||||
If length = 0 Then
|
endgültigerDateiname = "\" & endgültigerDateiname
|
||||||
If ImportAll = False Then
|
|
||||||
System.IO.File.Delete("W:\" & endgültigerDateiname)
|
|
||||||
clsLogger.Add(" Error in Stream File - FileLength = 0, File " & CURRENT_FILEIN_WD & " was deleted", True)
|
|
||||||
Return False
|
|
||||||
Else
|
|
||||||
If endgültigerDateiname.StartsWith("\") Then
|
|
||||||
If endgültigerDateiname.StartsWith("\\") Then
|
|
||||||
endgültigerDateiname = endgültigerDateiname.Replace("\\", "\")
|
|
||||||
Else
|
|
||||||
endgültigerDateiname = endgültigerDateiname
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
endgültigerDateiname = "\" & endgültigerDateiname
|
|
||||||
End If
|
|
||||||
clsLogger.Add(">> ATTENTION in Stream File - FileLength = 0, File " & CURRENT_FILEIN_WD & " will be imported", False)
|
|
||||||
CURRENT_FILEIN_WD = "W:" & endgültigerDateiname
|
|
||||||
CURRENT_FILEIN_WD = CURRENT_FILEIN_WD.Replace("\\", "\")
|
|
||||||
|
|
||||||
'###
|
|
||||||
clsLogger.Add(">> File '" & CURRENT_FILEIN_WD & "' was imported.", False)
|
|
||||||
aktWMObject = WMObject
|
|
||||||
Return True
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
clsLogger.Add("Error in Stream File - Error <> 0", True)
|
|
||||||
Return False
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
CURRENT_FILEIN_WD = endgültigerDateiname
|
||||||
|
CURRENT_FILEIN_WD = CURRENT_FILEIN_WD.Replace("\\", "\")
|
||||||
|
clsLogger.AddDetailLog("File '" & CURRENT_FILEIN_WD & "' was imported.")
|
||||||
|
Return True
|
||||||
Else
|
Else
|
||||||
|
clsLogger.Add("WMObjekt is nothing", True)
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
clsLogger.AddDetailLog(" >> targetPath exisitiert NICHT")
|
clsLogger.Add("targetPath exisitiert NICHT", True)
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -549,20 +553,21 @@ Public Class clsWindream
|
|||||||
End Function
|
End Function
|
||||||
Public Shared Function Delete_WDFile(ByVal WD_File As String)
|
Public Shared Function Delete_WDFile(ByVal WD_File As String)
|
||||||
Try
|
Try
|
||||||
WD_File = WD_File.Substring(2)
|
If WD_File.StartsWith("\") = False Then
|
||||||
|
WD_File = WD_File.Substring(2)
|
||||||
|
End If
|
||||||
Dim WMObject As WINDREAMLib.WMObject '= CreateObject("WINDREAMLib.WMObject") 'New WINDREAMLib.WMObject
|
Dim WMObject As WINDREAMLib.WMObject '= CreateObject("WINDREAMLib.WMObject") 'New WINDREAMLib.WMObject
|
||||||
Try
|
Try
|
||||||
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File) 'WINDREAMLib.WMEntity.WMEntityDocument
|
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File) 'WINDREAMLib.WMEntity.WMEntityDocument
|
||||||
|
clsWindream.CURRENT_WMObject = WMObject
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.Add(">> Could not create WMObject for file '" & WD_File & "' - so it is not existing", False)
|
clsLogger.Add(">> Could not create WMObject for file '" & WD_File & "' - so it is not existing", True)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
clsLogger.AddDetailLog(" >> Deleting started - Object created")
|
|
||||||
WMObject.Delete()
|
WMObject.Delete()
|
||||||
Return True
|
Return True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.Add("Unexpected Error in Delete_WDFile: " & ex.Message, False)
|
clsLogger.Add("Unexpected Error in Delete_WDFile: '" & WD_File & "' " & ex.Message, True)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -574,14 +579,26 @@ Public Class clsWindream
|
|||||||
End If
|
End If
|
||||||
Dim WMObject As WINDREAMLib.WMObject '= CreateObject("WINDREAMLib.WMObject") 'New WINDREAMLib.WMObject
|
Dim WMObject As WINDREAMLib.WMObject '= CreateObject("WINDREAMLib.WMObject") 'New WINDREAMLib.WMObject
|
||||||
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File) 'WINDREAMLib.WMEntity.WMEntityDocument
|
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File) 'WINDREAMLib.WMEntity.WMEntityDocument
|
||||||
clsLogger.AddDetailLog(" >> WDFile_exists - Could create an object")
|
clsLogger.AddDetailLog("WDFile_exists - Could create an object")
|
||||||
Return True
|
Return True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.AddDetailLog(" >> WDFile_exists- Could not create object for file '" & WD_File & "'")
|
clsLogger.AddDetailLog("WDFile_exists- Could not create object for file '" & WD_File & "'")
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
Public Shared Function Create_aktWDObjekt(ByVal WD_File As String)
|
||||||
|
Try
|
||||||
|
WD_File = WD_File.Substring(2)
|
||||||
|
aktWMObject = Nothing
|
||||||
|
aktWMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WD_File) 'WINDREAMLib.WMEntity.WMEntityDocument
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.Add("Unexpected Error in Create_aktWDObjekt: the file' " & WD_File & "' could not be transformed!", True)
|
||||||
|
clsLogger.Add("Error-Description: " & ex.Message, False)
|
||||||
|
' Me.TreeNodeInfos.Add(temp)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Übergibt einer in windream gespeicherten Datei Indexwerte
|
''' Übergibt einer in windream gespeicherten Datei Indexwerte
|
||||||
@ -592,7 +609,7 @@ Public Class clsWindream
|
|||||||
''' <remarks></remarks>
|
''' <remarks></remarks>
|
||||||
Public Shared Function IndexFile(ByVal WD_File As String, ByVal _Indexname As String, ByVal _Value As String, Optional outside As Boolean = False, Optional _objecttype As String = "")
|
Public Shared Function IndexFile(ByVal WD_File As String, ByVal _Indexname As String, ByVal _Value As String, Optional outside As Boolean = False, Optional _objecttype As String = "")
|
||||||
Try
|
Try
|
||||||
clsLogger.AddDetailLog(" >> IndexFile ('" & WD_File & "','" & _Indexname & "','" & _Value & "') was called!")
|
clsLogger.AddDetailLog("IndexFile ('" & WD_File & "','" & _Indexname & "','" & _Value & "') was called!")
|
||||||
|
|
||||||
'' das entsprechende Attribut aus windream auslesen
|
'' das entsprechende Attribut aus windream auslesen
|
||||||
'Dim oAttribute = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, _Indexname)
|
'Dim oAttribute = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, _Indexname)
|
||||||
@ -603,7 +620,7 @@ Public Class clsWindream
|
|||||||
|
|
||||||
|
|
||||||
' den Dokumenttyp schreiben
|
' den Dokumenttyp schreiben
|
||||||
clsLogger.AddDetailLog(" >> Indexing will be started")
|
clsLogger.AddDetailLog("Indexing will be started")
|
||||||
If outside = True Then
|
If outside = True Then
|
||||||
_WDObjekttyp = _objecttype
|
_WDObjekttyp = _objecttype
|
||||||
aktWMObject = Nothing
|
aktWMObject = Nothing
|
||||||
@ -633,7 +650,7 @@ Public Class clsWindream
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
|
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
|
||||||
clsLogger.AddDetailLog(" >> Objecttype '" & _WDObjekttyp & "' was set!")
|
clsLogger.AddDetailLog("Objecttype '" & _WDObjekttyp & "' was set!")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
@ -649,10 +666,10 @@ Public Class clsWindream
|
|||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' wenn das entsperren nicht geklappt hat, dann war die Datei auch nicht gesperrt
|
' wenn das entsperren nicht geklappt hat, dann war die Datei auch nicht gesperrt
|
||||||
End Try
|
End Try
|
||||||
clsLogger.AddDetailLog(" >> File saved / Unlock done")
|
clsLogger.AddDetailLog("File saved / Unlock done")
|
||||||
' wenn bis hierher alles geklappt hat wurde ein Dokumenttyp übergeben
|
' wenn bis hierher alles geklappt hat wurde ein Dokumenttyp übergeben
|
||||||
|
|
||||||
clsLogger.AddDetailLog(" >> Objecttype: " & _WDObjekttyp)
|
clsLogger.AddDetailLog("Objecttype: " & _WDObjekttyp)
|
||||||
|
|
||||||
|
|
||||||
' wenn keine Werte vorhanden sind, soll wenigstens der Dokumenttyp eingetragen werden
|
' wenn keine Werte vorhanden sind, soll wenigstens der Dokumenttyp eingetragen werden
|
||||||
@ -665,26 +682,26 @@ Public Class clsWindream
|
|||||||
|
|
||||||
|
|
||||||
If (GetTypeOfIndexAsIntByName(_Indexname) = WMObjectVariableValueTypeVector) Or GetTypeOfIndexAsIntByName(_Indexname) = 4097 Then
|
If (GetTypeOfIndexAsIntByName(_Indexname) = WMObjectVariableValueTypeVector) Or GetTypeOfIndexAsIntByName(_Indexname) = 4097 Then
|
||||||
clsLogger.AddDetailLog(" >> type vectorfield")
|
clsLogger.AddDetailLog("type vectorfield")
|
||||||
'Am 04.08.2014 aktualisiert: um zu verhindern das die vorangegangene Versionierung "Tilde-Werte" schreibt
|
'Am 04.08.2014 aktualisiert: um zu verhindern das die vorangegangene Versionierung "Tilde-Werte" schreibt
|
||||||
clsLogger.AddDetailLog(" >> value before checking: " & _Value)
|
clsLogger.AddDetailLog("value before checking: " & _Value)
|
||||||
_Value = CheckIndexValue(_Value)
|
_Value = CheckIndexValue(_Value)
|
||||||
'Ausstieg da Fehler in der Überprüfung
|
'Ausstieg da Fehler in der Überprüfung
|
||||||
If _Value Is Nothing Then
|
If _Value Is Nothing Then
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
werte.Add(_Value)
|
werte.Add(_Value)
|
||||||
clsLogger.AddDetailLog(" >> value for indexing: " & _Value)
|
clsLogger.AddDetailLog("value for indexing: " & _Value)
|
||||||
Else
|
Else
|
||||||
'Am 04.08.2014 aktualisiert: um zu verhindern das die vorangegangene Versionierung "Tilde-Werte" schreibt
|
'Am 04.08.2014 aktualisiert: um zu verhindern das die vorangegangene Versionierung "Tilde-Werte" schreibt
|
||||||
clsLogger.AddDetailLog(" >> value before checking: " & _Value)
|
clsLogger.AddDetailLog("value before checking: " & _Value)
|
||||||
_Value = CheckIndexValue(_Value)
|
_Value = CheckIndexValue(_Value)
|
||||||
'Ausstieg da Fehler in der Überprüfung
|
'Ausstieg da Fehler in der Überprüfung
|
||||||
If _Value Is Nothing Then
|
If _Value Is Nothing Then
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
werte.Add(_Value)
|
werte.Add(_Value)
|
||||||
clsLogger.AddDetailLog(" >> value for indexing: " & _Value)
|
clsLogger.AddDetailLog("value for indexing: " & _Value)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim arrIndex() As String = Nothing
|
Dim arrIndex() As String = Nothing
|
||||||
@ -704,6 +721,101 @@ Public Class clsWindream
|
|||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
Public Shared Function IndexaktFile(ByVal _Indexname As String, ByVal _Value As String)
|
||||||
|
Try
|
||||||
|
Try
|
||||||
|
' die Datei sperren
|
||||||
|
aktWMObject.lock()
|
||||||
|
Catch ex As Exception
|
||||||
|
' nichts tun (Datei ist bereits gesperrt)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
' wenn der Datei noch kein Dokumenttyp zugewiesen wurde
|
||||||
|
If aktWMObject.aObjectType.aName = "Standard" Then
|
||||||
|
Try
|
||||||
|
' ihr den entsprechenden Dokumenttyp zuweisen
|
||||||
|
aktWMObject.aObjectType = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.Add("Unexpected Error Setting the objecttype' " & _WDObjekttyp & "'!", True)
|
||||||
|
clsLogger.Add("Error-Description: " & ex.Message, False)
|
||||||
|
aktWMObject.Save()
|
||||||
|
aktWMObject.unlock()
|
||||||
|
' Me.TreeNodeInfos.Add(temp)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
|
||||||
|
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
|
||||||
|
clsLogger.AddDetailLog("Objecttype '" & _WDObjekttyp & "' was set!")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Try
|
||||||
|
aktWMObject.Save()
|
||||||
|
Catch ex As Exception
|
||||||
|
' wenn es einen Fehler beim speichern gab, dann konnte auch kein Dokumenttyp gesetzt werden -> es kann also auch keine
|
||||||
|
' Indexierung stattfinden und die Indexierung muss nicht fortgesetzt werden
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Try
|
||||||
|
aktWMObject.unlock()
|
||||||
|
Catch ex As Exception
|
||||||
|
' wenn das entsperren nicht geklappt hat, dann war die Datei auch nicht gesperrt
|
||||||
|
End Try
|
||||||
|
clsLogger.AddDetailLog("File saved / Unlock done")
|
||||||
|
' wenn bis hierher alles geklappt hat wurde ein Dokumenttyp übergeben
|
||||||
|
|
||||||
|
clsLogger.AddDetailLog("Objecttype: " & _WDObjekttyp)
|
||||||
|
|
||||||
|
|
||||||
|
' wenn keine Werte vorhanden sind, soll wenigstens der Dokumenttyp eingetragen werden
|
||||||
|
|
||||||
|
Dim indexe As String = ""
|
||||||
|
|
||||||
|
Dim werte = New ArrayList
|
||||||
|
|
||||||
|
'Den Typ des Index-Feldes auslesen
|
||||||
|
|
||||||
|
|
||||||
|
If (GetTypeOfIndexAsIntByName(_Indexname) = WMObjectVariableValueTypeVector) Or GetTypeOfIndexAsIntByName(_Indexname) = 4097 Then
|
||||||
|
clsLogger.AddDetailLog("type vectorfield")
|
||||||
|
'Am 04.08.2014 aktualisiert: um zu verhindern das die vorangegangene Versionierung "Tilde-Werte" schreibt
|
||||||
|
clsLogger.AddDetailLog("value before checking: " & _Value)
|
||||||
|
_Value = CheckIndexValue(_Value)
|
||||||
|
'Ausstieg da Fehler in der Überprüfung
|
||||||
|
If _Value Is Nothing Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
werte.Add(_Value)
|
||||||
|
clsLogger.AddDetailLog("value for indexing: " & _Value)
|
||||||
|
Else
|
||||||
|
'Am 04.08.2014 aktualisiert: um zu verhindern das die vorangegangene Versionierung "Tilde-Werte" schreibt
|
||||||
|
clsLogger.AddDetailLog("value before checking: " & _Value)
|
||||||
|
_Value = CheckIndexValue(_Value)
|
||||||
|
'Ausstieg da Fehler in der Überprüfung
|
||||||
|
If _Value Is Nothing Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
werte.Add(_Value)
|
||||||
|
clsLogger.AddDetailLog("value for indexing: " & _Value)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim arrIndex() As String = Nothing
|
||||||
|
Dim arrValue() As String = Nothing
|
||||||
|
ReDim Preserve arrIndex(0)
|
||||||
|
ReDim Preserve arrValue(0)
|
||||||
|
arrIndex(0) = _Indexname
|
||||||
|
arrValue(0) = _Value
|
||||||
|
Return RunIndexing(aktWMObject, arrIndex, arrValue)
|
||||||
|
|
||||||
|
'MsgBox(arr(0) & vbNewLine & indexe)
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
clsLogger.Add("Unexpected Error in IndexFile: the file' " & aktWMObject.aName & "' could not be indexed!", True)
|
||||||
|
clsLogger.Add("Error-Description: " & ex.Message, False)
|
||||||
|
' Me.TreeNodeInfos.Add(temp)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
Public Shared Function File_SetBooleanIndex(ByVal _value As Boolean, ByVal _dok As WINDREAMLib.WMObject, ByVal _Indexname As String, Optional SetOType As Boolean = True)
|
Public Shared Function File_SetBooleanIndex(ByVal _value As Boolean, ByVal _dok As WINDREAMLib.WMObject, ByVal _Indexname As String, Optional SetOType As Boolean = True)
|
||||||
Try
|
Try
|
||||||
If _Indexname <> "" Then
|
If _Indexname <> "" Then
|
||||||
@ -711,7 +823,7 @@ Public Class clsWindream
|
|||||||
Dim akt_Status As Boolean = CBool(_dok.GetVariableValue(_Indexname))
|
Dim akt_Status As Boolean = CBool(_dok.GetVariableValue(_Indexname))
|
||||||
If akt_Status <> _value Then
|
If akt_Status <> _value Then
|
||||||
'Index muß angepasst werden
|
'Index muß angepasst werden
|
||||||
clsLogger.AddDetailLog(" >> Index not set to '" & _value.ToString & "'")
|
clsLogger.AddDetailLog("Index not set to '" & _value.ToString & "'")
|
||||||
Dim arrIndex() As String = Nothing
|
Dim arrIndex() As String = Nothing
|
||||||
Dim arrValue() As String = Nothing
|
Dim arrValue() As String = Nothing
|
||||||
'Nun die Datei indexieren
|
'Nun die Datei indexieren
|
||||||
@ -724,7 +836,7 @@ Public Class clsWindream
|
|||||||
RunIndexing(_dok, arrIndex, arrValue, SetOType)
|
RunIndexing(_dok, arrIndex, arrValue, SetOType)
|
||||||
Else
|
Else
|
||||||
'Validation muß nicht angepasst werden
|
'Validation muß nicht angepasst werden
|
||||||
clsLogger.AddDetailLog(" >> Index already set to '" & _value.ToString & "'")
|
clsLogger.AddDetailLog("Index already set to '" & _value.ToString & "'")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -743,16 +855,16 @@ Public Class clsWindream
|
|||||||
Dim i As Integer = 0
|
Dim i As Integer = 0
|
||||||
Dim indexname As String
|
Dim indexname As String
|
||||||
If aValues.Length = 1 And aValues(0) = "" Then
|
If aValues.Length = 1 And aValues(0) = "" Then
|
||||||
clsLogger.AddDetailLog(" >> Indexvalue is empty - No indexing")
|
clsLogger.AddDetailLog("Indexvalue is empty - No indexing")
|
||||||
End If
|
End If
|
||||||
' wenn der Datei noch kein Dokumenttyp zugewiesen wurde
|
' wenn der Datei noch kein Dokumenttyp zugewiesen wurde
|
||||||
If oDocument.aObjectType.aName <> _WDObjekttyp And setOType = True Then
|
If oDocument.aObjectType.aName <> _WDObjekttyp And setOType = True Then
|
||||||
' ihr den entsprechenden Dokumenttyp zuweisen
|
' ihr den entsprechenden Dokumenttyp zuweisen
|
||||||
oDocument.aObjectType = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
oDocument.aObjectType = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, _WDObjekttyp)
|
||||||
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
|
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
|
||||||
clsLogger.AddDetailLog(" >> Objecttype '" & oDocument.aObjectType.aName & "' was changed to '" & _WDObjekttyp)
|
clsLogger.AddDetailLog("Objecttype '" & oDocument.aObjectType.aName & "' was changed to '" & _WDObjekttyp)
|
||||||
Else
|
Else
|
||||||
clsLogger.AddDetailLog(" >> Objecttype was set already.")
|
clsLogger.AddDetailLog("Objecttype was set already.")
|
||||||
End If
|
End If
|
||||||
If setOType = True Then
|
If setOType = True Then
|
||||||
Try
|
Try
|
||||||
@ -769,7 +881,7 @@ Public Class clsWindream
|
|||||||
indexname = aName
|
indexname = aName
|
||||||
|
|
||||||
clsLogger.AddDetailLog(" ")
|
clsLogger.AddDetailLog(" ")
|
||||||
clsLogger.AddDetailLog(" >> Indexing of index '" & indexname & "'")
|
clsLogger.AddDetailLog("Indexing of index '" & indexname & "'")
|
||||||
|
|
||||||
' das entsprechende Attribut aus windream auslesen
|
' das entsprechende Attribut aus windream auslesen
|
||||||
Dim oAttribute = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, Indizes(i))
|
Dim oAttribute = oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, Indizes(i))
|
||||||
@ -790,37 +902,37 @@ Public Class clsWindream
|
|||||||
Select Case (vType)
|
Select Case (vType)
|
||||||
'Case WMObjectVariableValueTypeUndefined
|
'Case WMObjectVariableValueTypeUndefined
|
||||||
Case WMObjectVariableValueTypeString
|
Case WMObjectVariableValueTypeString
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeString")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeString")
|
||||||
convertValue = CStr(value)
|
convertValue = CStr(value)
|
||||||
Case WMObjectVariableValueTypeInteger
|
Case WMObjectVariableValueTypeInteger
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeInteger")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeInteger")
|
||||||
value = value.ToString.Replace(" ", "")
|
value = value.ToString.Replace(" ", "")
|
||||||
If IsNumeric(value) = False Then
|
If IsNumeric(value) = False Then
|
||||||
clsLogger.AddDetailLog(" >> Attention: Value '" & value & "' can not be converted to integer!")
|
clsLogger.AddDetailLog("Attention: Value '" & value & "' can not be converted to integer!")
|
||||||
End If
|
End If
|
||||||
value = value.ToString.Replace(" ", "")
|
value = value.ToString.Replace(" ", "")
|
||||||
convertValue = CInt(value)
|
convertValue = CInt(value)
|
||||||
_int = True
|
_int = True
|
||||||
Case WMObjectVariableValueTypeFloat
|
Case WMObjectVariableValueTypeFloat
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeFloat")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeFloat")
|
||||||
value = value.ToString.Replace(" ", "")
|
value = value.ToString.Replace(" ", "")
|
||||||
convertValue = CDbl(value)
|
convertValue = CDbl(value)
|
||||||
Case WMObjectVariableValueTypeFixedPoint
|
Case WMObjectVariableValueTypeFixedPoint
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeFixedPoint")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeFixedPoint")
|
||||||
value = value.ToString.Replace(" ", "")
|
value = value.ToString.Replace(" ", "")
|
||||||
convertValue = CDbl(value)
|
convertValue = CDbl(value)
|
||||||
_dbl = True
|
_dbl = True
|
||||||
Case WMObjectVariableValueTypeBoolean
|
Case WMObjectVariableValueTypeBoolean
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeBoolean")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeBoolean")
|
||||||
convertValue = CBool(value)
|
convertValue = CBool(value)
|
||||||
_bool = True
|
_bool = True
|
||||||
Case WMObjectVariableValueTypeDate
|
Case WMObjectVariableValueTypeDate
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeDate")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeDate")
|
||||||
_date = True
|
_date = True
|
||||||
'Dim _date As Date = value
|
'Dim _date As Date = value
|
||||||
convertValue = value
|
convertValue = value
|
||||||
Case WMObjectVariableValueTypeTimeStamp
|
Case WMObjectVariableValueTypeTimeStamp
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeTimeStamp")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeTimeStamp")
|
||||||
convertValue = CDbl(value)
|
convertValue = CDbl(value)
|
||||||
Case WMObjectVariableValueTypeCurrency
|
Case WMObjectVariableValueTypeCurrency
|
||||||
clsLogger.AddDetailLog(" - type of windreamIndex WMObjectVariableValueTypeCurrency")
|
clsLogger.AddDetailLog(" - type of windreamIndex WMObjectVariableValueTypeCurrency")
|
||||||
@ -828,7 +940,7 @@ Public Class clsWindream
|
|||||||
Dim aValueWrapper As System.Runtime.InteropServices.CurrencyWrapper = New System.Runtime.InteropServices.CurrencyWrapper(CDec(value))
|
Dim aValueWrapper As System.Runtime.InteropServices.CurrencyWrapper = New System.Runtime.InteropServices.CurrencyWrapper(CDec(value))
|
||||||
convertValue = aValueWrapper
|
convertValue = aValueWrapper
|
||||||
Case WMObjectVariableValueTypeTime
|
Case WMObjectVariableValueTypeTime
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeTime")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeTime")
|
||||||
'If ((value)) Then
|
'If ((value)) Then
|
||||||
' convertValue = CDate(value)
|
' convertValue = CDate(value)
|
||||||
'Else
|
'Else
|
||||||
@ -837,54 +949,54 @@ Public Class clsWindream
|
|||||||
'Dim _date As Date = value
|
'Dim _date As Date = value
|
||||||
convertValue = convertValue '*_date.ToShortTimeString
|
convertValue = convertValue '*_date.ToShortTimeString
|
||||||
Case WMObjectVariableValueTypeFloat
|
Case WMObjectVariableValueTypeFloat
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeFloat")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeFloat")
|
||||||
convertValue = CStr(value)
|
convertValue = CStr(value)
|
||||||
Case WMObjectVariableValueTypeVariant
|
Case WMObjectVariableValueTypeVariant
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeVariant")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeVariant")
|
||||||
convertValue = CStr(value)
|
convertValue = CStr(value)
|
||||||
Case WMObjectVariableValueTypeFulltext
|
Case WMObjectVariableValueTypeFulltext
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex WMObjectVariableValueTypeFulltext")
|
clsLogger.AddDetailLog("type of windreamIndex WMObjectVariableValueTypeFulltext")
|
||||||
convertValue = CStr(value)
|
convertValue = CStr(value)
|
||||||
Case 4097
|
Case 4097
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex 4097 Vektor alphanumerisch")
|
clsLogger.AddDetailLog("type of windreamIndex 4097 Vektor alphanumerisch")
|
||||||
'Vektor alphanumerisch
|
'Vektor alphanumerisch
|
||||||
vektor = True
|
vektor = True
|
||||||
Case 4098
|
Case 4098
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex 4098 Vektor Numerisch")
|
clsLogger.AddDetailLog("type of windreamIndex 4098 Vektor Numerisch")
|
||||||
'Vektor Numerisch
|
'Vektor Numerisch
|
||||||
vektor = True
|
vektor = True
|
||||||
Case 4099
|
Case 4099
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex 4099 Vektor Kommazahl")
|
clsLogger.AddDetailLog("type of windreamIndex 4099 Vektor Kommazahl")
|
||||||
'Vektor Kommazahl
|
'Vektor Kommazahl
|
||||||
vektor = True
|
vektor = True
|
||||||
Case 4100
|
Case 4100
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex 4100 Vektor Boolean")
|
clsLogger.AddDetailLog("type of windreamIndex 4100 Vektor Boolean")
|
||||||
'Vektor Kommazahl
|
'Vektor Kommazahl
|
||||||
vektor = True
|
vektor = True
|
||||||
Case 4101
|
Case 4101
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex 4101 Vektor Date")
|
clsLogger.AddDetailLog("type of windreamIndex 4101 Vektor Date")
|
||||||
'Vektor Kommazahl
|
'Vektor Kommazahl
|
||||||
vektor = True
|
vektor = True
|
||||||
Case 4103
|
Case 4103
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex 4103 Vektor DateTime")
|
clsLogger.AddDetailLog("type of windreamIndex 4103 Vektor DateTime")
|
||||||
'Vektor DateTime
|
'Vektor DateTime
|
||||||
vektor = True
|
vektor = True
|
||||||
Case 4107
|
Case 4107
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex 4107 Integer 64bit")
|
clsLogger.AddDetailLog("type of windreamIndex 4107 Integer 64bit")
|
||||||
vektor = True
|
vektor = True
|
||||||
Case 36865
|
Case 36865
|
||||||
clsLogger.AddDetailLog(" >> type of windreamIndex 36865 Vektor alphanumerisch")
|
clsLogger.AddDetailLog("type of windreamIndex 36865 Vektor alphanumerisch")
|
||||||
'Vektor Kommazahl
|
'Vektor Kommazahl
|
||||||
vektor = True
|
vektor = True
|
||||||
Case Else
|
Case Else
|
||||||
clsLogger.AddDetailLog(" >> Typ des windream-Indexes konnte nicht bestimmt werden!")
|
clsLogger.AddDetailLog("Typ des windream-Indexes konnte nicht bestimmt werden!")
|
||||||
clsLogger.AddDetailLog(" >> Versuch des Auslesens (vType): " & vType)
|
clsLogger.AddDetailLog("Versuch des Auslesens (vType): " & vType)
|
||||||
|
|
||||||
convertValue = ""
|
convertValue = ""
|
||||||
End Select
|
End Select
|
||||||
If vektor = False Then
|
If vektor = False Then
|
||||||
If convertValue.ToString Is Nothing = False Then
|
If convertValue.ToString Is Nothing = False Then
|
||||||
clsLogger.AddDetailLog(" >> Converted valuet: '" & convertValue.ToString & "'")
|
clsLogger.AddDetailLog("Converted valuet: '" & convertValue.ToString & "'")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
'############################################################################################
|
'############################################################################################
|
||||||
@ -893,7 +1005,7 @@ Public Class clsWindream
|
|||||||
If vektor = False Then
|
If vektor = False Then
|
||||||
Try
|
Try
|
||||||
If convertValue.ToString Is Nothing = False Then
|
If convertValue.ToString Is Nothing = False Then
|
||||||
clsLogger.AddDetailLog(" >> Now: oDocument.SetVariableValue(" & aName & ", " & convertValue & ")")
|
clsLogger.AddDetailLog("Now: oDocument.SetVariableValue(" & aName & ", " & convertValue & ")")
|
||||||
If _int = True Then
|
If _int = True Then
|
||||||
convertValue = convertValue.ToString.Replace(" ", "")
|
convertValue = convertValue.ToString.Replace(" ", "")
|
||||||
oDocument.SetVariableValue(aName, CInt(convertValue))
|
oDocument.SetVariableValue(aName, CInt(convertValue))
|
||||||
@ -910,11 +1022,11 @@ Public Class clsWindream
|
|||||||
'Die Datei speichern
|
'Die Datei speichern
|
||||||
oDocument.Save()
|
oDocument.Save()
|
||||||
|
|
||||||
clsLogger.AddDetailLog(" >> index '" & aName & "' was written")
|
clsLogger.AddDetailLog("index '" & aName & "' was written")
|
||||||
clsLogger.AddDetailLog("")
|
clsLogger.AddDetailLog("")
|
||||||
|
|
||||||
Else
|
Else
|
||||||
clsLogger.Add(" >> No indexvalue exists", False)
|
clsLogger.Add("No indexvalue exists", False)
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.Add("Unexpected Error in SetVariableValue für Index '" & aName & "': " & ex.Message, True)
|
clsLogger.Add("Unexpected Error in SetVariableValue für Index '" & aName & "': " & ex.Message, True)
|
||||||
@ -925,10 +1037,10 @@ Public Class clsWindream
|
|||||||
|
|
||||||
Else
|
Else
|
||||||
'VEKTORFELDER, ALSO ÜBERPRÜFEN OB ERGEBNIS-ARRAY GEFÜLLT IST
|
'VEKTORFELDER, ALSO ÜBERPRÜFEN OB ERGEBNIS-ARRAY GEFÜLLT IST
|
||||||
clsLogger.AddDetailLog(" >> Vectorfield: Preparing of Array")
|
clsLogger.AddDetailLog("Vectorfield: Preparing of Array")
|
||||||
Dim myArray()
|
Dim myArray()
|
||||||
'If aValues.Length = 2 And aValues(0) = "" Then
|
'If aValues.Length = 2 And aValues(0) = "" Then
|
||||||
' clsLogger.AddDetailLog(" >> Indexwert ist leer/Nothing - Keine Nachindexierung")
|
' clsLogger.AddDetailLog("Indexwert ist leer/Nothing - Keine Nachindexierung")
|
||||||
'End If
|
'End If
|
||||||
'For Each row As DataRow In DT.Rows
|
'For Each row As DataRow In DT.Rows
|
||||||
|
|
||||||
@ -936,11 +1048,11 @@ Public Class clsWindream
|
|||||||
Dim Anzahl As Integer = aValues.Length
|
Dim Anzahl As Integer = aValues.Length
|
||||||
'Vektorfeld wird mit EINEM Wert gefüllt
|
'Vektorfeld wird mit EINEM Wert gefüllt
|
||||||
If Anzahl = 1 Then
|
If Anzahl = 1 Then
|
||||||
clsLogger.AddDetailLog(" >> Vectorfield will be filled with ONE VALUE")
|
clsLogger.AddDetailLog("Vectorfield will be filled with ONE VALUE")
|
||||||
ReDim myArray(0)
|
ReDim myArray(0)
|
||||||
myArray(0) = Convert_VectorType(vType, value)
|
myArray(0) = Convert_VectorType(vType, value)
|
||||||
'Jetzt überprüfen ob Werte in Vektorfeld angefügt oder überschrieben werden sollen
|
'Jetzt überprüfen ob Werte in Vektorfeld angefügt oder überschrieben werden sollen
|
||||||
clsLogger.AddDetailLog(" >> Converted Value: " & myArray(0).ToString)
|
clsLogger.AddDetailLog("Converted Value: " & myArray(0).ToString)
|
||||||
Dim VektorArray()
|
Dim VektorArray()
|
||||||
VektorArray = Return_VektorArray(oDocument, aName, myArray, vType)
|
VektorArray = Return_VektorArray(oDocument, aName, myArray, vType)
|
||||||
If VektorArray Is Nothing = False Then
|
If VektorArray Is Nothing = False Then
|
||||||
@ -949,7 +1061,7 @@ Public Class clsWindream
|
|||||||
'Jetzt die Nachindexierung für Vektor-Felder
|
'Jetzt die Nachindexierung für Vektor-Felder
|
||||||
oDocument.SetVariableValue(aName, myArray) '
|
oDocument.SetVariableValue(aName, myArray) '
|
||||||
If LOG_ERRORS_ONLY = False Then
|
If LOG_ERRORS_ONLY = False Then
|
||||||
clsLogger.AddDetailLog(" >> Vectorindex '" & aName & "' was written")
|
clsLogger.AddDetailLog("Vectorindex '" & aName & "' was written")
|
||||||
clsLogger.AddDetailLog("")
|
clsLogger.AddDetailLog("")
|
||||||
End If
|
End If
|
||||||
'Die Änderungen festsschreiben/speichern
|
'Die Änderungen festsschreiben/speichern
|
||||||
@ -962,18 +1074,18 @@ Public Class clsWindream
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
clsLogger.AddDetailLog(" >> Array of indexvalues is nothing - No indexing")
|
clsLogger.AddDetailLog("Array of indexvalues is nothing - No indexing")
|
||||||
End If
|
End If
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
Next
|
Next
|
||||||
oDocument.unlock()
|
oDocument.unlock()
|
||||||
|
|
||||||
clsLogger.AddDetailLog(" >> ...and unlock.")
|
clsLogger.AddDetailLog("...and unlock.")
|
||||||
|
|
||||||
Return True
|
Return True
|
||||||
Else
|
Else
|
||||||
clsLogger.Add(" >> document is locked!", False)
|
clsLogger.Add("document is locked!", False)
|
||||||
'oDocument.unlock()
|
'oDocument.unlock()
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
@ -1015,14 +1127,14 @@ Public Class clsWindream
|
|||||||
ValueArray(Anzahl) = Convert_VectorType(vType, NewValue)
|
ValueArray(Anzahl) = Convert_VectorType(vType, NewValue)
|
||||||
Anzahl += 1
|
Anzahl += 1
|
||||||
Else
|
Else
|
||||||
clsLogger.Add(" >> Value '" & NewValue.ToString & "' already existing in vectorfield", False)
|
clsLogger.Add("Value '" & NewValue.ToString & "' already existing in vectorfield", False)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
clsLogger.AddDetailLog(" >> vectorfield is empty....")
|
clsLogger.AddDetailLog("vectorfield is empty....")
|
||||||
'Den/die Neuen Wert(e) anfügen
|
'Den/die Neuen Wert(e) anfügen
|
||||||
For Each NewValue As Object In arr_Indexwerte
|
For Each NewValue As Object In arr_Indexwerte
|
||||||
If NewValue Is Nothing = False Then
|
If NewValue Is Nothing = False Then
|
||||||
@ -1034,7 +1146,7 @@ Public Class clsWindream
|
|||||||
ValueArray(Anzahl) = Convert_VectorType(vType, NewValue)
|
ValueArray(Anzahl) = Convert_VectorType(vType, NewValue)
|
||||||
Anzahl += 1
|
Anzahl += 1
|
||||||
Else
|
Else
|
||||||
clsLogger.Add(" >> Value '" & NewValue.ToString & "' already existing in Array", False)
|
clsLogger.Add("Value '" & NewValue.ToString & "' already existing in Array", False)
|
||||||
End If
|
End If
|
||||||
Else 'Dererste Wert, also hinzufügen
|
Else 'Dererste Wert, also hinzufügen
|
||||||
'Das Array anpassen
|
'Das Array anpassen
|
||||||
@ -1064,7 +1176,7 @@ Public Class clsWindream
|
|||||||
Try
|
Try
|
||||||
' ein windream-Objekt der Datei erzeugen
|
' ein windream-Objekt der Datei erzeugen
|
||||||
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, FILEPATH.Substring(2))
|
WMObject = oSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, FILEPATH.Substring(2))
|
||||||
clsLogger.AddDetailLog(" >> wibdreamObject created")
|
clsLogger.AddDetailLog("wibdreamObject created")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.Add("Unexpected Error in Initializing windream file: " & ex.Message, False)
|
clsLogger.Add("Unexpected Error in Initializing windream file: " & ex.Message, False)
|
||||||
Return False
|
Return False
|
||||||
@ -1110,13 +1222,13 @@ Public Class clsWindream
|
|||||||
WMObject.SetVariableValue(vktIndexName, ValueArray)
|
WMObject.SetVariableValue(vktIndexName, ValueArray)
|
||||||
' die Indexinformationen des Dokuments speichern
|
' die Indexinformationen des Dokuments speichern
|
||||||
WMObject.Save()
|
WMObject.Save()
|
||||||
clsLogger.Add(" >> The new vectorvalues were saved!", False)
|
clsLogger.Add("The new vectorvalues were saved!", False)
|
||||||
' Unlock in einem unbehandelten Try-Block um Fehler abzufangen,
|
' Unlock in einem unbehandelten Try-Block um Fehler abzufangen,
|
||||||
' wenn eine Datei nicht gesperrt ist
|
' wenn eine Datei nicht gesperrt ist
|
||||||
Try
|
Try
|
||||||
' die Sperrung des Dokuments aufheben
|
' die Sperrung des Dokuments aufheben
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
clsLogger.AddDetailLog(" >> die Sperrung des Dokuments aufheben")
|
clsLogger.AddDetailLog("die Sperrung des Dokuments aufheben")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' nichts tun (Datei war nicht gesperrt)
|
' nichts tun (Datei war nicht gesperrt)
|
||||||
End Try
|
End Try
|
||||||
@ -1219,16 +1331,16 @@ Public Class clsWindream
|
|||||||
''' <returns>Liefert True wenn das Indexieren erfolgreich war, sonst False</returns>
|
''' <returns>Liefert True wenn das Indexieren erfolgreich war, sonst False</returns>
|
||||||
''' <remarks></remarks>
|
''' <remarks></remarks>
|
||||||
Private Shared Function Indexiere(ByVal filenameZiel As String, ByVal index As String, ByVal werte As Object)
|
Private Shared Function Indexiere(ByVal filenameZiel As String, ByVal index As String, ByVal werte As Object)
|
||||||
clsLogger.AddDetailLog(" >> In Indexierungsvorgang für: " & filenameZiel)
|
clsLogger.AddDetailLog("In Indexierungsvorgang für: " & filenameZiel)
|
||||||
Try
|
Try
|
||||||
Dim WMObject As WINDREAMLib.WMObject = Nothing '= CreateObject("WINDREAMLib.WMObject") '= New WINDREAMLib.WMObject 'CreateObject("WINDREAMLib.WMObject")
|
Dim WMObject As WINDREAMLib.WMObject = Nothing '= CreateObject("WINDREAMLib.WMObject") '= New WINDREAMLib.WMObject 'CreateObject("WINDREAMLib.WMObject")
|
||||||
'MsgBox("Indexiere: " & vbNewLine & filenameZiel)
|
'MsgBox("Indexiere: " & vbNewLine & filenameZiel)
|
||||||
'werte Is Nothing Or _
|
'werte Is Nothing Or _
|
||||||
' überprüfen ob alle notwendigen Informationen angegeben wurden (sonst abbrechen)
|
' überprüfen ob alle notwendigen Informationen angegeben wurden (sonst abbrechen)
|
||||||
If filenameZiel Is Nothing Or _
|
If filenameZiel Is Nothing Or
|
||||||
filenameZiel = "" Or _
|
filenameZiel = "" Or
|
||||||
index Is Nothing Or _
|
index Is Nothing Or
|
||||||
index = "" Or _
|
index = "" Or
|
||||||
Not ExistIndexInObjekttyp(_WDObjekttyp, index) Then
|
Not ExistIndexInObjekttyp(_WDObjekttyp, index) Then
|
||||||
clsLogger.AddDetailLog("=> Hinweis: Die Datei wurde auf Grund eines Problems in der Initialisierung nicht vollständig indexiert.")
|
clsLogger.AddDetailLog("=> Hinweis: Die Datei wurde auf Grund eines Problems in der Initialisierung nicht vollständig indexiert.")
|
||||||
Return False
|
Return False
|
||||||
@ -1305,7 +1417,7 @@ Public Class clsWindream
|
|||||||
|
|
||||||
' wenn es sich bei dem Index NICHT um ein Vektorfeld handelt
|
' wenn es sich bei dem Index NICHT um ein Vektorfeld handelt
|
||||||
If TypDesIndexes < WMObjectVariableValueTypeVector Then
|
If TypDesIndexes < WMObjectVariableValueTypeVector Then
|
||||||
clsLogger.AddDetailLog(" >> Bei dem Zielindex handelt es sich um einen Einzelindex.")
|
clsLogger.AddDetailLog("Bei dem Zielindex handelt es sich um einen Einzelindex.")
|
||||||
Else
|
Else
|
||||||
clsLogger.AddDetailLog(" Bei dem Zielindex handelt es sich um ein Vektorfeld.")
|
clsLogger.AddDetailLog(" Bei dem Zielindex handelt es sich um ein Vektorfeld.")
|
||||||
' ein Backup der Indexwerte anlegen
|
' ein Backup der Indexwerte anlegen
|
||||||
@ -1315,7 +1427,7 @@ Public Class clsWindream
|
|||||||
' dann soll nur der letzte Wert des Arrays übernommen werden, damit nicht versucht wird ein
|
' dann soll nur der letzte Wert des Arrays übernommen werden, damit nicht versucht wird ein
|
||||||
' Array in einen Einzelindex zu speichern
|
' Array in einen Einzelindex zu speichern
|
||||||
werte = temp
|
werte = temp
|
||||||
clsLogger.AddDetailLog(" >> Array geleert und erneuert!")
|
clsLogger.AddDetailLog("Array geleert und erneuert!")
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
clsLogger.Add("Hinweis: Beim Initialisieren der Datei auf dem windream-Laufwerk ist ein Fehler aufgetreten.", False)
|
clsLogger.Add("Hinweis: Beim Initialisieren der Datei auf dem windream-Laufwerk ist ein Fehler aufgetreten.", False)
|
||||||
@ -1325,7 +1437,7 @@ Public Class clsWindream
|
|||||||
|
|
||||||
'Try
|
'Try
|
||||||
' den Typ des Zielindexes
|
' den Typ des Zielindexes
|
||||||
clsLogger.AddDetailLog(" >> Typ des Indexes: " & TypDesIndexes.ToString)
|
clsLogger.AddDetailLog("Typ des Indexes: " & TypDesIndexes.ToString)
|
||||||
Select Case (TypDesIndexes)
|
Select Case (TypDesIndexes)
|
||||||
Case WMObjectVariableValueTypeUndefined ' zu klären !!!!
|
Case WMObjectVariableValueTypeUndefined ' zu klären !!!!
|
||||||
'convertValue = vbEmpty
|
'convertValue = vbEmpty
|
||||||
@ -1543,13 +1655,13 @@ Public Class clsWindream
|
|||||||
|
|
||||||
' die Indexinformationen des Dokuments speichern
|
' die Indexinformationen des Dokuments speichern
|
||||||
WMObject.Save()
|
WMObject.Save()
|
||||||
clsLogger.AddDetailLog(" >> die Indexinformationen des Dokuments speichern")
|
clsLogger.AddDetailLog("die Indexinformationen des Dokuments speichern")
|
||||||
' Unlock in einem unbehandelten Try-Block um Fehler abzufangen,
|
' Unlock in einem unbehandelten Try-Block um Fehler abzufangen,
|
||||||
' wenn eine Datei nicht gesperrt ist
|
' wenn eine Datei nicht gesperrt ist
|
||||||
Try
|
Try
|
||||||
' die Sperrung des Dokuments aufheben
|
' die Sperrung des Dokuments aufheben
|
||||||
WMObject.unlock()
|
WMObject.unlock()
|
||||||
clsLogger.AddDetailLog(" >> die Sperrung des Dokuments aufheben")
|
clsLogger.AddDetailLog("die Sperrung des Dokuments aufheben")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' nichts tun (Datei war nicht gesperrt)
|
' nichts tun (Datei war nicht gesperrt)
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user