Show Errors, Make grids usable when no mandator is selected, move completed files also when reloading
This commit is contained in:
@@ -22,11 +22,23 @@ Namespace Documents
|
||||
Where(Function(doc) doc.Imported = True).
|
||||
ToList()
|
||||
|
||||
If oImportedDocuments.Count = 0 Then
|
||||
Logger.Debug("No exported files found. Skipping.")
|
||||
Return True
|
||||
End If
|
||||
|
||||
Logger.Debug("Cleaning [{0}] exported files, moving to [{1}]", oImportedDocuments.Count, oOutputDirectory)
|
||||
|
||||
Dim oRemovedDocuments As New List(Of Document)
|
||||
|
||||
For Each oDocument As Document In oImportedDocuments
|
||||
Try
|
||||
Dim oFileinfo = New FileInfo(oDocument.FullName)
|
||||
Dim oDestination = Path.Combine(oOutputDirectory, oFileinfo.Name)
|
||||
File.Move(oFileinfo.FullName, oDestination)
|
||||
oRemovedDocuments.Add(oDocument)
|
||||
|
||||
Logger.Debug("File [{0}] successfully moved.", oFileinfo.Name)
|
||||
Catch ex As Exception
|
||||
Logger.Warn("File [{0}] could not be moved to output directory!", oDocument.FullName)
|
||||
Logger.Error(ex)
|
||||
@@ -34,6 +46,12 @@ Namespace Documents
|
||||
End Try
|
||||
Next
|
||||
|
||||
Logger.Debug("Moved [{0}] files successfully.", oRemovedDocuments.Count)
|
||||
|
||||
pDocuments = pDocuments.
|
||||
Except(oRemovedDocuments).
|
||||
ToList()
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user