This commit is contained in:
2023-12-21 17:25:29 +01:00
parent d5e084ac6b
commit 2bc0f6a6d7
4 changed files with 211 additions and 151 deletions

View File

@@ -3023,4 +3023,64 @@ LOGGER.Error(ex)
.Name = pRow.ItemEx("NAME", "")
}
End Function
Private Sub tsmiFileDelete_Click(sender As Object, e As EventArgs) Handles tsmiFileDelete.Click
If ClassWindreamDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
MsgBox("Could not read File Parameters (LinkRecord)!", MsgBoxStyle.Exclamation)
Exit Sub
End If
Refresh_Selected_Table()
Dim oDocuments = DocList.SelectedDocuments
Dim msg = "Sind Sie sicher, dass Sie die Datei(en) endgültig löschen wollen?"
If USER_LANGUAGE <> "de-DE" Then
msg = "Are You sure You want to permanently delete this file(s)?"
End If
Dim result1 As MsgBoxResult
result1 = MessageBox.Show(msg, CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result1 = MsgBoxResult.Yes Then
For Each row As DataRow In ClassWindreamDocGrid.DT_RESULTFILES.Rows
If row.Item("DOC_PATH") <> "" Then
Try
If Not IsNothing(row.Item("DOC_ID")) Then
Dim Count As Integer = MYDB_ECM.GetScalarValue("SELECT COUNT(GUID) FROM TBPMO_DOC_RECORD_LINK WHERE DOC_ID = " & row.Item("DOC_ID"))
If Count > 1 And CURRENT_SEARCH_TYPE = "RECORD" Then
msg = "Diese Datei ist noch mit anderen Datensätzen verknüpft! Wollen Sie diese Verknüpfungen ebenfalls löschen?"
If USER_LANGUAGE <> "de-DE" Then
msg = "This file is also linked to other records! Would You like to delete these links also?"
End If
Dim result2 As MsgBoxResult
result2 = MessageBox.Show(msg, CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
Dim oDElWMFile As Boolean = False
If result2 = MsgBoxResult.Yes Then
oDElWMFile = True
End If
If ClassFileResult.Delete_ResultFile(row.Item("DOC_ID"), CURRENT_RECORD_ID, oDElWMFile) = True Then
If oDElWMFile = True Then
ClassHelper.InsertEssential_Log(row.Item("DOC_ID"), "DOC-ID", "FILE DELETED BY USER")
Else
ClassHelper.InsertEssential_Log(row.Item("DOC_ID"), "DOC-ID", "FILE LINK DELETED BY USER")
End If
End If
End If
End If
If LICENSE_PROXY = True And DD_LIB_Standards.clsDatabase.DB_PROXY_INITIALIZED Then
Dim proc = String.Format("EXEC PRPROXY_DOC_CHECK_DELETE {0}", row.Item("DOC_ID"))
MYDB_ECM.ExecuteNonQuery(proc)
End If
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in delete file: ", ex.Message)
End Try
End If
Next
If CURRENT_SEARCH_TYPE = "ENTITY" Then
CURRENT_DT_DOC_ENTITY_SEARCH = Nothing
End If
RUN_WDSEARCH_GRID(True)
End If
End Sub
End Class