This commit is contained in:
SchreiberM
2016-09-29 16:46:21 +02:00
parent 93528062ba
commit b87def7b40
13 changed files with 191 additions and 323 deletions

View File

@@ -991,7 +991,7 @@ Public Class frmConstructor_Main
RIGHT_WINDREAM_FORBIDDEN = False
tsmi_RecordDelete.Enabled = True
MassenänderungToolStripMenuItem.Enabled = True
DeleteToolStripMenuItem.Enabled = True
TsMI_DocRemoveLink.Enabled = True
UmbenennenToolStripMenuItem.Enabled = True
TSMI_linkRecord.Enabled = True
TSMI_inWork.Enabled = True
@@ -1055,7 +1055,7 @@ Public Class frmConstructor_Main
TSMI_inWork.Enabled = False
PropertiesToolStripMenuItem.Enabled = False
CopyToolStripMenuItem.Enabled = False
DeleteToolStripMenuItem.Enabled = False
TsMI_DocRemoveLink.Enabled = False
tslblLocked.Visible = True
RecordKopierenToolStripMenuItem.Enabled = False
TabFollowUp.PageEnabled = False
@@ -1235,7 +1235,7 @@ Public Class frmConstructor_Main
TreeViewMain.Nodes.Clear()
If NODE_NAVIGATION = True Then
Try
Try
Dim MainNode = ClassNodeNavigation.CreateTreeViewNodes(DT_TREEVIEW_PER_CONTROLS, TREEVIEW_IMAGELIST)
If Not IsNothing(MainNode) Then
TreeViewMain.Nodes.Add(MainNode)
@@ -3869,9 +3869,9 @@ Public Class frmConstructor_Main
Else
If DT_RESULT.Rows.Count > 0 Then 'Es gibt Suchergebnisse
Dim msg As String
msg = "Wollen Sie die zugehörigen windream-Dateien (" & DT_RESULT.Rows.Count.ToString & ") ebenfalls löschen?"
msg = "Wollen Sie die zugehörigen Dateien (" & DT_RESULT.Rows.Count.ToString & ") ebenfalls löschen?"
If USER_LANGUAGE <> "de-DE" Then
msg = "Do You want to delete the related windream-documents (" & DT_RESULT.Rows.Count.ToString & ")?"
msg = "Do You want to delete the related files (" & DT_RESULT.Rows.Count.ToString & ")?"
End If
Dim result1 As MsgBoxResult
result1 = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
@@ -3880,185 +3880,36 @@ Public Class frmConstructor_Main
Dim DOC_ID = row.Item("DocID")
Dim path = row.Item("FULLPATH")
If Not IsNothing(path) Then
If ClassWindream.Delete_WDFile(path) Then
If ClassFileResult.Delete_ResultFile(DOC_ID) = False Then
Dim Count As Integer = ClassDatabase.Execute_Scalar("SELECT COUNT(GUID) FROM TBPMO_DOC_RECORD_LINK WHERE DOC_ID = " & DOC_ID)
If Count > 1 Then
msg = "Diese Datei ist noch mit anderen Datensätzen verknüpft! Lediglich die Verknüpfung zum aktuellen Datensatz wird gelöscht!"
If USER_LANGUAGE <> "de-DE" Then
msg = "This file is also linked to other records! Only the link for this Record will be deleted!"
End If
MsgBox(msg, MsgBoxStyle.Information)
If ClassFileResult.Delete_ResultFile(DOC_ID, RECORD_ID, 0) = False Then
ClassHelper.InsertEssential_Log(row.Item("DOC_ID"), "DOC-ID", "FILE LINK DELETED BY USER")
End If
Else
If ClassFileResult.Delete_ResultFile(DOC_ID, RECORD_ID, 1) = False Then
msg = String.Format("Die Datei {0} konnte nicht gelöscht werden! Prüfen Sie die logfile!", path)
If USER_LANGUAGE <> "de-DE" Then
msg = String.Format("The file {0} could not be deleted! Check the logfile!", path)
End If
MsgBox(msg, MsgBoxStyle.Critical, "Attention:")
Else
If ClassWindream.Delete_WDFile(path) Then
ClassHelper.InsertEssential_Log(row.Item("DOC_ID"), "DOC-ID", "FILE DELETED BY USER")
End If
End If
End If
End If
Next
End If
End If
End If
'Dim windream_temp_search
'If Not windream_Docshow = True Or Sett_LoadWD_Docs = False Then
' Exit Sub
'End If
'Cursor = Cursors.WaitCursor
'Dim DTWD As DataTable
'Dim sql = "SELECT WINDREAM_SEARCH,SEARCH_PATTERN1,SEARCH_PATTERN2,SEARCH_PATTERN3,SEARCH_PATTERN4,SEARCH_PATTERN5 FROM TBPMO_FORM_VIEW WHERE WINDREAM_SEARCH <> '' AND FORM_ID = " & ENTITY_ID
'DTWD = ClassDatabase.Return_Datatable(sql)
'If DTWD.Rows.Count = 1 Then
' If IsDBNull(DTWD.Rows(0).Item(0)) Then
' Cursor = Cursors.Default
' Exit Sub
' End If
'Else
' Cursor = Cursors.Default
' Exit Sub
'End If
''Die SearchPatterns durchlaufen und zwischenspeichern
'If IsDBNull(DTWD.Rows(0).Item(0)) Then
' Cursor = Cursors.Default
' Exit Sub
'End If
'Basesearch = DTWD.Rows(0).Item(0)
'SP1 = DTWD.Rows(0).Item(1)
'If IsDBNull(DTWD.Rows(0).Item(2)) Then
' SP2 = ""
'Else
' SP2 = DTWD.Rows(0).Item(2)
'End If
'If IsDBNull(DTWD.Rows(0).Item(3)) Then
' SP3 = ""
'Else
' SP3 = DTWD.Rows(0).Item(3)
'End If
'If IsDBNull(DTWD.Rows(0).Item(4)) Then
' SP4 = ""
'Else
' SP4 = DTWD.Rows(0).Item(4)
'End If
'If IsDBNull(DTWD.Rows(0).Item(5)) Then
' SP5 = ""
'Else
' SP5 = DTWD.Rows(0).Item(5)
'End If
''Eine tempfile generieren
'Dim tempFilename1 = My.Computer.FileSystem.GetTempFileName()
''Nur den Filenamen ohne Erweiterung
'Dim tempName = Path.GetFileNameWithoutExtension(tempFilename1)
''tempfile lsöchen
'If My.Computer.FileSystem.FileExists(tempFilename1) Then
' My.Computer.FileSystem.DeleteFile(tempFilename1)
'End If
'Dim temppath = Path.GetTempPath
'Dim EncodingFormat As Encoding
'Dim WDUnicode = ClassDatabase.Execute_Scalar("SELECT WD_UNICODE FROM TBPMO_KONFIGURATION WHERE GUID = 1")
'If WDUnicode = True Then
' EncodingFormat = Encoding.GetEncoding(1252) '1252
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Unicode is used (Encoding.GetEncoding(1252))", False)
'Else
' If LogErrorsOnly = False Then ClassLogger.Add(" >> UTF8 (Encoding.GetEncoding(65001))", False)
' EncodingFormat = Encoding.GetEncoding(65001)
'End If
'Dim fileContents As String
'If LogErrorsOnly = False Then ClassLogger.Add(" >> ReadAlltext: " & windream_temp_search, False)
'fileContents = My.Computer.FileSystem.ReadAllText(Basesearch, EncodingFormat) ', System.Text.Encoding.Unicode
'If LogErrorsOnly = False Then ClassLogger.Add(" >> fileContents geladen", False)
'fileContents = fileContents.Replace("Í", "Ö")
'Dim _sp1 = SP1
'Dim _sp2 = SP2
'Dim _sp3 = SP3
'Dim _sp4 = SP4
'Dim _sp5 = SP5
'If _sp1.ToString <> String.Empty Then
' _sp1 = Return_SearchPattern(_sp1.ToString)
' fileContents = fileContents.Replace("%pattern1%", _sp1)
' fileContents = fileContents.Replace("471101", _sp1)
'End If
'If _sp2.ToString <> String.Empty Then
' _sp2 = Return_SearchPattern(_sp2.ToString)
' If _sp2 = 0 Then
' _sp2 = ""
' End If
' fileContents = fileContents.Replace("%pattern2%", _sp2)
' fileContents = fileContents.Replace("471102", _sp2)
'End If
'If _sp3.ToString <> String.Empty Then
' _sp3 = Return_SearchPattern(_sp3.ToString)
' If _sp3 = 0 Then
' _sp3 = ""
' End If
' fileContents = fileContents.Replace("%pattern3%", _sp3)
' fileContents = fileContents.Replace("471103", _sp3)
'End If
'If _sp4.ToString <> String.Empty Then
' _sp4 = Return_SearchPattern(_sp4.ToString)
' If _sp4 = 0 Then
' _sp4 = ""
' End If
' fileContents = fileContents.Replace("%pattern4%", _sp4)
' fileContents = fileContents.Replace("471104", _sp4)
'End If
'If _sp5.ToString <> String.Empty Then
' _sp5 = Return_SearchPattern(_sp5.ToString)
' If _sp5 = 0 Then
' _sp5 = ""
' End If
' fileContents = fileContents.Replace("%pattern5%", _sp5)
' fileContents = fileContents.Replace("471105", _sp5)
'End If
''Die windream File zusammensetzen
'windream_temp_search = temppath & tempName & ".wdf"
'TEMP_FILES.Add(windream_temp_search)
''Die File schreiben
'My.Computer.FileSystem.WriteAllText(windream_temp_search, fileContents, False, EncodingFormat)
'My.Computer.FileSystem.WriteAllText(temppath & "SEARCH_COPY.wdf", fileContents, False, EncodingFormat)
'' XML-Datei öffnen und laden
'Dim Stream As New IO.StreamReader(CStr(windream_temp_search), EncodingFormat)
'Dim Reader As New System.Xml.XmlTextReader(Stream)
'' XML-Datei initialisieren
'Dim xml As New System.Xml.XmlDocument()
'' XML-Datei öffnen und laden
'xml.Load(Reader)
'Reader.Close()
'xml.Save(windream_temp_search)
'If LogErrorsOnly = False Then ClassLogger.Add(" >> Xml Generiert: " & windream_temp_search, False)
'Dim windreamSucheErgebnisse As WINDREAMLib.WMObjects
'Try
' windreamSucheErgebnisse = ClassWindream.GetSearchDocuments(windream_temp_search)
'Catch ex As Exception
' MsgBox("Error in windreamSucheErgebnisse:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
'End Try
'elapsed = sw.Elapsed.TotalSeconds
'If LogErrorsOnly = False Then ClassLogger.Add(" >> GetSearchDocuments took " & Format(elapsed, "0.000000000") & " seconds", False)
'If windreamSucheErgebnisse.Count > 0 Then
' Dim files_deleted As Integer = 0
' For Each dok As WMObject In windreamSucheErgebnisse
' Dim filename = "W:" & dok.aPath
' Try
' File.Delete(filename)
' files_deleted = +1
' Catch ex As Exception
' ClassLogger.Add("Unexpected Error in Delete windream-file '" & filename & "- Error: " & ex.Message)
' End Try
' Dim msg = "Es wurden (" & files_deleted.ToString & ") Dateien gelöscht!"
' If USER_LANGUAGE <> "de-DE" Then
' msg = "(" & files_deleted.ToString & ") files were deleted!"
' End If
' MsgBox(msg, MsgBoxStyle.Information)
' Next
'Else
' Dim msg = "Es wurden keine Dateien für diesen Datensatz gefunden!"
' If USER_LANGUAGE <> "de-DE" Then
' msg = "No files found for record!"
' End If
' MsgBox(msg, MsgBoxStyle.Information)
'End If
Cursor = Cursors.Default
Catch ex As Exception
MsgBox("Error in WD-Delete Docs:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
@@ -4118,7 +3969,7 @@ Public Class frmConstructor_Main
End If
msg &= " (" & DT_RESULT.Rows.Count.ToString & ")"
End If
End If
tslblWindreamView.Text = msg
@@ -4175,10 +4026,10 @@ Public Class frmConstructor_Main
GridControlDocSearch.DataSource = Nothing
'Clear_Windream_ResultList()
End If
elapsed = sw.Elapsed.TotalSeconds
sw.Stop()
sw.Reset()
If LogErrorsOnly = False Then ClassLogger.Add(" >> Run RUN_WDSEARCH_GRID took " & Format(elapsed, "0.000000000") & " seconds", False)
elapsed = sw.Elapsed.TotalSeconds
sw.Stop()
sw.Reset()
If LogErrorsOnly = False Then ClassLogger.Add(" >> Run RUN_WDSEARCH_GRID took " & Format(elapsed, "0.000000000") & " seconds", False)
Catch ex As Exception
MsgBox("Unexpected Error in Run WD-Search Database: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
@@ -5508,7 +5359,7 @@ Public Class frmConstructor_Main
ClassWindreamDocGrid.GetDocItems(GridViewDoc_Search)
End Sub
Private Sub LöschenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click
Private Sub LöschenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TsMI_DocRemoveLink.Click
If RECORD_ID = 0 Then
MsgBox("Please select a record!", MsgBoxStyle.Exclamation)
Exit Sub
@@ -5533,7 +5384,7 @@ Public Class frmConstructor_Main
If ClassWindream.REMOVE_VEKTOR_LINK(row.Item("DOC_PATH"), DT_INDICES.Rows(0).Item("IDXNAME_RECORDID"), RECORD_ID) = True Then
'ENTITY-Links entfernen
If ClassWindream.REMOVE_VEKTOR_LINK(row.Item("DOC_PATH"), DT_INDICES.Rows(0).Item("IDXNAME_ENTITYID"), ENTITY_ID) = True Then
If ClassFileResult.Delete_ResultFile(row.Item("DOC_ID")) = True Then
If ClassFileResult.Delete_ResultFile(row.Item("DOC_ID"), RECORD_ID, 0) = True Then
ClassHelper.InsertEssential_Log(row.Item("DOC_ID"), "DOC-ID", "RECORD LINK REMOVED FROM DOC-SEARCH")
RUN_WDSEARCH_GRID("RECORD")
End If
@@ -5546,7 +5397,7 @@ Public Class frmConstructor_Main
End If
End If
Next
Catch ex As Exception
MsgBox("Unexpected Error in Removing links from file:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
@@ -5922,7 +5773,7 @@ Public Class frmConstructor_Main
End If
Dim fileName As String = ClassWindreamDocGrid.SELECTED_DOC_PATH
CURRENT_DOC_ID = ClassWindreamDocGrid.SELECTED_DOC_ID
Dim frm As New frmWD_Link_to_Record() 'fileName, ClassWindreamDocGrid.RESULT_OBJECTTYPE)
Dim frm As New frmDocLink_to_Record() 'fileName, ClassWindreamDocGrid.RESULT_OBJECTTYPE)
frm.Show()
Catch ex As Exception
MsgBox("Unexpected Error in Linking Record: " & ex.Message, MsgBoxStyle.Critical)
@@ -6207,7 +6058,7 @@ Public Class frmConstructor_Main
End Sub
Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem1.Click
Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles ToolStripMI_DeleteFile.Click
If RECORD_ID = 0 Then
MsgBox("Please select a record!", MsgBoxStyle.Exclamation)
Exit Sub
@@ -6227,9 +6078,22 @@ Public Class frmConstructor_Main
If result1 = MsgBoxResult.Yes Then
Try
If Not IsNothing(row.Item("DOC_ID")) Then
If ClassWindream.Delete_WDFile(row.Item("DOC_PATH")) = True Then
If ClassFileResult.Delete_ResultFile(row.Item("DOC_ID")) = True Then
ClassHelper.InsertEssential_Log(row.Item("DOC_ID"), "DOC-ID", "FILE DELETED BY USER")
Dim Count As Integer = ClassDatabase.Execute_Scalar("SELECT COUNT(GUID) FROM TBPMO_DOC_RECORD_LINK WHERE DOC_ID = " & row.Item("DOC_ID"))
If Count > 1 Then
msg = "Diese Datei ist noch mit anderen Datensätzen verknüpft! Lediglich die Verknüpfung zum aktuellen Datensatz wird gelöscht!"
If USER_LANGUAGE <> "de-DE" Then
msg = "This file is also linked to other records! Only the link for this Record will be deleted!"
End If
MsgBox(msg, MsgBoxStyle.Information)
If ClassFileResult.Delete_ResultFile(row.Item("DOC_ID"), RECORD_ID, 0) = True Then
ClassHelper.InsertEssential_Log(row.Item("DOC_ID"), "DOC-ID", "FILE LINK DELETED BY USER")
End If
RUN_WDSEARCH_GRID("RECORD")
Else
If ClassFileResult.Delete_ResultFile(row.Item("DOC_ID"), RECORD_ID, 1) = True Then
If ClassWindream.Delete_WDFile(row.Item("DOC_PATH")) = True Then
ClassHelper.InsertEssential_Log(row.Item("DOC_ID"), "DOC-ID", "FILE DELETED BY USER")
End If
RUN_WDSEARCH_GRID("RECORD")
Else
msg = String.Format("Die Datei {0} konnte nicht gelöscht werden! Prüfen Sie die logfile!", row.Item("DOC_PATH"))
@@ -6239,6 +6103,7 @@ Public Class frmConstructor_Main
MsgBox(msg, MsgBoxStyle.Critical, "Attention:")
End If
End If
End If
Catch ex As Exception
MsgBox("Unexpected Error in Delete file:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
@@ -6246,7 +6111,7 @@ Public Class frmConstructor_Main
End If
End If
Next
End Sub
End Class