Kundenblatt, kundenuebersicht, etc.

This commit is contained in:
2025-09-01 16:55:09 +02:00
parent 1a7507e868
commit 4a3c92b0dd
9 changed files with 1455 additions and 1137 deletions

View File

@@ -1,6 +1,13 @@

Imports System.Data.SqlClient
Imports System.Net
Imports System.Numerics
Imports System.Reflection
Imports System.Runtime.InteropServices.ComTypes
Imports System.Text.RegularExpressions
Imports System.Threading
Imports System.Web.UI
Imports Microsoft.VisualBasic.ApplicationServices
Public Class cCreditSafeAPI
@@ -429,8 +436,75 @@ Public Class cCreditSafeAPI
R("newValue") = compObj.StringOf("newValue")
R("eventDate") = dateTime.GetAsTimestamp(getAsLocal)
R("createdDate") = dateTime.GetAsTimestamp(getAsLocal)
dtEvents.Rows.Add(R)
Dim cEvent As New cCreditsafeEvent(CLng(R("eventId")))
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 = 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
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
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
ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then
cEvent.newValueCR = cEvent.newValue
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
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
End If
End If
If cEvent.bonId Is Nothing AndAlso company.csBonID > 0 Then
cEvent.bonId = company.csBonID
End If
cEvent.SAVE()
j = j + 1
End While
Next
@@ -824,8 +898,8 @@ Public Class cCreditSafeAPI
Public Property csCEO As String
Public Property csTurnover As String
Public Property language As String
Public Property csBank As String
Public Property csBonID As Integer = -1
@@ -852,4 +926,141 @@ Public Class cCreditSafeAPI
End Sub
End Class
Public Class cCreditsafeEvent
Property eventId As Long
Property companyId As Object = Nothing
Property portfolioId As Object = Nothing
Property ruleName As Object = Nothing
Property localEventCode As Object = Nothing
Property globalEventCode As Object = Nothing
Property oldValue As Object = Nothing
Property newValue As Object = Nothing
Property eventDate As Object = Nothing
Property createdDate As Object = Nothing
Property importDate As Object = Nothing
Property bonId As Object = Nothing
Property Sachbearbeiter As Object = Nothing
Property oldValueCR As Object = Nothing
Property newValueCR As Object = Nothing
Property oldValueCL As Object = Nothing
Property newValueCL As Object = Nothing
Public hasEntry = False
Sub New(eventId)
Me.eventId = eventId
LOAD()
End Sub
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eventId", eventId,, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("companyId", companyId))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("portfolioId", portfolioId))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ruleName", ruleName))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("localEventCode", localEventCode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("globalEventCode", globalEventCode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("oldValue", oldValue))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("newValue", newValue))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eventDate", eventDate))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("createdDate", createdDate))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("importDate", importDate))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("bonId", bonId))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Sachbearbeiter", Sachbearbeiter))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("oldValueCR", oldValueCR))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("newValueCR", newValueCR))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("oldValueCL", oldValueCL))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("newValueCL", newValueCL))
Return list
End Function
Public Function SAVE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblCreditsafeEvents WHERE eventId=@eventId) " &
" BEGIN " & getUpdateCmd() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
" commit tran "
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
End Function
Public Sub LOAD()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblCreditsafeEvents WHERE eventId=@eventId ", conn)
cmd.Parameters.AddWithValue("@eventId", eventId)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
For Each li In getParameterList()
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
If dr.Item(li.Text) Is DBNull.Value Then
propInfo.SetValue(Me, Nothing)
Else
propInfo.SetValue(Me, dr.Item(li.Text))
End If
Next
hasEntry = True
End If
dr.Close()
End Using
End Using
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
Public Function getUpdateCmd() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim str As String = ""
For Each i In list
If Not i.isPrimaryParam Then
str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
Return (" UPDATE tblCreditsafeEvents SET " & str & " WHERE eventId=@eventId ")
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return ""
End Function
Public Function getInsertCmd() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim str As String = ""
Dim values As String = ""
For Each i In list
'If Not i.isPrimaryParam Then
str &= "[" & i.Text & "],"
values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
'End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
values = values.Substring(0, values.Length - 1) 'wg. ','
Return (" INSERT INTO tblCreditsafeEvents (" & str & ") VALUES(" & values & ") ")
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return ""
End Function
End Class
End Class