add forms, prepare webservices call

This commit is contained in:
Jonathan Jenne
2020-09-14 17:08:43 +02:00
parent c9bd8da4a6
commit 82ec7c9ecb
22 changed files with 932 additions and 153 deletions

View File

@@ -1,20 +1,15 @@
Public Class frmMain
Private _Logger As Logger
Private _LogConfig As LogConfig
Private _Config As ConfigManager(Of Config)
Private _Database As Database
Private _WinLine As Winline
Private CurrentVendor As Vendor = Nothing
Private CurrentGroup As ProductGroup = Nothing
Private CurrentVersion As ProductVersion = Nothing
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
_LogConfig = New LogConfig(LogPath:=LogConfig.PathType.AppData, CompanyName:="Digital Data", ProductName:="WinLineProductNumberGenerator")
_Logger = _LogConfig.GetLogger()
_Config = New ConfigManager(Of Config)(_LogConfig, Application.UserAppDataPath)
_Database = New Database(_LogConfig, _Config)
_WinLine = New Winline(_LogConfig, _Database)
My.Application.LogConfig = New LogConfig(LogPath:=LogConfig.PathType.AppData, CompanyName:="Digital Data", ProductName:="WinLineProductNumberGenerator")
My.Application.ConfigManager = New ConfigManager(Of Config)(My.Application.LogConfig, Application.UserAppDataPath)
_Logger = My.Application.LogConfig.GetLogger()
_Database = New Database(My.Application.LogConfig, My.Application.ConfigManager)
_WinLine = New Winline(My.Application.LogConfig, _Database)
listboxVendors.DataSource = Nothing
@@ -24,14 +19,12 @@
End Sub
Private Sub frmMain_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
_Config.Save()
My.Application.ConfigManager.Save()
End Sub
Private Sub listboxVendors_SelectedIndexChanged(sender As Object, e As EventArgs) Handles listboxVendors.SelectedIndexChanged
If listboxVendors.SelectedItem IsNot Nothing Then
Dim oVendor As Vendor = listboxVendors.SelectedItem
CurrentVendor = oVendor
Dim oGroups As List(Of ProductGroup) = _WinLine.GetGroupsByVendor(oVendor.Code)
listboxProductGroups.DataSource = oGroups
@@ -42,52 +35,51 @@
Private Sub listboxProductGroups_SelectedIndexChanged(sender As Object, e As EventArgs) Handles listboxProductGroups.SelectedIndexChanged
If listboxProductGroups.SelectedItem IsNot Nothing Then
Dim oGroup As ProductGroup = listboxProductGroups.SelectedItem
CurrentGroup = oGroup
Dim oVersions As List(Of ProductVersion) = _WinLine.GetVersionsByVendorAndGroup(oGroup.Vendor, oGroup.Id)
Dim oVersions As List(Of ProductVersion) = _WinLine.GetVersionsByVendorAndGroup(oGroup.Code, oGroup.GroupId)
listBoxProductVersion.DataSource = oVersions
End If
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
'Dim oVendor As DataRowView = listboxVendors.SelectedItem()
'Dim oGroup As DataRowView = listboxProductGroups.SelectedItem()
'Dim oVersion As DataRowView = listBoxProductVersion.SelectedItem()
Dim oVendor As Vendor = listboxVendors.SelectedItem()
Dim oGroup As ProductGroup = listboxProductGroups.SelectedItem()
Dim oVersion As ProductVersion = listBoxProductVersion.SelectedItem()
'If oVendor Is Nothing Then
' MsgBox("Bitte einen Lieferanten auswählen!", MsgBoxStyle.Information, Text)
' Exit Sub
'End If
If oVendor Is Nothing Then
MsgBox("Bitte einen Lieferanten auswählen!", MsgBoxStyle.Information, Text)
Exit Sub
End If
'If oGroup Is Nothing Then
' MsgBox("Bitte eine Produkt-Gruppe auswählen!", MsgBoxStyle.Information, Text)
' Exit Sub
'End If
If oGroup Is Nothing Then
MsgBox("Bitte eine Produkt-Gruppe auswählen!", MsgBoxStyle.Information, Text)
Exit Sub
End If
'If oVersion Is Nothing Then
' MsgBox("Bitte eine Produkt-Version auswählen!", MsgBoxStyle.Information, Text)
' Exit Sub
'End If
If oVersion Is Nothing Then
MsgBox("Bitte eine Produkt-Version auswählen!", MsgBoxStyle.Information, Text)
Exit Sub
End If
'Dim oVendorId = CurrentVendor.Id
'Dim oGroupId = CurrentGroup.Id
'Dim oVersionId = CurrentVersion.Id
'Dim oRunningNumber = _WinLine.GetNextRunningNumber(oVendorId, oGroupId, oVersionId)
Dim oArticleNumber = $"{oVendor.Code}{oGroup.GroupString}{oVersion.VersionString}"
'MsgBox($"{oVendorId}-{oGroupId}-{oVersionId}-00000-00000")
Try
Dim oRunningNumber = _WinLine.GetNextRunningNumber(oVendor.Code, oGroup.GroupId, oVersion.VersionId)
MsgBox($"{oArticleNumber}{oRunningNumber}")
Catch ex As Exception
Select Case ex.Message
Case _WinLine.NO_RUNNING_NUMBER_FOUND
Dim oMessage = $"Für die Artikelnummer [{oArticleNumber}___] wurde im WinLine-System keine Laufende Nummer hinterlegt."
oMessage &= "Diese Nummer ist für die Automatische Artikelnummer-Generierung zwingend notwendig"
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
Case Else
MsgBox("Folgender Fehler ist aufgetreten:" & vbNewLine & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text)
End Select
End Try
End Sub
Private Sub listBoxProductVersion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles listBoxProductVersion.SelectedIndexChanged
'If listBoxProductVersion.SelectedIndex >= 0 Then
' Dim oVersion As DataRowView = listBoxProductVersion.SelectedItem()
' Dim oVersionId As String = oVersion.Item("C999")
' Dim oVersionName As String = oVersion.Item("C001")
' CurrentVersion = New ProductVersion With {
' .Id = oVersionId,
' .Name = oVersionName
' }
'End If
Private Sub EinstellungenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EinstellungenToolStripMenuItem.Click
frmWinlineConfig.ShowDialog()
End Sub
End Class