Migrate configuration from UserConfig to database

This commit is contained in:
Jonathan Jenne
2021-11-23 11:28:50 +01:00
parent ac50cf661b
commit cdff23b646
11 changed files with 132 additions and 118 deletions

View File

@@ -306,48 +306,25 @@ Namespace Documents
End If
If oFunctionName = "EAN" Then
Dim oNumberItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault(oField.Key)
Dim oArticleNumber = Winline.TryGetArticleNumber(oNumberItem.Original, pMandator)
If oArticleNumber IsNot Nothing Then
oNumberItem.External = oArticleNumber
oNumberItem.Final = oArticleNumber
Else
oNumberItem.Error = DocumentRow.FieldError.ArticleNotFound
End If
SetArticleByEAN(oRow, pMandator, oField.Key)
End If
Next
Next
'Dim oHead As DocumentRow = pDocument.Rows.
' Where(Function(r) r.Name.ToUpper.EndsWith("T025")).
' SetValue(Sub(r As DocumentRow) SetAccountByGLN(r, pMandator, "Fakt_Kontonummer", "Fakt_Name")).
' SetValue(Sub(r As DocumentRow) SetAccountByGLN(r, pMandator, "Lief_Kontonummer", "Lief_Name")).
' FirstOrDefault()
'Dim oPositions As List(Of DocumentRow) = pDocument.Rows.
' Where(Function(r) r.Name.ToUpper.EndsWith("T026")).
' SetValue(Sub(oRow As DocumentRow)
' Dim oNumberItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault("Artikelnummer")
' If oNumberItem Is Nothing Then
' Exit Sub
' End If
' Dim oArticleNumber = Winline.TryGetArticleNumber(oNumberItem.Original, pMandator)
' If oArticleNumber IsNot Nothing Then
' oNumberItem.External = oArticleNumber
' oNumberItem.Final = oArticleNumber
' Else
' oNumberItem.Error = DocumentRow.FieldError.ArticleNotFound
' End If
' End Sub).
' ToList()
'Dim oList As New List(Of DocumentRow) From {oHead}
'pDocument.Rows = oList.Concat(oPositions).ToList()
Return pDocument
End Function
Private Sub SetArticleByEAN(pRow As DocumentRow, pMandator As Mandator, pArticleField As String)
Dim oNumberItem As DocumentRow.FieldValue = pRow.Fields.GetOrDefault(pArticleField)
Dim oArticleNumber = Winline.TryGetArticleNumber(oNumberItem.Original, pMandator)
If oArticleNumber IsNot Nothing Then
oNumberItem.External = oArticleNumber
oNumberItem.Final = oArticleNumber
Else
oNumberItem.Error = DocumentRow.FieldError.ArticleNotFound
End If
End Sub
Private Sub SetAccountByGLN(oRow As DocumentRow, pMandator As Mandator, pNumberField As String, pNameField As String)
' Try to read the Account number (which is a GLN really) and account Name
Dim oNumberItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault(pNumberField)