MS ExportFiles SelectedPath and PRPM_GETFILENAME_EXPORT

This commit is contained in:
2021-09-21 15:17:34 +02:00
parent 49840b12f7
commit c3c7ff5b38
4 changed files with 33 additions and 13 deletions

View File

@@ -3684,7 +3684,7 @@ Public Class frmValidator
Try
If ButtonExport2Folder_RootFolder <> "" Then
If Directory.Exists(ButtonExport2Folder_RootFolder) Then
FolderBrowserDialog1.RootFolder = ButtonExport2Folder_RootFolder
FolderBrowserDialog1.SelectedPath = ButtonExport2Folder_RootFolder
Else
LOGGER.Warn($"### Dis/Enabale Export2Path - RootFolder {ButtonExport2Folder_RootFolder} not existing or accessible!###")
End If
@@ -5644,21 +5644,38 @@ Public Class frmValidator
Private Sub barbtnitmExport_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles barbtnitmExport.ItemClick
If File.Exists(WMDocPathWindows) Then
Try
d
Dim oFilenameOnly As String
Dim oExtension As String
Dim oTargetPath As String
If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
Dim oCount As Integer = 0
oFilenameOnly = Path.GetFileName(WMDocPathWindows)
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oFilenameOnly
oExtension = Path.GetExtension(WMDocPathWindows)
Dim oSQLGetFilename As String
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbNewLine &
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {CURRENT_DOC_ID}, 1, @Outputfilename = @Filename OUTPUT;" & vbNewLine &
"SELECT Filename"
Dim oExportFilename = Database_ECM.GetScalarValue(oSQLGetFilename)
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oExportFilename & oExtension
File.Copy(WMDocPathWindows, oTargetPath)
oCount += 1
Dim oFileCount As Integer = 1
If Not IsNothing(DT_AdditionalSearches_Resultset_Docs) Then
For Each oFileRecord As DataRow In DT_AdditionalSearches_Resultset_Docs.Rows
Dim oFromFilename = oFileRecord.Item("FULL_FILENAME")
Dim oDocID = oFileRecord.Item("DocID")
If File.Exists(oFromFilename) Then
oFilenameOnly = Path.GetFileName(oFromFilename)
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oFilenameOnly
oFileCount += 1
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbNewLine &
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {oDocID}, {oFileCount}, @Outputfilename = @Filename OUTPUT;" & vbNewLine &
"SELECT Filename"
oExportFilename = Database_ECM.GetScalarValue(oSQLGetFilename)
oExtension = Path.GetExtension(oFromFilename)
'oFilenameOnly = Path.GetFileName(oFromFilename)
oTargetPath = FolderBrowserDialog1.SelectedPath & "\" & oExportFilename & oExtension
File.Copy(oFromFilename, oTargetPath)
oCount += 1
End If