First Testable Version
This commit is contained in:
@@ -25,6 +25,10 @@ Namespace Winline
|
||||
Public Const V50_ACCOUNTNUMBER = "c002"
|
||||
Public Const V50_ACCOUNTNAME = "c003"
|
||||
|
||||
Public Const T45_KEY = "c000"
|
||||
Public Const T45_NAME = "c001"
|
||||
Public Const T45_CONTACTNUMBER = "c063"
|
||||
|
||||
Public Const V05_ACCOUNTID = "c002"
|
||||
Public Const V05_ACCOUNTNAME = "c003"
|
||||
|
||||
@@ -258,6 +262,42 @@ Namespace Winline
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetContacts(pAccountNumber As String, pMandator As Mandator) As List(Of Contact)
|
||||
Try
|
||||
Dim oContacts As New List(Of Contact)
|
||||
Dim oYear As Integer = GetWinLineYear()
|
||||
Dim oSQL As String = $"
|
||||
SELECT
|
||||
[c000], -- Key
|
||||
[c001], -- Name
|
||||
[c063] -- Kontaktnummer
|
||||
FROM [{pMandator.Database}].[dbo].[t045]
|
||||
WHERE [c063] LIKE '{pAccountNumber}-%'
|
||||
AND [mesocomp] = '{pMandator.Id}' AND [mesoyear] = {oYear}"
|
||||
Dim oTable As DataTable = Database.GetDatatable(oSQL)
|
||||
|
||||
' Contact not found in this Mandator, continue to next one
|
||||
If oTable.Rows.Count = 0 Then
|
||||
Logger.Debug("Contact for Account [{0}] was not found in Mandator: [{1}]", pAccountNumber, pMandator.Id)
|
||||
Return Nothing
|
||||
|
||||
End If
|
||||
|
||||
For Each oRow In oTable.Rows
|
||||
oContacts.Add(New Contact With {
|
||||
.Id = Utils.NotNull(oRow.Item(T45_KEY), Nothing),
|
||||
.Name = Utils.NotNull(oRow.Item(T45_NAME), Nothing),
|
||||
.Number = Utils.NotNull(oRow.Item(T45_CONTACTNUMBER), Nothing)
|
||||
})
|
||||
Next
|
||||
|
||||
Return oContacts
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetReplacementArticleNumber(pArticleNumber As String, pMandator As Mandator)
|
||||
Try
|
||||
Dim oYear As Integer = GetWinLineYear()
|
||||
@@ -295,6 +335,7 @@ Namespace Winline
|
||||
|
||||
Return GetReplacementArticleNumber(oReplacementArticleNumber, pMandator)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user