Compare commits

..

2 Commits

Author SHA1 Message Date
Jonathan Jenne
a020fbc480 Version 1.1.0.7 2021-01-21 11:15:56 +01:00
Jonathan Jenne
2c87374775 Handle NULL in Group Name 2021-01-21 11:15:29 +01:00
2 changed files with 20 additions and 5 deletions

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' indem Sie "*" wie unten gezeigt eingeben: ' indem Sie "*" wie unten gezeigt eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.1.0.6")> <Assembly: AssemblyVersion("1.1.0.7")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@@ -12,6 +12,9 @@ Public Class Winline
Public ReadOnly Property ARTICLE_ALREADY_EXISTS = "ARTICLE_ALREADY_EXISTS" Public ReadOnly Property ARTICLE_ALREADY_EXISTS = "ARTICLE_ALREADY_EXISTS"
Public ReadOnly Property UNKNOWN_ERROR = "UNKNOWN_ERROR" Public ReadOnly Property UNKNOWN_ERROR = "UNKNOWN_ERROR"
Private Const ACTIONCODE_CHECK = 0
Private Const ACTIONCODE_IMPORT = 1
Public Sub New(LogConfig As LogConfig, EximDatabase As Database, WinlineDatabase As Database, Config As Config) Public Sub New(LogConfig As LogConfig, EximDatabase As Database, WinlineDatabase As Database, Config As Config)
_Logger = LogConfig.GetLogger() _Logger = LogConfig.GetLogger()
_EXIM = EximDatabase _EXIM = EximDatabase
@@ -70,6 +73,14 @@ Public Class Winline
End Try End Try
End Function End Function
Private Function NotNull(Of T)(ByVal value As T, ByVal defaultValue As T) As T
If IsNothing(value) OrElse String.IsNullOrEmpty(value.ToString) OrElse IsDBNull(value) Then
Return defaultValue
Else
Return value
End If
End Function
Public Function GetGroupsByVendor(VendorCode As String) As List(Of ProductGroup) Public Function GetGroupsByVendor(VendorCode As String) As List(Of ProductGroup)
Try Try
Dim oDatatable = _EXIM.GetDatatable($"SELECT * FROM TBDD_ARTICLE_GENERATOR_GROUPS WHERE CODE = '{VendorCode}'") Dim oDatatable = _EXIM.GetDatatable($"SELECT * FROM TBDD_ARTICLE_GENERATOR_GROUPS WHERE CODE = '{VendorCode}'")
@@ -77,10 +88,10 @@ Public Class Winline
For Each oRow As DataRow In oDatatable.Rows For Each oRow As DataRow In oDatatable.Rows
Dim oGroup As New ProductGroup() With { Dim oGroup As New ProductGroup() With {
.Guid = oRow.Item("GUID"), .Guid = NotNull(oRow.Item("GUID"), 0),
.Name = oRow.Item("NAME"), .Name = NotNull(oRow.Item("NAME"), "(Kein Name)"),
.GroupId = oRow.Item("GROUP"), .GroupId = NotNull(oRow.Item("GROUP"), 0),
.Code = oRow.Item("CODE") .Code = NotNull(oRow.Item("CODE"), "(Kein Code)")
} }
oGroups.Add(oGroup) oGroups.Add(oGroup)
@@ -174,6 +185,9 @@ Public Class Winline
Dim oSuccess As XmlNode = oDocument.DocumentElement.SelectSingleNode("OverallSuccess") Dim oSuccess As XmlNode = oDocument.DocumentElement.SelectSingleNode("OverallSuccess")
If oSuccess.InnerText.ToUpper = "TRUE" Then If oSuccess.InnerText.ToUpper = "TRUE" Then
For Each oNode As XmlNode In oDocument.DocumentElement.SelectNodes("Success")
Next
_Logger.Info("Request was SUCCESSFUL!") _Logger.Info("Request was SUCCESSFUL!")
Return True Return True
@@ -214,6 +228,7 @@ Public Class Winline
Dim oUseShape As String Dim oUseShape As String
Dim oDefaultShape As String Dim oDefaultShape As String
Dim oMultipleShapes As String Dim oMultipleShapes As String
Dim oActionCode As Integer = ACTIONCODE_IMPORT
If IsSerialnumberArticle = True Then If IsSerialnumberArticle = True Then
oArticleType = 0 oArticleType = 0