MS
This commit is contained in:
@@ -3,6 +3,7 @@ Imports System.Security.AccessControl
|
||||
Imports System.Security.Principal
|
||||
Imports System.Data.SqlClient
|
||||
Imports Oracle.ManagedDataAccess.Client
|
||||
Imports DD_LIB_Standards
|
||||
|
||||
Public Class frmWD_IndexFile
|
||||
Dim droptype As String
|
||||
@@ -20,18 +21,82 @@ Public Class frmWD_IndexFile
|
||||
If ClassImport_Windream.Name_Generieren(DOCTYPE_IDTextBox.Text) = False Then
|
||||
Return False
|
||||
End If
|
||||
If clsWD_GET.WDFile_exists(CURRENT_NEWFILENAME.Substring(2)) = True Then
|
||||
Dim msg = "Eine Datei mit identischem Namen existiert bereits! Wollen Sie die bestehende Datei ersetzen?"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "There is already a file with the same name! Would You like to replace the file?"
|
||||
End If
|
||||
Dim result As MsgBoxResult
|
||||
result = MessageBox.Show(msg, "File alredy exists:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If result = MsgBoxResult.Yes Then
|
||||
If clsWD_SET.Delete_WDFile(CURRENT_NEWFILENAME.Substring(2)) = False Then
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
CURRENT_NEWFILENAME = ClassHelper.Versionierung_Datei(CURRENT_NEWFILENAME)
|
||||
End If
|
||||
End If
|
||||
'#################################################################
|
||||
'Stream File to windream
|
||||
'#################################################################
|
||||
Dim streamresult = ClassWindream.Stream_File(ImportFilePath, VerzeichnisZiel)
|
||||
Dim streamresult = clsWD_SET.Stream_File(ImportFilePath, CURRENT_NEWFILENAME, False)
|
||||
'#################################################################
|
||||
If streamresult = True Then
|
||||
CURRENT_FILEIN_WD = CURRENT_NEWFILENAME
|
||||
Dim sql = "SELECT * FROM TBDD_INDEX_AUTOM WHERE ACTIVE = 1 AND UPPER(INDEXNAME) NOT LIKE UPPER('%ONLY %') AND SQL_ACTIVE = 0 AND DOCTYPE_ID = " & vDokart_ID
|
||||
Dim DT_AUTO_INDEXE As DataTable = ClassDatabase.Return_Datatable(sql, True)
|
||||
Dim indexierung_erfolgreich As Boolean = False
|
||||
'Einbauen dass auch Konfigurationen erlaubt sind wo der Doktyp und der Record fest gestzt sind
|
||||
'Erst die Objekttyp-Indices indexieren
|
||||
'den Entity-Key auslesen
|
||||
Dim DT As DataTable
|
||||
sql = "Select Top 1 * from TBPMO_WD_OBJECTTYPE where Upper(object_type) = Upper('" & clsWindream.MY_WDOBJECTTYPE & "')"
|
||||
DT = ClassDatabase.Return_Datatable(sql, True)
|
||||
If Not DT Is Nothing Then
|
||||
If DT.Rows.Count = 1 Then
|
||||
'den Record_Key auslesen
|
||||
Dim indexname = DT.Rows(0).Item("IDXNAME_RECORDID").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Record-ID: " & CURRENT_RECORD_ID.ToString, False)
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_RECORD_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing RecordID '" & indexname & "') - Check logfile!")
|
||||
Return False
|
||||
End If
|
||||
'den Entity-Key auslesen
|
||||
indexname = DT.Rows(0).Item("IDXNAME_ENTITYID").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Entity-ID: " & CURRENT_ENTITY_ID.ToString, False)
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_ENTITY_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing EntityID '" & indexname & "') - Check logfile!")
|
||||
Return False
|
||||
End If
|
||||
If CURRENT_REDUNDANT_FORM_ID <> 0 Then
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_REDUNDANT_FORM_ID, clsWindream.MY_WDOBJECTTYPE)
|
||||
End If
|
||||
'den Doctype auslesen
|
||||
indexname = DT.Rows(0).Item("IDXNAME_DOCTYPE").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Doctype: " & vDokart.ToString, False)
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, vDokart, clsWindream.MY_WDOBJECTTYPE)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing Doctype '" & indexname & "') - Check logfile!")
|
||||
Return False
|
||||
End If
|
||||
|
||||
indexname = DT.Rows(0).Item("IDXNAME_RELATION").ToString
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, "ADDI-RELATION", clsWindream.MY_WDOBJECTTYPE)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error: ", "Unexpected Error in WorkFile-indexing AddiRelation '" & indexname & "') - Check logfile!")
|
||||
Return False
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If DT_AUTO_INDEXE Is Nothing = False Then 'CHECK DD
|
||||
If DT_AUTO_INDEXE.Rows.Count >= 0 Then
|
||||
If DT_AUTO_INDEXE.Rows.Count > 0 Then
|
||||
Dim Count As Integer = 0
|
||||
For Each row As DataRow In DT_AUTO_INDEXE.Rows
|
||||
Dim indexname = row.Item("INDEXNAME").ToString
|
||||
@@ -91,7 +156,7 @@ Public Class frmWD_IndexFile
|
||||
End If
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value for Indexing : '" & idxvalue.ToString & "'", False)
|
||||
Count += 1
|
||||
indexierung_erfolgreich = ClassWindream.IndexFile(CURRENT_FILEIN_WD, indexname, idxvalue)
|
||||
indexierung_erfolgreich = clsWD_SET.IndexFile(CURRENT_FILEIN_WD, indexname, idxvalue, clsWindream.MY_WDOBJECTTYPE)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Unexpected Error in indexing file - See log", MsgBoxStyle.Critical)
|
||||
err = True
|
||||
@@ -102,123 +167,100 @@ Public Class frmWD_IndexFile
|
||||
If err = True Then
|
||||
Return False
|
||||
End If
|
||||
'den Entity-Key auslesen
|
||||
Dim DT As DataTable
|
||||
sql = "Select Top 1 * from TBPMO_WD_OBJECTTYPE where Upper(object_type) = Upper('" & ClassWindream._WDObjekttyp & "')"
|
||||
DT = ClassDatabase.Return_Datatable(sql, True)
|
||||
If Not dt Is Nothing Then
|
||||
If dt.Rows.Count = 1 Then
|
||||
'den Entity-Key auslesen
|
||||
Dim indexname = dt.Rows(0).Item("IDXNAME_ENTITYID").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Entity-ID: " & CURRENT_ENTITY_ID.ToString, False)
|
||||
indexierung_erfolgreich = ClassWindream.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_ENTITY_ID)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
MsgBox("Unexpected Error in indexing file Entity - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
If CURRENT_REDUNDANT_FORM_ID <> 0 Then
|
||||
indexierung_erfolgreich = ClassWindream.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_REDUNDANT_FORM_ID)
|
||||
End If
|
||||
'den Doctype auslesen
|
||||
indexname = DT.Rows(0).Item("IDXNAME_DOCTYPE").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Doctype: " & vDokart.ToString, False)
|
||||
indexierung_erfolgreich = ClassWindream.IndexFile(CURRENT_FILEIN_WD, indexname, vDokart)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
MsgBox("Unexpected Error in indexing file Doctype - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
'den Record_Key auslesen
|
||||
indexname = dt.Rows(0).Item("IDXNAME_RECORDID").ToString
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Record-ID: " & CURRENT_RECORD_ID.ToString, False)
|
||||
indexierung_erfolgreich = ClassWindream.IndexFile(CURRENT_FILEIN_WD, indexname, CURRENT_RECORD_ID)
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
MsgBox("Unexpected Error in indexing file Record-ID - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
indexname = DT.Rows(0).Item("IDXNAME_RELATION").ToString
|
||||
indexierung_erfolgreich = ClassWindream.IndexFile(CURRENT_FILEIN_WD, indexname, "ADDI-RELATION")
|
||||
If indexierung_erfolgreich = False Then
|
||||
err = True
|
||||
MsgBox("Unexpected Error in indexing file AddiRelation - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Else
|
||||
'MsgBox("Attention in Work-File:" & vbNewLine & "No indices were defined (1)!", MsgBoxStyle.Critical)
|
||||
'Return False
|
||||
End If
|
||||
Else
|
||||
MsgBox("Attention in Work-File:" & vbNewLine & "No indices were defined (0)!", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
'Nun alles aufrüumen und die neue DocID holen
|
||||
|
||||
|
||||
If indexierung_erfolgreich = True Then
|
||||
ClassLogger.Add(">> File was correctly imported and indexed: " & CURRENT_FILEIN_WD, False)
|
||||
Dim stg As String = "Datei erfolgreich nach windream übertragen"
|
||||
Dim stg1 As String = "Erfolgsmeldung"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
stg = "File was successfully transfered to windream"
|
||||
stg1 = "Success:"
|
||||
End If
|
||||
If multiindex = False Then CURRENT_NOTIFICATION_MSG = stg
|
||||
ClassDatabase.Execute_Scalar("UPDATE TBPMO_FILES_USER SET WORKED = 1 WHERE GUID = " & CURRENT_FILEID, True)
|
||||
For Each row As DataRow In CURRENT_TBPMO_FILES_USER.Rows
|
||||
If row.Item("GUID") = CURRENT_FILEID Then
|
||||
row.Item("WORKED") = 1
|
||||
If IsNothing(droptype) Then
|
||||
droptype = row.Item("HANDLE_TYPE")
|
||||
End If
|
||||
End If
|
||||
If indexierung_erfolgreich = True Then
|
||||
ClassLogger.Add(">> File was correctly imported and indexed: " & CURRENT_FILEIN_WD, False)
|
||||
Dim stg As String = "Datei erfolgreich nach windream übertragen"
|
||||
Dim stg1 As String = "Erfolgsmeldung"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
stg = "File was successfully transfered to windream"
|
||||
stg1 = "Success:"
|
||||
Next
|
||||
|
||||
sql = String.Format("SELECT DocID FROM VWPMO_DOC_SYNC WHERE UPPER(FULL_FILENAME) = UPPER('{0}') AND CONVERT(DATE,Change_DateTime) = CONVERT(DATE,GETDATE())", CURRENT_FILEIN_WD)
|
||||
CURRENT_DOC_ID = ClassDatabase.Execute_Scalar(sql)
|
||||
If Not IsNothing(CURRENT_DOC_ID) Then
|
||||
Dim delete = False
|
||||
'Die Originaldatei löschen
|
||||
If droptype = "dragdrop file" And indexierung_erfolgreich = True Then
|
||||
If chkdelete_origin.Checked = True Then
|
||||
'Die temporäre Datei löschen
|
||||
File.Delete(aktFiledropped)
|
||||
End If
|
||||
If multiindex = False Then MsgBox(stg, MsgBoxStyle.Information, stg1)
|
||||
ClassDatabase.Execute_Scalar("UPDATE TBPMO_FILES_USER SET WORKED = 1 WHERE GUID = " & CURRENT_FILEID, True)
|
||||
ElseIf (droptype = "@ATTMNTEXTRACTED@" Or droptype = "SCAN") And indexierung_erfolgreich = True Then
|
||||
'Die temporäre Datei löschen
|
||||
delete = True
|
||||
ElseIf droptype = "dragdrop message" And indexierung_erfolgreich = True Then
|
||||
'Die temporäre Datei löschen
|
||||
delete = True
|
||||
End If
|
||||
If delete = True Then
|
||||
For Each row As DataRow In CURRENT_TBPMO_FILES_USER.Rows
|
||||
If row.Item("GUID") = CURRENT_FILEID Then
|
||||
row.Item("WORKED") = 1
|
||||
row.Item("DELETE_FILE") = True
|
||||
End If
|
||||
Next
|
||||
'Die Originaldatei löschen
|
||||
If droptype = "dragdrop file" And indexierung_erfolgreich = True Then
|
||||
If chkdelete_origin.Checked = True Then
|
||||
'Die temporäre Datei löschen
|
||||
File.Delete(aktFiledropped)
|
||||
End If
|
||||
ElseIf (droptype = "@ATTMNTEXTRACTED@" Or droptype = "SCAN") And indexierung_erfolgreich = True Then
|
||||
'Die temporäre Datei löschen
|
||||
File.Delete(aktFiledropped)
|
||||
ElseIf droptype = "dragdrop message" And indexierung_erfolgreich = True Then
|
||||
'Die temporäre Datei löschen
|
||||
File.Delete(aktFiledropped)
|
||||
End If
|
||||
sql = String.Format("SELECT DocID FROM VWPMO_DOC_SYNC WHERE UPPER(FULL_FILENAME) = UPPER('{0}') AND CONVERT(DATE,Change_DateTime) = CONVERT(DATE,GETDATE())", CURRENT_FILEIN_WD)
|
||||
CURRENT_DOC_ID = ClassDatabase.Execute_Scalar(sql)
|
||||
If Not IsNothing(CURRENT_DOC_ID) Then
|
||||
If ClassDOC_SEARCH.SET_WD_RIGHTS(CURRENT_DOC_ID, CURRENT_FILEIN_WD, CURRENT_ENTITY_ID) = False Then
|
||||
MsgBox("The rights for the new file could not be created! Please check the logfile!" & vbNewLine & _
|
||||
"ADDI will try to give You at least reading rights!", MsgBoxStyle.Exclamation)
|
||||
DD_Rights.ClassRights.SetRightExplicit(CURRENT_DOC_ID, CURRENT_FILEIN_WD, USER_USERNAME, 1)
|
||||
ClassHelper.InsertEssential_Log(CURRENT_DOC_ID, "DOC-ID", "NEW FILE INDEXING - RIGHTS COULD NOT BE SET!!")
|
||||
End If
|
||||
'Create Session um Fehler bei windows Session icht zu erzeugen
|
||||
FAU_AD_USER = ""
|
||||
ClassWindream.Create_Session()
|
||||
If CURRENT_REDUNDANT_FORM_ID <> 0 Then
|
||||
ClassDOC_SEARCH.SET_WD_RIGHTS(CURRENT_DOC_ID, CURRENT_FILEIN_WD, CURRENT_REDUNDANT_FORM_ID)
|
||||
End If
|
||||
ClassFileResult.DocID = CURRENT_DOC_ID
|
||||
ClassFileResult.SET_DOCID_INDICES()
|
||||
If ClassDOC_SEARCH.CREATE_DOC_RELATED_LINKS(CURRENT_DOC_ID, CURRENT_RECORD_ID) = False Then
|
||||
stg = "Unerwarteter Fehler: Der Record-Link konnte nicht erzeugt werden! Überprüfen Sie das Log."
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
stg = "Unexpected Error: Could not create the recordlink! Please check the log."
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
MsgBox(stg, MsgBoxStyle.Critical, stg1)
|
||||
End If
|
||||
Else
|
||||
stg = "Unerwarteter Fehler: Es konnte keine DocID für die übertragene Datei erzeugt werden!"
|
||||
If clsWindream.Create_Session() = False Then
|
||||
MsgBox("Could not create a windream-session!", MsgBoxStyle.Critical)
|
||||
Else
|
||||
If ClassDOC_SEARCH.SET_WD_RIGHTS(CURRENT_DOC_ID, CURRENT_FILEIN_WD, CURRENT_ENTITY_ID) = False Then
|
||||
MsgBox("The rights for the new file could not be created! Please check the logfile!" & vbNewLine & _
|
||||
"ADDI will try to give You at least reading rights!", MsgBoxStyle.Exclamation)
|
||||
DD_Rights.ClassRights.SetRightExplicit(CURRENT_DOC_ID, CURRENT_FILEIN_WD, USER_USERNAME, 1)
|
||||
ClassHelper.InsertEssential_Log(CURRENT_DOC_ID, "DOC-ID", "NEW FILE INDEXING - RIGHTS COULD NOT BE SET!!")
|
||||
End If
|
||||
'Create Session um Fehler bei windows Session nicht zu erzeugen
|
||||
FAU_AD_USER = ""
|
||||
|
||||
If CURRENT_REDUNDANT_FORM_ID <> 0 Then
|
||||
ClassDOC_SEARCH.SET_WD_RIGHTS(CURRENT_DOC_ID, CURRENT_FILEIN_WD, CURRENT_REDUNDANT_FORM_ID)
|
||||
End If
|
||||
ClassFileResult.DocID = CURRENT_DOC_ID
|
||||
ClassFileResult.SET_DOCID_INDICES()
|
||||
If ClassDOC_SEARCH.CREATE_DOC_RELATED_LINKS(CURRENT_DOC_ID, CURRENT_RECORD_ID) = False Then
|
||||
stg = "Unerwarteter Fehler: Der Record-Link konnte nicht erzeugt werden! Überprüfen Sie das Log."
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
stg = "Unexpected Error: Could not get a docId for transmitted file!"
|
||||
stg = "Unexpected Error: Could not create the recordlink! Please check the log."
|
||||
|
||||
End If
|
||||
MsgBox(stg, MsgBoxStyle.Critical, stg1)
|
||||
End If
|
||||
Else
|
||||
MsgBox("An unexpected error occured while indexing file. Please check the log!", MsgBoxStyle.Exclamation)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Else
|
||||
MsgBox("Attention in Work-File:" & vbNewLine & "No indices were defined (1)!", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
stg = "Unerwarteter Fehler: Es konnte keine DocID für die übertragene Datei erzeugt werden!"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
stg = "Unexpected Error: Could not get a docId for transmitted file!"
|
||||
|
||||
End If
|
||||
MsgBox(stg, MsgBoxStyle.Critical, stg1)
|
||||
End If
|
||||
Else
|
||||
MsgBox("Attention in Work-File:" & vbNewLine & "No indices were defined (0)!", MsgBoxStyle.Critical)
|
||||
MsgBox("An unexpected error occured while indexing file. Please check the log!", MsgBoxStyle.Exclamation)
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -362,7 +404,7 @@ Public Class frmWD_IndexFile
|
||||
Try
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
SaveMySettingsValue("WD_IndexDeleteDocs", WD_IndexDeleteDocs, "ConfigMain")
|
||||
ClassWindream._WDObjekttyp = Me.OBJECT_TYPETextBox.Text
|
||||
clsWindream.MY_WDOBJECTTYPE = Me.OBJECT_TYPETextBox.Text
|
||||
|
||||
If chkMultiIndexer.Visible = True And chkMultiIndexer.Checked = True Then
|
||||
'Die erste Datei indexieren
|
||||
@@ -382,6 +424,8 @@ Public Class frmWD_IndexFile
|
||||
droptype = "dragdrop attachment"
|
||||
ElseIf HandleType = "@OUTLOOKMESSAGE@" Then
|
||||
droptype = "dragdrop message"
|
||||
Else
|
||||
droptype = filerow.Item("HANDLE_TYPE")
|
||||
End If
|
||||
If WORK_FILE(CURRENT_FILENAME, Me.PATHTextBox.Text, doctype_id, My.Settings.WD_INDEXDOKART_SAVE, True) = False Then
|
||||
err = True
|
||||
|
||||
Reference in New Issue
Block a user