First bug fixes
This commit is contained in:
@@ -18,14 +18,13 @@ Imports MultiTool.Shared.Winline
|
||||
Public Class frmImportMain
|
||||
Private LogConfig As LogConfig
|
||||
Private Logger As Logger
|
||||
Private ConfigManager As ConfigManager(Of MultiTool.Shared.Config)
|
||||
Private ConfigManager As ConfigManager(Of Config)
|
||||
Private Database As MSSQLServer
|
||||
Private Winline As Data
|
||||
Private FileEx As DigitalData.Modules.Filesystem.File
|
||||
Private WebService As WebService
|
||||
Private PositionData As PositionData
|
||||
Private DocumentLoader As Documents.DocumentLoader
|
||||
Private SchemaLoader As Schemas.SchemaLoader
|
||||
Private DocumentLoader As DocumentLoader
|
||||
Private SchemaLoader As SchemaLoader
|
||||
Private Message As Message
|
||||
|
||||
Private Grids As List(Of GridControl)
|
||||
@@ -71,14 +70,15 @@ Public Class frmImportMain
|
||||
|
||||
GridBuilder = New GridBuilder(GridViewFiles)
|
||||
GridBuilder.WithDefaults.WithClipboardHandler()
|
||||
GridViewFiles.OptionsView.ShowAutoFilterRow = False
|
||||
|
||||
FileEx = New DigitalData.Modules.Filesystem.File(LogConfig)
|
||||
|
||||
' If ConnectionString does not exist, show SQL Config Form
|
||||
If ConfigManager.Config.ConnectionString = String.Empty Then
|
||||
Dim oForm As New frmSQLConfig(LogConfig) With {
|
||||
.FormTitle = "EDI Document Importer"
|
||||
}
|
||||
.FormTitle = Application.ProductName
|
||||
}
|
||||
Dim oResult = oForm.ShowDialog()
|
||||
|
||||
If oResult = DialogResult.OK Then
|
||||
@@ -92,47 +92,61 @@ Public Class frmImportMain
|
||||
Database = New MSSQLServer(LogConfig, oConnectionString)
|
||||
Winline = New Data(LogConfig, Database, ConfigManager.Config)
|
||||
WebService = New WebService(LogConfig, ConfigManager.Config, Application.UserAppDataPath)
|
||||
PositionData = New PositionData(LogConfig, Winline)
|
||||
Catch ex As Exception
|
||||
ShowError(ex, "Initialisieren der Anwendungs Daten")
|
||||
ShowError(ex, My.Resources.frmImportMainExtra.Initialisieren_der_Anwendungs_Daten)
|
||||
End Try
|
||||
|
||||
txtVersion.Caption = String.Format(txtVersion.Tag.ToString, My.Application.Info.Version.ToString)
|
||||
txtCulture.Caption = String.Format(txtCulture.Tag.ToString, My.Application.UICulture.ToString)
|
||||
End Sub
|
||||
|
||||
Private Async Sub frmImportMain_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
|
||||
btnLoadFiles.Enabled = False
|
||||
SplashScreenManager.ShowWaitForm()
|
||||
|
||||
' Load WinLine Data
|
||||
Try
|
||||
Winline.Mandators.Clear()
|
||||
Winline.LoadMandators()
|
||||
Winline.LoadEconomicYears()
|
||||
Winline.LoadDocumentKinds(Winline.Mandators)
|
||||
Await Winline.LoadMandators()
|
||||
|
||||
' TODO: Comment in when we finally use the database for additional configuration
|
||||
'Winline.LoadTemplateConfiguration()
|
||||
|
||||
For Each oMandator As Mandator In Winline.Mandators
|
||||
Winline.LoadAccounts(oMandator)
|
||||
SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Konten, oMandator.Id))
|
||||
Await Winline.LoadAccounts(oMandator)
|
||||
SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Artikel, oMandator.Id))
|
||||
Await Winline.LoadArticles(oMandator)
|
||||
SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Belegarten, oMandator.Id))
|
||||
Await Winline.LoadDocumentKinds(oMandator)
|
||||
Next
|
||||
|
||||
SplashScreenManager.SetWaitFormDescription(My.Resources.frmImportMainExtra.Lade_Oberfläche)
|
||||
|
||||
lookupMandator.Properties.DataSource = Winline.Mandators
|
||||
lookupMandator.ForceInitialize()
|
||||
lookupMandator.Properties.View.BestFitColumns()
|
||||
Catch ex As Exception
|
||||
ShowError(ex, "Laden der WinLine Daten")
|
||||
End Try
|
||||
|
||||
Try
|
||||
DocumentLoader = New DocumentLoader(LogConfig, Winline)
|
||||
SchemaLoader = New SchemaLoader(LogConfig)
|
||||
GridLoader = New GridLoader(LogConfig)
|
||||
|
||||
SplashScreenManager.SetWaitFormDescription(My.Resources.frmImportMainExtra.Lade_Vorlagen)
|
||||
|
||||
SchemaLoader.LoadFiles(ConfigManager.Config.SchemaDirectory)
|
||||
CurrentSchemaName = SchemaLoader.SchemaList.First().FullName
|
||||
CurrentSchema = SchemaLoader.GetSchemaFromFile(CurrentSchemaName)
|
||||
|
||||
Grids = CreateGridsAndColumns(CurrentSchema)
|
||||
Catch ex As Exception
|
||||
ShowError(ex, "Laden der Vorlagen Daten")
|
||||
ShowError(ex, My.Resources.frmImportMainExtra.Laden_der_Winline_Daten)
|
||||
Finally
|
||||
SplashScreenManager.CloseWaitForm()
|
||||
btnLoadFiles.Enabled = True
|
||||
End Try
|
||||
|
||||
txtVersion.Caption = String.Format(txtVersion.Tag.ToString, My.Application.Info.Version.ToString)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -170,7 +184,7 @@ Public Class frmImportMain
|
||||
End If
|
||||
|
||||
If oTableCounter > 3 Then
|
||||
MsgBox("Only 4 Tables are allowed currently!", MsgBoxStyle.Exclamation, Text)
|
||||
MsgBox(My.Resources.frmImportMainExtra.Zur_Zeit_werden_nur_bis_zu_4_Tabellen_unterstützt_, MsgBoxStyle.Exclamation, Text)
|
||||
End If
|
||||
|
||||
oTableCounter += 1
|
||||
@@ -199,53 +213,50 @@ Public Class frmImportMain
|
||||
Where(Function(r) r.Id.ToString = oRow.Item("GUID")).
|
||||
SingleOrDefault()
|
||||
|
||||
Dim oAccounts = Winline.Accounts.
|
||||
Where(Function(a) a.Mandator = CurrentDocument.Mandator.Id).
|
||||
ToList()
|
||||
|
||||
Dim oForm As New frmRowEditor(oColumns, oDocumentRow, oAccounts)
|
||||
Dim oForm As New frmRowEditor(oColumns, oDocumentRow, CurrentDocument.Mandator, Winline)
|
||||
If oForm.ShowDialog() = DialogResult.OK Then
|
||||
Dim oModifiedRow = oForm.DocumentRow
|
||||
Dim oIndex = CurrentDocument.Rows.IndexOf(oModifiedRow)
|
||||
'Dim oGuid = CurrentDocument.Rows.
|
||||
' Where(Function(r) r.Id = oModifiedRow.Id).
|
||||
' Select(Function(r) r.Id)
|
||||
|
||||
CurrentDocument.Rows.Item(oIndex) = oModifiedRow
|
||||
LoadDocument(CurrentDocument)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex, "Laden der Detailzeilen")
|
||||
ShowError(ex, My.Resources.frmImportMainExtra.Laden_der_Detailzeilen)
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btnLoadFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnLoadFiles.ItemClick
|
||||
Try
|
||||
SplitContainerControl1.Enabled = False
|
||||
SplitContainerGrids.Enabled = False
|
||||
|
||||
If DocumentLoader.LoadFiles(ConfigManager.Config.InputDirectory, CurrentSchema, lookupMandator.EditValue) Then
|
||||
GridControlFiles.DataSource = Nothing
|
||||
GridControlFiles.DataSource = DocumentLoader.Files
|
||||
|
||||
txtFilesLoaded.Caption = String.Format(txtFilesLoaded.Tag.ToString, DocumentLoader.Files.Count)
|
||||
End If
|
||||
Catch ex As Exceptions.NoMandatorException
|
||||
MsgBox("Es konnte kein passender Mandant anhand der geladenen Daten ermittelt werden. Bitte wählen Sie einen aus der Liste.", MsgBoxStyle.Information, Text)
|
||||
MsgBox(My.Resources.frmImportMainExtra.Es_konnte_kein_passender_Mandant_ermittelt_werden, MsgBoxStyle.Information, Text)
|
||||
|
||||
Catch ex As Exception
|
||||
ShowError(ex, "Laden der Dokumente")
|
||||
ShowError(ex, My.Resources.frmImportMainExtra.Laden_der_Detailzeilen)
|
||||
|
||||
Finally
|
||||
SplitContainerControl1.Enabled = True
|
||||
SplitContainerGrids.Enabled = True
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btnReloadFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnReloadFile.ItemClick
|
||||
Dim oCurrentMandator As Mandator = TryCast(lookupMandator.EditValue, Mandator)
|
||||
If oCurrentMandator Is Nothing Then
|
||||
MsgBox("Bitte wählen Sie einen Mandanten aus, bevor Sie fortfahren!", MsgBoxStyle.Exclamation, Text)
|
||||
MsgBox(My.Resources.frmImportMainExtra.Bitte_wählen_Sie_einen_Mandanten_aus__bevor_Sie_fortfahren, MsgBoxStyle.Exclamation, Text)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oResult As DialogResult = MsgBox($"Wollen Sie wirklich die aktuelle Datei mit dem gewählten Mandanten ({oCurrentMandator.Name}) neu laden? Alle von Ihnen getätigten Änderungen werden dabei verworfen.", MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text)
|
||||
Dim oMessage = String.Format(My.Resources.frmImportMainExtra.Wollen_Sie_wirklich_die_aktuelle_Datei_neu_laden, oCurrentMandator)
|
||||
Dim oResult As DialogResult = MsgBox(oMessage, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text)
|
||||
|
||||
Try
|
||||
If oResult = DialogResult.Yes Then
|
||||
@@ -259,10 +270,10 @@ Public Class frmImportMain
|
||||
End If
|
||||
|
||||
Catch ex As Exceptions.NoMandatorException
|
||||
MsgBox("Es konnte kein passender Mandant anhand der geladenen Daten ermittelt werden. Bitte wählen Sie einen aus der Liste.", MsgBoxStyle.Information, Text)
|
||||
MsgBox(My.Resources.frmImportMainExtra.Es_konnte_kein_passender_Mandant_ermittelt_werden, MsgBoxStyle.Information, Text)
|
||||
|
||||
Catch ex As Exception
|
||||
ShowError(ex, "Neuladen des Dokuments")
|
||||
ShowError(ex, My.Resources.frmImportMainExtra.Neuladen_des_Dokuments)
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
@@ -278,7 +289,7 @@ Public Class frmImportMain
|
||||
lookupMandator.EditValue = oDocument.Mandator
|
||||
LoadDocument(oDocument)
|
||||
Catch ex As Exception
|
||||
ShowError(ex, "Laden des Dokuments")
|
||||
ShowError(ex, My.Resources.frmImportMainExtra.Laden_des_Dokuments)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
@@ -350,12 +361,12 @@ Public Class frmImportMain
|
||||
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
|
||||
Await WebService.TransferDocumentToWinline(oDocument)
|
||||
|
||||
MsgBox("Datei erfolgreich in die WinLine übertragen!", MsgBoxStyle.Information, Text)
|
||||
MsgBox(My.Resources.frmImportMainExtra.Datei_erfolgreich_in_die_WinLine_übertragen, MsgBoxStyle.Information, Text)
|
||||
Catch ex As HttpRequestException
|
||||
ShowError(ex, "Übertragung zur WinLine", "Die Verbindung zum WinLine Server ist fehlgeschlagen. Bitte prüfen Sie die Konfiguration des Programs und den Zustand des WinLine Servers")
|
||||
ShowError(ex, My.Resources.frmImportMainExtra.Übertragung_zur_WinLine, My.Resources.frmImportMainExtra.Die_Verbindung_zum_WinLine_Server_ist_fehlgeschlagen)
|
||||
|
||||
Catch ex As Exception
|
||||
ShowError(ex, "Übertragung zur WinLine")
|
||||
ShowError(ex, My.Resources.frmImportMainExtra.Übertragung_zur_WinLine)
|
||||
|
||||
Finally
|
||||
SplitContainerGrids.Enabled = True
|
||||
@@ -367,24 +378,24 @@ Public Class frmImportMain
|
||||
End Sub
|
||||
|
||||
Private Sub btnOpenInputDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenInputDirectory.ItemClick
|
||||
TryOpenDirectory(ConfigManager.Config.InputDirectory, "Eingangsverzeichnis")
|
||||
TryOpenDirectory(ConfigManager.Config.InputDirectory, My.Resources.frmImportMainExtra.Eingangsverzeichnis)
|
||||
End Sub
|
||||
|
||||
Private Sub btnOpenOutputDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenOutputDirectory.ItemClick
|
||||
Dim oOutputDirectory = Path.Combine(Application.UserAppDataPath, "WebService")
|
||||
'Dim oOutputDirectory = IO.Path.Combine(FileEx.GetAppDataPath("Digital Data", "EDI Document Importer"), "WebService")
|
||||
TryOpenDirectory(oOutputDirectory, "Ausgabeverzeichnis")
|
||||
TryOpenDirectory(oOutputDirectory, My.Resources.frmImportMainExtra.Ausgabeverzeichnis)
|
||||
End Sub
|
||||
|
||||
Private Sub btnOpenSchemaDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenSchemaDirectory.ItemClick
|
||||
TryOpenDirectory(ConfigManager.Config.SchemaDirectory, "Vorlagenverzeichnis")
|
||||
TryOpenDirectory(ConfigManager.Config.SchemaDirectory, My.Resources.frmImportMainExtra.Vorlagenverzeichnis)
|
||||
End Sub
|
||||
|
||||
Private Sub TryOpenDirectory(pPath As String, pDisplayName As String)
|
||||
If Directory.Exists(pPath) Then
|
||||
Process.Start(pPath)
|
||||
Else
|
||||
MsgBox($"{pDisplayName} nicht konfiguriert oder nicht gefunden!", MsgBoxStyle.Exclamation, Text)
|
||||
Dim oMessage = String.Format(My.Resources.frmImportMainExtra._0__nicht_konfiguriert_oder_nicht_gefunden, pDisplayName)
|
||||
MsgBox(oMessage, MsgBoxStyle.Exclamation, Text)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -392,23 +403,22 @@ Public Class frmImportMain
|
||||
If File.Exists(pPath) Then
|
||||
Process.Start(pPath)
|
||||
Else
|
||||
MsgBox($"{pDisplayName} nicht konfiguriert oder nicht gefunden!", MsgBoxStyle.Exclamation, Text)
|
||||
Dim oMessage = String.Format(My.Resources.frmImportMainExtra._0__nicht_konfiguriert_oder_nicht_gefunden, pDisplayName)
|
||||
MsgBox(oMessage, MsgBoxStyle.Exclamation, Text)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub btnOpenLogDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenLogDirectory.ItemClick
|
||||
TryOpenDirectory(LogConfig.LogDirectory, "Logverzeichnis")
|
||||
TryOpenDirectory(LogConfig.LogDirectory, My.Resources.frmImportMainExtra.Logverzeichnis)
|
||||
End Sub
|
||||
|
||||
Private Sub btnOpenConfigDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenConfigDirectory.ItemClick
|
||||
Dim oUserConfigDirectory = New FileInfo(ConfigManager.UserConfigPath).Directory
|
||||
TryOpenDirectory(oUserConfigDirectory.FullName, "Konfigurationsverzeichnis")
|
||||
TryOpenDirectory(oUserConfigDirectory.FullName, My.Resources.frmImportMainExtra.Konfigurationsverzeichnis)
|
||||
End Sub
|
||||
|
||||
Private Sub ShowError(pException As Exception, pFunction As String, Optional pDetails As String = "")
|
||||
Dim oMessage = $"In der Funktion '{pFunction}' ist folgender Fehler aufgetreten:{vbNewLine}{vbNewLine}{pException.Message}"
|
||||
Dim oMessage = String.Format(My.Resources.frmImportMainExtra.In_der_Funktion___0___ist_folgender_Fehler_aufgetreten__1_, pFunction, vbNewLine & vbNewLine & pException.Message)
|
||||
If pDetails <> String.Empty Then
|
||||
oMessage &= $"{vbNewLine}{pDetails}"
|
||||
End If
|
||||
@@ -424,7 +434,7 @@ Public Class frmImportMain
|
||||
|
||||
Private Sub txtCurrentFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles txtCurrentFile.ItemClick
|
||||
If CurrentDocument IsNot Nothing Then
|
||||
TryOpenFile(CurrentDocument.FullName, "Aktuelle Datei")
|
||||
TryOpenFile(CurrentDocument.FullName, My.Resources.frmImportMainExtra.Aktuelle_Datei)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -435,4 +445,6 @@ Public Class frmImportMain
|
||||
|
||||
oForm.ShowDialog()
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user