Public Class ClassImport_Windream Public Shared Function Import_File(QuellDatei_Path As String, DOCTYPE_ID As Integer) Try Dim err As Boolean = False Dim DT_DOCTYPE As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBDD_DOKUMENTART WHERE GUID = " & DOCTYPE_ID) If Not IsNothing(DT_DOCTYPE) Then Dim Targetpath As String = DT_DOCTYPE.Rows(0).Item("ZIEL_PFAD") Dim Dokart As String = DT_DOCTYPE.Rows(0).Item("BEZEICHNUNG") ClassWindream._WDObjekttyp = DT_DOCTYPE.Rows(0).Item("OBJEKTTYP") 'Die Datei nach windream importieren Dim streamresult = ClassWindream.Stream_File(QuellDatei_Path, Targetpath) If streamresult = True Then Dim sql = "SELECT * FROM TBDD_INDEX_AUTOM WHERE DOCTYPE_ID = " & DOCTYPE_ID Dim dt As DataTable = ClassDatabase.Return_Datatable(sql) Dim indexierung_erfolgreich As Boolean = False If dt Is Nothing = False Then If dt.Rows.Count > 0 Then Dim Count As Integer = 0 For Each row As DataRow In dt.Rows Dim indexname = row.Item("INDEXNAME").ToString Dim idxvalue = row.Item("VALUE") If idxvalue.ToString.StartsWith("@") Then Select Case idxvalue.ToString.ToUpper Case "@RECORD-ID" idxvalue = idxvalue.ToString.Replace("@Record-ID", CURRENT_RECORD_ID) Case "@DOKART" idxvalue = idxvalue.ToString.Replace("@Dokart", Dokart) End Select End If If LogErrorsOnly = False Then ClassLogger.Add(" - Indexvalue: " & idxvalue.ToString, False) Count += 1 indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_FILEIN_WD, indexname, idxvalue) If indexierung_erfolgreich = False Then MsgBox("Unexpected Error in indexing file - See log", MsgBoxStyle.Critical) err = True Exit For End If 'ByVal WD_File As String, ByVal _Indexname As String, ByVal _Value As String Next If err = True Then Return False End If 'den Entity-Key auslesen sql = "Select Top 1 * from TBPMO_WD_OBJECTTYPE where Upper(object_type) = Upper('" & ClassWindream._WDObjekttyp & "')" dt = ClassDatabase.Return_Datatable(sql) If Not dt Is Nothing Then If dt.Rows.Count = 1 Then Dim indexname = dt.Rows(0).Item("IDXNAME_ENTITYID").ToString Dim idxvalue = CURRENT_FORM_ID If LogErrorsOnly = False Then ClassLogger.Add(" - Entity-ID: " & idxvalue.ToString, False) indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_FILEIN_WD, indexname, idxvalue) If indexierung_erfolgreich = False Then err = True MsgBox("Unexpected Error in indexing file Entity - See log", MsgBoxStyle.Critical) Return False End If indexname = dt.Rows(0).Item("IDXNAME_PARENTID").ToString idxvalue = CURRENT_PARENTID If LogErrorsOnly = False Then ClassLogger.Add(" - Parent-ID: " & idxvalue.ToString, False) indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_FILEIN_WD, indexname, idxvalue) If indexierung_erfolgreich = False Then err = True MsgBox("Unexpected Error in indexing file Parent-ID - See log", MsgBoxStyle.Critical) Return False End If End If End If If indexierung_erfolgreich = True Then Return True Else MsgBox("Es gab ein Problem bei der Indexierung der Datei. Bitte prüfen sie das Log!", MsgBoxStyle.Exclamation, "Achtung:") Return False End If End If End If End If Else Return False End If Catch ex As Exception MsgBox("Unexpected error in Import_File ClassImport_windream: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) Return False End Try End Function End Class