Clean up, add DataRow Extension

This commit is contained in:
Jonathan Jenne
2021-11-19 14:23:17 +01:00
parent cc81a77f05
commit dec45ef493
7 changed files with 72 additions and 80 deletions

View File

@@ -82,9 +82,9 @@ Namespace Winline
Dim oArticles As New List(Of Article)
For Each oRow As DataRow In oTable.Rows
Dim oArticleId As String = GetRowItem(oRow, V21_ARTICLENUMBER, String.Empty)
Dim oArticleDescription As String = GetRowItem(oRow, V21_ARTICLEDESCRIPTION, String.Empty)
Dim oEAN As String = GetRowItem(oRow, V21_EAN, String.Empty)
Dim oArticleId As String = ItemEx(oRow, V21_ARTICLENUMBER, String.Empty)
Dim oArticleDescription As String = ItemEx(oRow, V21_ARTICLEDESCRIPTION, String.Empty)
Dim oEAN As String = ItemEx(oRow, V21_EAN, String.Empty)
oArticles.Add(New Article With {
.Id = oArticleId,
@@ -124,12 +124,12 @@ Namespace Winline
Dim oAccounts As New List(Of Account)
For Each oRow As DataRow In oTable.Rows
Dim oAccountNumber As String = GetRowItem(oRow, V50_ACCOUNTNUMBER, String.Empty)
Dim oAccountName As String = GetRowItem(oRow, V50_ACCOUNTNAME, String.Empty)
Dim oStreetName As String = GetRowItem(oRow, V50_STREETNAME, String.Empty)
Dim oZipCode As String = GetRowItem(oRow, V50_ZIPCODE, String.Empty)
Dim oCityName As String = GetRowItem(oRow, V50_CITYNAME, String.Empty)
Dim oGLN As String = GetRowItem(oRow, V50_GLN, String.Empty)
Dim oAccountNumber As String = ItemEx(oRow, V50_ACCOUNTNUMBER, String.Empty)
Dim oAccountName As String = ItemEx(oRow, V50_ACCOUNTNAME, String.Empty)
Dim oStreetName As String = ItemEx(oRow, V50_STREETNAME, String.Empty)
Dim oZipCode As String = ItemEx(oRow, V50_ZIPCODE, String.Empty)
Dim oCityName As String = ItemEx(oRow, V50_CITYNAME, String.Empty)
Dim oGLN As String = ItemEx(oRow, V50_GLN, String.Empty)
oAccounts.Add(New Account With {
.Id = oAccountNumber,
@@ -159,8 +159,8 @@ Namespace Winline
For Each oRow As DataRow In oTable.Rows
Dim oDbInfo = SplitConnectionInfo(oRow)
Dim oMandator = New Mandator With {
.Id = GetRowItem(oRow, T01_MANDATORID, String.Empty),
.Name = GetRowItem(oRow, T01_MANDATORNAME, String.Empty),
.Id = ItemEx(oRow, T01_MANDATORID, String.Empty),
.Name = ItemEx(oRow, T01_MANDATORNAME, String.Empty),
.Database = oDbInfo.Item1,
.Server = oDbInfo.Item2
}
@@ -214,8 +214,8 @@ Namespace Winline
For Each oRow As DataRow In oTable.Rows
oKinds.Add(New DocumentKind With {
.Id = GetRowItem(oRow, T357_KINDID, String.Empty),
.Name = GetRowItem(oRow, T357_KINDNAME, String.Empty),
.Id = ItemEx(oRow, T357_KINDID, String.Empty),
.Name = ItemEx(oRow, T357_KINDNAME, String.Empty),
.Mandator = pMandator
})
Next
@@ -264,11 +264,11 @@ Namespace Winline
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oAccountNumber As String = GetRowItem(oRow, V50_ACCOUNTNUMBER, String.Empty)
Dim oAccountName As String = GetRowItem(oRow, V50_ACCOUNTNAME, String.Empty)
Dim oStreetName As String = GetRowItem(oRow, V50_STREETNAME, String.Empty)
Dim oZipCode As String = GetRowItem(oRow, V50_ZIPCODE, String.Empty)
Dim oCityName As String = GetRowItem(oRow, V50_CITYNAME, String.Empty)
Dim oAccountNumber As String = ItemEx(oRow, V50_ACCOUNTNUMBER, String.Empty)
Dim oAccountName As String = ItemEx(oRow, V50_ACCOUNTNAME, String.Empty)
Dim oStreetName As String = ItemEx(oRow, V50_STREETNAME, String.Empty)
Dim oZipCode As String = ItemEx(oRow, V50_ZIPCODE, String.Empty)
Dim oCityName As String = ItemEx(oRow, V50_CITYNAME, String.Empty)
Return New Account With {
.Id = oAccountNumber,
@@ -314,7 +314,7 @@ Namespace Winline
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oArticleNumber As String = GetRowItem(oRow, V21_MAINARTICLENUMBER, String.Empty)
Dim oArticleNumber As String = ItemEx(oRow, V21_MAINARTICLENUMBER, String.Empty)
Return oArticleNumber
Catch ex As Exception
@@ -347,9 +347,9 @@ Namespace Winline
For Each oRow In oTable.Rows
oContacts.Add(New Contact With {
.Id = GetRowItem(Of String)(oRow, T45_KEY, Nothing),
.Name = GetRowItem(Of String)(oRow, T45_NAME, Nothing),
.Number = GetRowItem(Of String)(oRow, T45_CONTACTNUMBER, Nothing)
.Id = ItemEx(Of String)(oRow, T45_KEY, Nothing),
.Name = ItemEx(Of String)(oRow, T45_NAME, Nothing),
.Number = ItemEx(Of String)(oRow, T45_CONTACTNUMBER, Nothing)
})
Next
@@ -389,7 +389,7 @@ Namespace Winline
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oReplacementArticleNumber = GetRowItem(Of String)(oRow, V21_REPLACEMENTARTICLENUMBER, Nothing)
Dim oReplacementArticleNumber = ItemEx(Of String)(oRow, V21_REPLACEMENTARTICLENUMBER, Nothing)
If oReplacementArticleNumber Is Nothing Then
Return pArticleNumber
@@ -450,7 +450,7 @@ Namespace Winline
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oArticleNumber As String = GetRowItem(oRow, V21_MAINARTICLENUMBER, String.Empty)
Dim oArticleNumber As String = ItemEx(oRow, V21_MAINARTICLENUMBER, String.Empty)
' EAN was found, now we need to check it against the Regex of the current Mandantor, if one exists
If oMandator.Regex <> String.Empty Then