faktAbr, CreditsafeAPI, etc.
This commit is contained in:
@@ -5,6 +5,7 @@ Imports System.Net
|
||||
Imports System.Reflection
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Threading
|
||||
Imports VERAG_PROG_ALLGEMEIN.TESTJSON
|
||||
|
||||
|
||||
Public Class cCreditSafeAPI
|
||||
@@ -97,7 +98,7 @@ Public Class cCreditSafeAPI
|
||||
|
||||
|
||||
|
||||
Shared Function SendGetRequestWithAuthHeader(url As String, company As Company, acceptContentType As String, method As String, authenticationToken As String, ByRef failureDesc As String, Optional isMonitoring As Boolean = False, Optional csvImport As Boolean = False, Optional csvFile As String = "") As String
|
||||
Shared Function SendGetRequestWithAuthHeader(url As String, company As Company, acceptContentType As String, method As String, authenticationToken As String, ByRef failureDesc As String, Optional isMonitoring As Boolean = False, Optional csvImport As Boolean = False, Optional csvFile As String = "", Optional notifEvents As Boolean = False, Optional page As Integer = 0) As String
|
||||
Try
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
@@ -118,9 +119,9 @@ Public Class cCreditSafeAPI
|
||||
|
||||
rest.ClearAllQueryParams()
|
||||
|
||||
If company IsNot Nothing AndAlso Not isMonitoring Then
|
||||
If company IsNot Nothing Then
|
||||
|
||||
setSearchParam(rest, company)
|
||||
setSearchParam(rest, company, isMonitoring, notifEvents, page)
|
||||
|
||||
End If
|
||||
|
||||
@@ -175,7 +176,7 @@ Public Class cCreditSafeAPI
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
ElseIf Not notifEvents Then
|
||||
|
||||
Dim json As New Chilkat.JsonObject
|
||||
success = json.UpdateString("id", company.creditSafeId)
|
||||
@@ -207,6 +208,7 @@ Public Class cCreditSafeAPI
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -340,7 +342,6 @@ Public Class cCreditSafeAPI
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Shared Function AddCompaniesCSVToPortfolio(csvFilePath As String, sync As Boolean, Optional PortfolioID As String = "1662419") As String
|
||||
|
||||
Dim myUri As String = API_STRING & "/v1/monitoring/portfolios/" & PortfolioID & IIf(sync, "/sync", "/import") 'Default
|
||||
@@ -471,7 +472,7 @@ Public Class cCreditSafeAPI
|
||||
End Function
|
||||
|
||||
|
||||
Shared Function getCompanyEvents(company As Company, ByRef dtEvents As DataTable, Optional checklastChecked As Boolean = False, Optional updateKunden As Boolean = False, Optional showError As Boolean = False, Optional getTotalNr As Boolean = False, Optional setzeKundenbesonderheiten As Boolean = False, Optional sendMail As Boolean = False) As String
|
||||
Shared Function getCompanyEvents(company As Company, ByRef dtEvents As DataTable, ByRef companyDetailEvents As Boolean, ByRef maxPages As Integer, Optional checklastChecked As Boolean = False, Optional updateKunden As Boolean = False, Optional showError As Boolean = False, Optional getTotalNr As Boolean = False, Optional setzeKundenbesonderheiten As Boolean = False, Optional sendMail As Boolean = False, Optional firma As String = "VERAG", Optional page As Integer = 0) As String
|
||||
|
||||
|
||||
'rest.AddQueryParam("from", Today().AddDays(-1))
|
||||
@@ -485,8 +486,17 @@ Public Class cCreditSafeAPI
|
||||
End If
|
||||
|
||||
Dim failureDesc As String
|
||||
Dim myUrl As String = API_STRING & "/v1/monitoring/companies/" & company.creditSafeId & "/events" & IIf(checklastChecked, "?startDate=" & checkDate, "")
|
||||
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token, failureDesc)
|
||||
|
||||
Dim myUrl As String = ""
|
||||
|
||||
If Not companyDetailEvents Then
|
||||
myUrl = API_STRING & "/v1/monitoring/portfolios/1662419/notificationEvents"
|
||||
Else
|
||||
myUrl = API_STRING & "/v1/monitoring/companies/" & company.creditSafeId & "/events" & IIf(checklastChecked, "?startDate=" & checkDate, "")
|
||||
End If
|
||||
|
||||
|
||||
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token, failureDesc, Not companyDetailEvents,,, Not companyDetailEvents, page)
|
||||
|
||||
If failureDesc <> "" Then
|
||||
If showError Then MsgBox(failureDesc)
|
||||
@@ -525,6 +535,15 @@ Public Class cCreditSafeAPI
|
||||
Return "data not found."
|
||||
End If
|
||||
|
||||
|
||||
Dim pagination As Chilkat.JsonObject = json.ObjectOf("pagination")
|
||||
If Not (json.LastMethodSuccess = False) Then
|
||||
Dim Lastpage As String = pagination.StringOf("last")
|
||||
If IsNumeric(Lastpage) Then maxPages = Lastpage
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Dim numCompanies As Integer = companieData.Size
|
||||
|
||||
Dim defaultCL As Double = -10000000
|
||||
@@ -566,84 +585,51 @@ Public Class cCreditSafeAPI
|
||||
R("eventDate") = dateTime.GetAsTimestamp(getAsLocal)
|
||||
R("createdDate") = dateTime.GetAsTimestamp(getAsLocal)
|
||||
|
||||
If IsDBNull(R("companyId")) Then
|
||||
Dim compObjHead As Chilkat.JsonObject = compObj.ObjectOf("company")
|
||||
R("companyId") = compObjHead.StringOf("id")
|
||||
If IsDBNull(R("portfolioId")) Then R("portfolioId") = compObjHead.StringOf("portfolioId")
|
||||
End If
|
||||
|
||||
dtEvents.Rows.Add(R)
|
||||
|
||||
Dim cEvent As New cCreditsafeEvent(CLng(R("eventId")), company.kdNr)
|
||||
|
||||
cEvent.eventId = R("eventId")
|
||||
cEvent.companyId = R("companyId")
|
||||
cEvent.portfolioId = R("portfolioId")
|
||||
cEvent.ruleName = R("ruleName")
|
||||
cEvent.localEventCode = R("localEventCode").trim()
|
||||
cEvent.globalEventCode = R("globalEventCode").trim()
|
||||
cEvent.eventDate = R("eventDate")
|
||||
cEvent.createdDate = R("createdDate")
|
||||
cEvent.importDate = Now()
|
||||
cEvent.Sachbearbeiter = IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME Is Nothing, "AUTO", VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME)
|
||||
cEvent.oldValue = R("oldValue")
|
||||
cEvent.newValue = R("newValue")
|
||||
Dim dtKundenNr As New DataTable
|
||||
If company.kdNr = 0 Then
|
||||
dtKundenNr = SQL.loadDgvBySql("select distinct(ba_KundenNr),f.Firma from Kunden
|
||||
inner join tblKundenErweitert on Kunden.KundenNr = kde_KundenNr
|
||||
inner join Filialen as f on f.FilialenNr = Kunden.FilialenNr
|
||||
inner join tblBonitaetsauskunft on ba_KundenNr = kde_KundenNr
|
||||
where isnull(tblKundenErweitert.kde_CreditSaveId,'') ='" & R("companyId") & "'", "FMZOLL")
|
||||
|
||||
|
||||
'OLD-VALUES
|
||||
If cEvent.oldValue IsNot Nothing AndAlso IsNumeric(cEvent.oldValue) AndAlso Not cEvent.oldValue.ToString.Contains("€") Then
|
||||
If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then
|
||||
cEvent.oldValueCL = cEvent.oldValue
|
||||
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
|
||||
cEvent.oldValueCR = cEvent.oldValue
|
||||
cEvent.oldValueCRIndex = calculatedBonIndexFromBonScore(cEvent.oldValue, cEvent.oldRiskClass)
|
||||
End If
|
||||
End If
|
||||
|
||||
If dtKundenNr.Rows.Count > 0 Then
|
||||
|
||||
For Each row As DataRow In dtKundenNr.Rows
|
||||
company.kdNr = row("ba_KundenNr")
|
||||
company.creditSafeId = R("companyId")
|
||||
firma = row("Firma")
|
||||
Dim currentBonID As String = (New SQL).getValueTxtBySql("Select Top(1) isnull(ba_id, -1) FROM [tblBonitaetsauskunft] where ba_KundenNr = " & company.kdNr & " AND [ba_Pruefungstool] = 'creditsafe API' ORDER BY ba_Datum DESC", "FMZOLL")
|
||||
If currentBonID <> "" AndAlso IsNumeric(currentBonID) AndAlso currentBonID > 0 Then
|
||||
company.csBonID = currentBonID
|
||||
End If
|
||||
createEvents(R, company.kdNr, company, CL, CR, CL_Datum, CR_Datum)
|
||||
updateKundenWithEvent(company, CL, CR, CL_Datum, CR_Datum, setzeKundenbesonderheiten, defaultCR, defaultCL, updateKunden, sendMail, firma)
|
||||
Next
|
||||
|
||||
company.kdNr = 0 'wichtig, wieder zurücksetzen!
|
||||
|
||||
Else
|
||||
If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then
|
||||
cEvent.oldValue = Regex.Replace(cEvent.oldValue, "\s+", "")
|
||||
cEvent.oldValue = Regex.Replace(cEvent.oldValue, "[^\d]", "")
|
||||
cEvent.oldValueCL = cEvent.oldValue
|
||||
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
|
||||
cEvent.oldValue = Regex.Replace(cEvent.oldValue, "\s+", "")
|
||||
cEvent.oldValue = Regex.Replace(cEvent.oldValue, "[^\d]", "")
|
||||
cEvent.oldValueCR = cEvent.oldValue
|
||||
cEvent.oldValueCRIndex = calculatedBonIndexFromBonScore(cEvent.oldValue, cEvent.oldRiskClass)
|
||||
|
||||
If company.kdNr <> 0 Then
|
||||
createEvents(R, company.kdNr, company, CL, CR, CL_Datum, CR_Datum)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
'NEW-VALUES
|
||||
If cEvent.newValue IsNot Nothing AndAlso IsNumeric(cEvent.newValue) AndAlso Not cEvent.newValue.ToString.Contains("€") Then
|
||||
If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then
|
||||
cEvent.newValueCL = cEvent.newValue
|
||||
setCL_CR_Entry(CDate(cEvent.eventDate), "CL", cEvent.newValueCL, CL, CR, CL_Datum, CR_Datum)
|
||||
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
|
||||
cEvent.newValueCR = cEvent.newValue
|
||||
cEvent.newValueCRIndex = calculatedBonIndexFromBonScore(cEvent.newValue, cEvent.newRiskClass)
|
||||
setCL_CR_Entry(CDate(cEvent.eventDate), "CR", cEvent.newValueCR, CL, CR, CL_Datum, CR_Datum)
|
||||
End If
|
||||
Else
|
||||
|
||||
If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then
|
||||
cEvent.newValue = Regex.Replace(cEvent.newValue, "\s+", "")
|
||||
cEvent.newValue = Regex.Replace(cEvent.newValue, "[^\d]", "")
|
||||
cEvent.newValueCL = cEvent.newValue
|
||||
setCL_CR_Entry(CDate(cEvent.eventDate), "CL", cEvent.newValueCL, CL, CR, CL_Datum, CR_Datum)
|
||||
|
||||
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
|
||||
cEvent.newValue = Regex.Replace(cEvent.newValue, "\s+", "")
|
||||
cEvent.newValue = Regex.Replace(cEvent.newValue, "[^\d]", "")
|
||||
cEvent.newValueCR = cEvent.newValue
|
||||
cEvent.newValueCRIndex = calculatedBonIndexFromBonScore(cEvent.newValue, cEvent.newRiskClass)
|
||||
setCL_CR_Entry(CDate(cEvent.eventDate), "CR", cEvent.newValueCR, CL, CR, CL_Datum, CR_Datum)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If cEvent.bonId Is Nothing AndAlso company.csBonID > 0 Then
|
||||
cEvent.bonId = company.csBonID
|
||||
End If
|
||||
|
||||
cEvent.kundenNr = company.kdNr
|
||||
cEvent.SAVE()
|
||||
|
||||
j = j + 1
|
||||
|
||||
End While
|
||||
'Next
|
||||
|
||||
@@ -654,6 +640,15 @@ Public Class cCreditSafeAPI
|
||||
'viewEvents = New DataView(dtEvents, "localEventCode IN ('CL','CR') or e.globalEventCode IN ('CL','CR')", "", DataViewRowState.CurrentRows)
|
||||
End If
|
||||
|
||||
If company.kdNr <> 0 AndAlso companyDetailEvents Then updateKundenWithEvent(company, CL, CR, CL_Datum, CR_Datum, setzeKundenbesonderheiten, defaultCR, defaultCL, updateKunden, sendMail, firma)
|
||||
|
||||
|
||||
Return "Anzahl gefundener Datensätze: " & numCompanies
|
||||
|
||||
End Function
|
||||
|
||||
Private Shared Sub updateKundenWithEvent(company As Company, CL As Integer, CR As Integer, CL_Datum As Date, CR_Datum As Date, setzeKundenbesonderheiten As Boolean, defaultCR As Integer, defaultCL As Integer, updateKunden As Boolean, sendMail As Boolean, Optional firma As String = "VERAG")
|
||||
|
||||
Dim triggerMail As Boolean = False
|
||||
|
||||
If company.kdNr > 0 AndAlso (CR <> -1000000 Or CL <> -1000000) Then
|
||||
@@ -699,6 +694,10 @@ Public Class cCreditSafeAPI
|
||||
End If
|
||||
End If
|
||||
|
||||
If company.BANKRUPT_REGISTERED Then
|
||||
createInfo("BANKRUPT_REGISTERED", KUNDE_ERW, KUNDE, CL, riskClass, Mailtext, triggerMail, setzeKundenbesonderheiten, company)
|
||||
End If
|
||||
|
||||
If updateKunden Then KUNDE_ERW.SAVE()
|
||||
End If
|
||||
|
||||
@@ -706,15 +705,119 @@ Public Class cCreditSafeAPI
|
||||
|
||||
If triggerMail AndAlso sendMail Then
|
||||
Dim ADR As New cAdressen(KUNDE.KundenNr)
|
||||
VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "d.breimaier@verag.ag", "as@verag.ag"), IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "TEST-", "") & "CREDITSAFE " & KUNDE.KundenNr, "Änderungen der Creditsafe-Daten von Kunden " & KUNDE.KundenNr & " " & ADR.Ordnungsbegriff & Mailtext.ToString & "<br><br>" & "*Automatic generated e-mail*",,,,, "d.breimaier@verag.ag")
|
||||
Dim empfanegerMail = IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "d.breimaier@verag.ag", "as@verag.ag")
|
||||
If Not VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
|
||||
Select Case firma
|
||||
Case "VERAG" : empfanegerMail = "as@verag.ag"
|
||||
Case "IMEX" : empfanegerMail = "Viktoria.Leirich@imex-group.at"
|
||||
Case "AMBAR" : empfanegerMail = "Buchhaltung@ambarlog.com"
|
||||
Case "UNISPED" : empfanegerMail = "sabine.muehlboeck@unisped.at"
|
||||
End Select
|
||||
End If
|
||||
VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(empfanegerMail, IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "TEST-", "") & "CREDITSAFE " & KUNDE.KundenNr, "Änderungen der Creditsafe-Daten von Kunden " & KUNDE.KundenNr & " " & ADR.Ordnungsbegriff & Mailtext.ToString & "<br><br>" & "*Automatic generated e-mail*",,,,, "d.breimaier@verag.ag")
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Shared Sub createEvents(R As DataRow, KundeNr As Integer, company As Company, CL As Integer, CR As Integer, ByRef CL_Datum As Date, ByRef CR_Datum As Date)
|
||||
|
||||
|
||||
Dim cEvent As New cCreditsafeEvent(CLng(R("eventId")), KundeNr)
|
||||
Dim globaleventcode As String = ""
|
||||
|
||||
If Not IsDBNull(R("globalEventCode")) Then
|
||||
globaleventcode = R("globalEventCode").trim()
|
||||
ElseIf Not IsDBNull(R("localEventCode")) Then
|
||||
Select Case R("localEventCode").trim()
|
||||
Case "DECREASE_LIMIT", "INCREASE_LIMIT" : globaleventcode = "CL"
|
||||
Case "DECREASE_RATING", "INCREASE_RATING" : globaleventcode = "CR"
|
||||
End Select
|
||||
End If
|
||||
|
||||
|
||||
cEvent.eventId = R("eventId")
|
||||
cEvent.companyId = R("companyId")
|
||||
cEvent.portfolioId = R("portfolioId")
|
||||
cEvent.ruleName = R("ruleName")
|
||||
cEvent.localEventCode = R("localEventCode").trim()
|
||||
cEvent.globalEventCode = globaleventcode
|
||||
cEvent.eventDate = R("eventDate")
|
||||
cEvent.createdDate = R("createdDate")
|
||||
cEvent.importDate = Now()
|
||||
cEvent.Sachbearbeiter = IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME Is Nothing, "AUTO", VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME)
|
||||
cEvent.oldValue = R("oldValue")
|
||||
cEvent.newValue = R("newValue")
|
||||
|
||||
|
||||
'OLD-VALUES
|
||||
If cEvent.oldValue IsNot Nothing AndAlso IsNumeric(cEvent.oldValue) AndAlso Not cEvent.oldValue.ToString.Contains("€") Then
|
||||
If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then
|
||||
cEvent.oldValueCL = cEvent.oldValue
|
||||
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
|
||||
cEvent.oldValueCR = cEvent.oldValue
|
||||
cEvent.oldValueCRIndex = calculatedBonIndexFromBonScore(cEvent.oldValue, cEvent.oldRiskClass)
|
||||
End If
|
||||
|
||||
Else
|
||||
If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then
|
||||
cEvent.oldValue = Regex.Replace(cEvent.oldValue, "\s+", "")
|
||||
cEvent.oldValue = Regex.Replace(cEvent.oldValue, "[^\d]", "")
|
||||
cEvent.oldValueCL = cEvent.oldValue
|
||||
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
|
||||
cEvent.oldValue = Regex.Replace(cEvent.oldValue, "\s+", "")
|
||||
cEvent.oldValue = Regex.Replace(cEvent.oldValue, "[^\d]", "")
|
||||
cEvent.oldValueCR = cEvent.oldValue
|
||||
cEvent.oldValueCRIndex = calculatedBonIndexFromBonScore(cEvent.oldValue, cEvent.oldRiskClass)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Return "Anzahl gefundener Datensätze: " & numCompanies
|
||||
'NEW-VALUES
|
||||
If cEvent.newValue IsNot Nothing AndAlso IsNumeric(cEvent.newValue) AndAlso Not cEvent.newValue.ToString.Contains("€") Then
|
||||
If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then
|
||||
cEvent.newValueCL = cEvent.newValue
|
||||
setCL_CR_Entry(CDate(cEvent.eventDate), "CL", cEvent.newValueCL, CL, CR, CL_Datum, CR_Datum)
|
||||
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
|
||||
cEvent.newValueCR = cEvent.newValue
|
||||
cEvent.newValueCRIndex = calculatedBonIndexFromBonScore(cEvent.newValue, cEvent.newRiskClass)
|
||||
setCL_CR_Entry(CDate(cEvent.eventDate), "CR", cEvent.newValueCR, CL, CR, CL_Datum, CR_Datum)
|
||||
End If
|
||||
Else
|
||||
|
||||
If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then
|
||||
cEvent.newValue = Regex.Replace(cEvent.newValue, "\s+", "")
|
||||
cEvent.newValue = Regex.Replace(cEvent.newValue, "[^\d]", "")
|
||||
cEvent.newValueCL = cEvent.newValue
|
||||
setCL_CR_Entry(CDate(cEvent.eventDate), "CL", cEvent.newValueCL, CL, CR, CL_Datum, CR_Datum)
|
||||
|
||||
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
|
||||
cEvent.newValue = Regex.Replace(cEvent.newValue, "\s+", "")
|
||||
cEvent.newValue = Regex.Replace(cEvent.newValue, "[^\d]", "")
|
||||
cEvent.newValueCR = cEvent.newValue
|
||||
cEvent.newValueCRIndex = calculatedBonIndexFromBonScore(cEvent.newValue, cEvent.newRiskClass)
|
||||
setCL_CR_Entry(CDate(cEvent.eventDate), "CR", cEvent.newValueCR, CL, CR, CL_Datum, CR_Datum)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If cEvent.localEventCode = "BANKRUPT_REGISTERED" Or cEvent.globalEventCode = "PR" Then
|
||||
setBANCKRUPT_Entry(company, cEvent.eventDate)
|
||||
End If
|
||||
|
||||
If cEvent.bonId Is Nothing AndAlso company.csBonID > 0 Then
|
||||
cEvent.bonId = company.csBonID
|
||||
End If
|
||||
|
||||
cEvent.kundenNr = company.kdNr
|
||||
cEvent.SAVE()
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Private Shared Sub setCL_CR_Entry(ByVal cs_date As Date, ByVal type As String, ByRef value As Object, ByRef CL As Double, ByRef CR As Integer, ByRef CL_Datum As Date, ByRef CR_Datum As Date)
|
||||
|
||||
@@ -727,7 +830,9 @@ Public Class cCreditSafeAPI
|
||||
saveCR = True
|
||||
End If
|
||||
|
||||
If saveCR AndAlso IsNumeric(value) Then CR = value
|
||||
If saveCR AndAlso IsNumeric(value) Then
|
||||
CR = value
|
||||
End If
|
||||
|
||||
Case "CL"
|
||||
Dim saveCL As Boolean = False
|
||||
@@ -736,12 +841,24 @@ Public Class cCreditSafeAPI
|
||||
saveCL = True
|
||||
End If
|
||||
|
||||
If saveCL AndAlso IsNumeric(value) Then CL = value
|
||||
If saveCL AndAlso IsNumeric(value) Then
|
||||
CL = value
|
||||
End If
|
||||
|
||||
End Select
|
||||
|
||||
End Sub
|
||||
|
||||
Private Shared Sub setBANCKRUPT_Entry(company As Company, ByVal BK_date As Date)
|
||||
|
||||
If company.kdNr > 0 Then
|
||||
company.BANKRUPT_REGISTERED = True
|
||||
company.BANKRUPT_REGISTERED_DATE = BK_date
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Shared Function getReport(ByRef company As Company, withPDF As Boolean) As String 'Shared Function getReport(ByRef company As Company, withPDF As Boolean, ByRef bytes As Byte()) As String
|
||||
Dim failureDesc As String = ""
|
||||
Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId & "/"
|
||||
@@ -1019,30 +1136,58 @@ Public Class cCreditSafeAPI
|
||||
End Function
|
||||
|
||||
|
||||
Shared Sub setSearchParam(ByRef rest As Chilkat.Rest, ByRef company As Company)
|
||||
Shared Sub setSearchParam(ByRef rest As Chilkat.Rest, ByRef company As Company, ByRef isMonitoring As Boolean, isNotEvent As Boolean, Optional page As Integer = 0)
|
||||
|
||||
If company IsNot Nothing Then
|
||||
|
||||
If isMonitoring Then
|
||||
|
||||
If isNotEvent Then
|
||||
|
||||
rest.AddQueryParam("sortBy", "companyName")
|
||||
rest.AddQueryParam("sortDir", "asc")
|
||||
|
||||
If company.lastChecked >= Today.AddYears(-50) Then
|
||||
|
||||
rest.AddQueryParam("startDate", company.lastChecked.ToString("yyyy-MM-ddTHH:mm:ss"))
|
||||
rest.AddQueryParam("endDate", Now().ToString("yyyy-MM-ddTHH:mm:ss"))
|
||||
rest.AddQueryParam("filterByCreatedDate", "true")
|
||||
rest.AddQueryParam("pageSize", "1000") 'maximum
|
||||
rest.AddQueryParam("page", page)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
rest.AddQueryParam("countries", company.country)
|
||||
|
||||
|
||||
If company.creditsafeNo <> "" Then 'Eindeutiger Schlüssel
|
||||
rest.AddQueryParam("safeNo", company.creditsafeNo)
|
||||
|
||||
Else
|
||||
If company.language <> "" Then rest.AddQueryParam("language", company.language)
|
||||
|
||||
|
||||
If company.vatNo <> "" Then
|
||||
rest.AddQueryParam("vatNo", company.vatNo)
|
||||
Else
|
||||
If company.name <> "" Then rest.AddQueryParam("name", company.name)
|
||||
If company.Street <> "" Then rest.AddQueryParam("street", company.Street)
|
||||
If company.Postalcode <> "" Then rest.AddQueryParam("postCode", company.Postalcode)
|
||||
If company.City <> "" Then rest.AddQueryParam("city", company.City)
|
||||
End If
|
||||
|
||||
rest.AddQueryParam("countries", company.country)
|
||||
|
||||
|
||||
If company.creditsafeNo <> "" Then 'Eindeutiger Schlüssel
|
||||
rest.AddQueryParam("safeNo", company.creditsafeNo)
|
||||
|
||||
Else
|
||||
If company.language <> "" Then rest.AddQueryParam("language", company.language)
|
||||
|
||||
|
||||
If company.vatNo <> "" Then
|
||||
rest.AddQueryParam("vatNo", company.vatNo)
|
||||
Else
|
||||
If company.name <> "" Then rest.AddQueryParam("name", company.name)
|
||||
If company.Street <> "" Then rest.AddQueryParam("street", company.Street)
|
||||
If company.Postalcode <> "" Then rest.AddQueryParam("postCode", company.Postalcode)
|
||||
If company.City <> "" Then rest.AddQueryParam("city", company.City)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -1196,7 +1341,7 @@ Public Class cCreditSafeAPI
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Shared Sub createInfo(typ As String, kundeErw As cKundenErweitert, kunde As cKunde, newValue As Object, risikoklasse As String, ByRef mailText As String, ByRef triggerMail As Boolean, setzeKundeninfo As Boolean)
|
||||
Shared Sub createInfo(typ As String, kundeErw As cKundenErweitert, kunde As cKunde, newValue As Object, risikoklasse As String, ByRef mailText As String, ByRef triggerMail As Boolean, setzeKundeninfo As Boolean, Optional company As Company = Nothing)
|
||||
|
||||
Dim createInfo As Boolean = False
|
||||
|
||||
@@ -1249,6 +1394,12 @@ Public Class cCreditSafeAPI
|
||||
createInfo = True
|
||||
triggerMail = True
|
||||
End If
|
||||
|
||||
Case "BANKRUPT_REGISTERED"
|
||||
createInfo = True
|
||||
triggerMail = True
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
If Not createInfo Then Exit Sub
|
||||
@@ -1257,7 +1408,12 @@ Public Class cCreditSafeAPI
|
||||
Risk = " Risikoklasse: " & oldRiksClass & " -> " & risikoklasse
|
||||
End If
|
||||
|
||||
Dim textVermerk As String = "ACHTUNG, Veränderung des " & typ & " von " & oldValue.ToString & " auf " & newValue.ToString & " ( um " & changedInProzent.ToString("F2") & "% ) " & Risk
|
||||
Dim textVermerk As String = ""
|
||||
|
||||
Select Case typ
|
||||
Case "B-INDEX", "B-SCORE", "KREDITLIMIT" : textVermerk &= "ACHTUNG, Veränderung des " & typ & " von " & oldValue.ToString & " auf " & newValue.ToString & " ( um " & changedInProzent.ToString("F2") & "% ) " & Risk
|
||||
Case "BANKRUPT_REGISTERED" : textVermerk &= " KUNDE WURDE LAUT CREDITSAFE " & IIf(company IsNot Nothing, " AM " & company.BANKRUPT_REGISTERED_DATE.ToShortDateString, "") & " FÜR INSOLVENT ERKLÄRT "
|
||||
End Select
|
||||
|
||||
mailText &= "<br><br>" & textVermerk
|
||||
|
||||
@@ -1343,6 +1499,8 @@ Public Class cCreditSafeAPI
|
||||
Public Property language As String
|
||||
Public Property csBank As String
|
||||
Public Property csBonID As Integer = -1
|
||||
Public Property BANKRUPT_REGISTERED As Boolean = False
|
||||
Public Property BANKRUPT_REGISTERED_DATE As Date
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user