93 lines
3.7 KiB
VB.net
93 lines
3.7 KiB
VB.net
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)
|
|
|
|
listboxVendors.DataSource = Nothing
|
|
|
|
Dim oVendors = _WinLine.GetVendors()
|
|
|
|
listboxVendors.DataSource = oVendors
|
|
End Sub
|
|
|
|
Private Sub frmMain_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
|
|
_Config.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
|
|
End If
|
|
|
|
End Sub
|
|
|
|
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)
|
|
|
|
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()
|
|
|
|
'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 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)
|
|
|
|
'MsgBox($"{oVendorId}-{oGroupId}-{oVersionId}-00000-00000")
|
|
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
|
|
End Sub
|
|
End Class |