div. Änderungen

This commit is contained in:
2026-03-31 16:22:01 +02:00
parent 377f33b4e7
commit ca6dba389b
11 changed files with 217 additions and 39 deletions

View File

@@ -4,7 +4,7 @@ Imports System.Reflection
Public Class cFremdwaehrungskurse
Property fw_id As String
Property fw_id As Integer
Property fw_iso2 As String
Property fw_iso3 As String
Property fw_land As String
@@ -12,6 +12,8 @@ Public Class cFremdwaehrungskurse
Property fw_enddatum As Date
Property fw_kurswert As Double
Public hasEntry = False
Dim SQL As New SQL
@@ -19,10 +21,19 @@ Public Class cFremdwaehrungskurse
End Sub
Sub New(fw_iso3 As String)
Me.fw_iso3 = fw_iso3
LOAD_ByWaehrungscode(fw_iso3)
End Sub
Public 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("fw_id", fw_id))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("fw_id", fw_id,, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("fw_iso2", fw_iso2))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("fw_iso3", fw_iso3))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("fw_land", fw_land))
@@ -50,6 +61,33 @@ Public Class cFremdwaehrungskurse
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
End Function
Public Sub LOAD_ByWaehrungscode(fw_iso3 As String)
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT top(1) * FROM tblZOLL_Wechselkurse WHERE fw_iso3=@fw_iso3 ORDER BY fw_startdatum desc ", conn)
cmd.Parameters.AddWithValue("@fw_iso3", fw_iso3)
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
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
End Sub
Public Function getUpdateCmd() As String
@@ -116,6 +154,13 @@ Public Class cFremdwaehrungskurse
'End Function
Shared Function EXCHANGE_CURTOEUR(betrag As Double, waehrungscode As String, datum As Date) As Double
Dim sqlstr = " SELECT TOP 1 [fw_kurswert] FROM [tblZOLL_Wechselkurse] where fw_iso3='" & waehrungscode & "' and fw_startdatum<='" & datum.ToShortDateString & "' order by fw_startdatum desc"
Return betrag / (New SQL).getValueTxtBySql(sqlstr, "FMZOLL",,, 0)
End Function
End Class