Mark documents as imported and clean them up when closing app, update to DevExpress 21, small tweaks
This commit is contained in:
@@ -1,24 +1,20 @@
|
||||
Imports System.IO
|
||||
Imports System.Net.Http
|
||||
Imports System.Xml
|
||||
Imports DevExpress.Utils.Behaviors.Common
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraReports.UI
|
||||
Imports DigitalData.GUIs.Common
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports MultiTool.Shared
|
||||
Imports MultiTool.Shared.Documents
|
||||
Imports MultiTool.Shared.Report
|
||||
Imports MultiTool.Shared.Templates
|
||||
Imports MultiTool.Shared.Winline
|
||||
Imports MultiTool.Shared.Winline.Entities
|
||||
Imports MultiTool.Shared.Constants
|
||||
Imports MultiTool.Shared.Exceptions
|
||||
Imports DevExpress.XtraReports.UI
|
||||
Imports MultiTool.Shared.Documents.DocumentRow
|
||||
Imports System.Text.RegularExpressions
|
||||
|
||||
Public Class frmImportMain
|
||||
Public LogConfig As LogConfig
|
||||
@@ -29,7 +25,8 @@ Public Class frmImportMain
|
||||
Private Winline As WinlineData
|
||||
Private FileEx As DigitalData.Modules.Filesystem.File
|
||||
Private WebService As WebServiceData
|
||||
Private DocumentLoader As DocumentLoader
|
||||
Private DocumentLoader As Documents.DocumentLoader
|
||||
Private DocumentCleaner As Documents.DocumentCleaner
|
||||
Private ReportGenerator As ReportGenerator(Of OrderReport)
|
||||
Private FormHelper As FormHelper
|
||||
|
||||
@@ -118,7 +115,9 @@ Public Class frmImportMain
|
||||
lookupMandator.ForceInitialize()
|
||||
lookupMandator.Properties.View.BestFitColumns()
|
||||
|
||||
DocumentLoader = New DocumentLoader(LogConfig, Winline, My.MappingConfiguration, My.TemplateConfiguration)
|
||||
DocumentLoader = New Documents.DocumentLoader(LogConfig, Winline, My.MappingConfiguration, My.TemplateConfiguration)
|
||||
DocumentCleaner = New Documents.DocumentCleaner(LogConfig, My.GeneralConfiguration)
|
||||
|
||||
GridLoader = New GridLoader(LogConfig)
|
||||
ReportGenerator = New ReportGenerator(Of OrderReport)(LogConfig, Database, My.TemplateConfiguration, My.GeneralConfiguration)
|
||||
|
||||
@@ -137,6 +136,14 @@ Public Class frmImportMain
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub frmImportMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
Try
|
||||
DocumentCleaner.CleanImportedDocuments(DocumentLoader.Files)
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowError(ex, "Beenden der Anwendung")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub Grid_Focus(sender As GridControl, e As EventArgs)
|
||||
CurrentGrid = sender
|
||||
End Sub
|
||||
@@ -239,7 +246,7 @@ Public Class frmImportMain
|
||||
btnLoadFiles.Enabled = False
|
||||
SplitContainerGrids.Enabled = False
|
||||
|
||||
AddHandler DocumentLoader.FileLoadComplete, Sub(_sender As Object, _e As DocumentLoader.FileLoadInfo)
|
||||
AddHandler DocumentLoader.FileLoadComplete, Sub(_sender As Object, _e As Documents.DocumentLoader.FileLoadInfo)
|
||||
Dim oMessage = String.Format("Lade Dateien ({0}/{1})", _e.FilesLoaded, _e.FilesTotal)
|
||||
SplashScreenManager.SetWaitFormDescription(oMessage)
|
||||
End Sub
|
||||
@@ -416,6 +423,12 @@ Public Class frmImportMain
|
||||
' Get the document
|
||||
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
|
||||
|
||||
' Check for errors and abort
|
||||
If oDocument.HasErrors = True Then
|
||||
FormHelper.ShowWarning("Diese Datei kann noch nicht übertragen werden, da sie noch Fehler oder fehlende Werte enthält.")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Transfer to winline
|
||||
Await WebService.TransferDocumentToWinline(oDocument, lookupMandator.EditValue)
|
||||
|
||||
@@ -430,6 +443,9 @@ Public Class frmImportMain
|
||||
' Export it to pdf
|
||||
oReport.ExportToPdf(oFilePath)
|
||||
|
||||
' Mark Document as Imported
|
||||
oDocument.Imported = True
|
||||
|
||||
MsgBox(My.Resources.frmImportMainExtra.Datei_erfolgreich_in_die_WinLine_übertragen, MsgBoxStyle.Information, Text)
|
||||
Catch ex As HttpRequestException
|
||||
FormHelper.ShowError(ex, My.Resources.frmImportMainExtra.Übertragung_zur_WinLine, My.Resources.frmImportMainExtra.Die_Verbindung_zum_WinLine_Server_ist_fehlgeschlagen)
|
||||
@@ -551,10 +567,16 @@ Public Class frmImportMain
|
||||
|
||||
Private Sub GridViewFiles_CustomDrawCell(sender As Object, e As Views.Base.RowCellCustomDrawEventArgs) Handles GridViewFiles.CustomDrawCell
|
||||
Dim oDocument As Document = GridViewFiles.GetRow(e.RowHandle)
|
||||
|
||||
If oDocument.HasErrors Then
|
||||
e.Appearance.Options.UseBackColor = True
|
||||
e.Appearance.BackColor = Color.LightCoral
|
||||
End If
|
||||
|
||||
If oDocument.Imported Then
|
||||
e.Appearance.Options.UseBackColor = True
|
||||
e.Appearance.BackColor = Color.LightGreen
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GridView_CustomDrawCell(sender As Object, e As Views.Base.RowCellCustomDrawEventArgs)
|
||||
|
||||
Reference in New Issue
Block a user