Timas, Asfinag-Schnittstelle
This commit is contained in:
@@ -4,7 +4,9 @@ Imports System.IO
|
||||
Imports System.Net
|
||||
Imports System.Text
|
||||
Imports System.Xml
|
||||
|
||||
Imports DocumentFormat.OpenXml.Drawing.Diagrams
|
||||
|
||||
Imports DocumentFormat.OpenXml.Wordprocessing
|
||||
Imports iTextSharp.text.pdf.qrcode.Version
|
||||
Imports Org.BouncyCastle.Asn1.Pkcs
|
||||
@@ -244,7 +246,10 @@ Public Class frmStartOptions
|
||||
Me.Refresh()
|
||||
DAKOSY_Worker.cIMPORT_Codelisten.IMPORT("I6010", True)
|
||||
DAKOSY_Worker.cIMPORT_Codelisten.IMPORT("I6010", False)
|
||||
importEZOLLWechselkurse(True)
|
||||
importEZOLLWechselkurse(False)
|
||||
Me.Refresh()
|
||||
|
||||
closeMe()
|
||||
End Sub
|
||||
Case "KD_DATA_DAKOSY"
|
||||
@@ -2002,6 +2007,7 @@ Public Class frmStartOptions
|
||||
PictureBox18.Visible = False
|
||||
PictureBox19.Visible = False
|
||||
PictureBox20.Visible = False
|
||||
PictureBox21.Visible = False
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -3105,13 +3111,13 @@ Public Class frmStartOptions
|
||||
ASFINAG_LKW()
|
||||
End Sub
|
||||
|
||||
Function ASFINAG_LKW()
|
||||
Function ASFINAG_LKW(Optional isFMZoll As Boolean = True) As Boolean
|
||||
Try
|
||||
Dim SQl As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
' CLF-Einträge aus den bestehenden SDL-Datensätzen entfernen,
|
||||
' damit nach dem Aktualisierungslauf der Istzustand der CLF in der SDL hergestellt wird.
|
||||
If Not SQl.getValueTxtBySql("UPDATE SDL Set OBUID = NULL, Vertragsabschlussdatum = NULL, Kategorie = NULL, Status = NULL WHERE (SDLNr = 200) AND (NOT Vertragsabschlussdatum IS NULL)", "SDL") Then
|
||||
If Not SQl.doSQL("UPDATE SDL Set OBUID = NULL, Vertragsabschlussdatum = NULL, Kategorie = NULL, Status = NULL WHERE (SDLNr = 200) AND (NOT Vertragsabschlussdatum IS NULL)", "SDL") Then
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("ERROR", "Fehler beim Reset SDL-Daten.", System.Reflection.MethodBase.GetCurrentMethod.Name)
|
||||
Return False
|
||||
End If
|
||||
@@ -3124,74 +3130,150 @@ Public Class frmStartOptions
|
||||
End If
|
||||
|
||||
|
||||
If isFMZoll Then
|
||||
|
||||
' Verbindung zur ASFINAG Datenbank herstellen
|
||||
Dim connectionString = ""
|
||||
If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
|
||||
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\DEVELOPER\f\FMZoll\Mautmanager.adp"
|
||||
Else
|
||||
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL\f\FMZoll\Mautmanager.adp"
|
||||
End If
|
||||
Dim con As New OleDbConnection(connectionString)
|
||||
Dim cmd As New OleDbCommand
|
||||
Dim var1 As String
|
||||
Dim adapter As OleDbDataAdapter = New OleDbDataAdapter()
|
||||
Dim reader As OleDbDataReader = Nothing
|
||||
|
||||
' Verbindung zur ASFINAG Datenbank herstellen
|
||||
Dim connectionString = ""
|
||||
If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
|
||||
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\DEVELOPER\f\FMZoll\Mautmanager.adp"
|
||||
' Kfz Kennzeichen einlesen.
|
||||
Dim SQLQuery = "SELECT CardNumber, ValidTo, OBUID, KfzKennzeichen, Nationalität, DatumVertragsabschluss, Kategorie, Schadstoffklasse, Status FROM vwCLFBody "
|
||||
Using Command As New OleDbCommand(SQLQuery, con)
|
||||
Using oRDR As OleDbDataReader = Command.ExecuteReader
|
||||
While (oRDR.Read)
|
||||
Dim KartenNr = oRDR.GetValue("CardNumber")
|
||||
|
||||
Dim KfzKennzeichen = fktConvert(oRDR.GetValue("KfzKennzeichen"))
|
||||
|
||||
' Kundennummer einlesen
|
||||
Dim KdNr As Integer = SQl.getValueTxtBySql("SELECT AdressenNr FROM Kreditkarten WHERE KartenNr='" & KartenNr & "'", "SDL",,, -1)
|
||||
|
||||
If KdNr > 0 Then
|
||||
|
||||
Call fktKundenSDLVerwalten(KdNr, SDLNr)
|
||||
Call fktKundenLkwVerwalten(KdNr, oRDR.GetValue("KfzKennzeichen"), oRDR.GetValue("Nationalität"))
|
||||
|
||||
Dim SDL = New VERAG_PROG_ALLGEMEIN.cSDL(KdNr, oRDR.GetValue("KfzKennzeichen"), SDLNr)
|
||||
If Not SDL.hasentry Then
|
||||
SDL.KundenNr = KdNr
|
||||
SDL.KfzKennzeichen = KfzKennzeichen
|
||||
SDL.SDLNr = SDLNr
|
||||
SDL.History = 0 'fktLiefereHistorywert(!KundenNr, !SDLNr)
|
||||
SDL.Erfassungsdatum = Now
|
||||
Else
|
||||
SDL.Änderungsdatum = Now
|
||||
End If
|
||||
SDL.Sachbearbeiter = "ASFINAG"
|
||||
|
||||
Dim Validto = SQL.checkNullStr(oRDR.GetValue("DatumVertragsabschluss"))
|
||||
|
||||
SDL.KartenNr = SQL.checkNullStr(oRDR.GetValue("CardNumber"))
|
||||
If Validto <> "" Then
|
||||
SDL.GültigBis = DateAdd("d", -1, DateAdd("m", 1, DateSerial("20" & Mid(Validto, 1, 2), Mid(Validto, 3, 2), 1)))
|
||||
End If
|
||||
|
||||
SDL.OBUID = SQL.checkNullStr(oRDR.GetValue("OBUID"))
|
||||
SDL.Vertragsabschlussdatum = SQL.checkNullStr(oRDR.GetValue("DatumVertragsabschluss"))
|
||||
SDL.Kategorie = SQL.checkNullStr(oRDR.GetValue("Kategorie"))
|
||||
SDL.Schadstoffklasse = SQL.checkNullStr(oRDR.GetValue("Schadstoffklasse"))
|
||||
SDL.Status = SQL.checkNullStr(oRDR.GetValue("Status"))
|
||||
SDL.SAVE()
|
||||
End If
|
||||
|
||||
End While
|
||||
End Using
|
||||
End Using
|
||||
con.Close()
|
||||
Else
|
||||
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\FMZOLL\f\FMZoll\Mautmanager.adp"
|
||||
End If
|
||||
Dim con As New OleDbConnection(connectionString)
|
||||
Dim cmd As New OleDbCommand
|
||||
Dim var1 As String
|
||||
Dim adapter As OleDbDataAdapter = New OleDbDataAdapter()
|
||||
Dim reader As OleDbDataReader = Nothing
|
||||
|
||||
' Kfz Kennzeichen einlesen.
|
||||
Dim SQLQuery = "SELECT CardNumber, ValidTo, OBUID, KfzKennzeichen, Nationalität, DatumVertragsabschluss, Kategorie, Schadstoffklasse, Status FROM vwCLFBody "
|
||||
Using Command As New OleDbCommand(SQLQuery, con)
|
||||
Using oRDR As OleDbDataReader = Command.ExecuteReader
|
||||
While (oRDR.Read)
|
||||
Dim KartenNr = oRDR.GetValue("CardNumber")
|
||||
' Kfz Kennzeichen einlesen.
|
||||
|
||||
Dim KfzKennzeichen = fktConvert(oRDR.GetValue("KfzKennzeichen"))
|
||||
|
||||
' Kundennummer einlesen
|
||||
Dim KdNr As Integer = SQl.getValueTxtBySql("SELECT AdressenNr FROM Kreditkarten WHERE KartenNr='" & KartenNr & "'", "SDL",,, -1)
|
||||
Dim strSQLASFINAG = "SELECT cardNumber, ValidTo, OBUID, vehicleLicensePlate, nationality, contractDate, vehicleCategory, emissionCategory, status FROM vwCLFBody"
|
||||
|
||||
If KdNr > 0 Then
|
||||
Dim dtAsfinag As DataTable = SQl.loadDgvBySql_Param(strSQLASFINAG, "ASFINAG")
|
||||
|
||||
Call fktKundenSDLVerwalten(KdNr, SDLNr)
|
||||
Call fktKundenLkwVerwalten(KdNr, oRDR.GetValue("KfzKennzeichen"), oRDR.GetValue("Nationalität"))
|
||||
If dtAsfinag.Rows.Count < 1 Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim SDL = New VERAG_PROG_ALLGEMEIN.cSDL(KdNr, oRDR.GetValue("KfzKennzeichen"), SDLNr)
|
||||
If Not SDL.hasentry Then
|
||||
SDL.KundenNr = KdNr
|
||||
SDL.KfzKennzeichen = KfzKennzeichen
|
||||
SDL.SDLNr = SDLNr
|
||||
SDL.History = 0 'fktLiefereHistorywert(!KundenNr, !SDLNr)
|
||||
SDL.Erfassungsdatum = Now
|
||||
Else
|
||||
SDL.Änderungsdatum = Now
|
||||
End If
|
||||
SDL.Sachbearbeiter = "ASFINAG"
|
||||
For Each row As DataRow In dtAsfinag.Rows
|
||||
|
||||
Dim Validto = SQL.checkNullStr(oRDR.GetValue("DatumVertragsabschluss"))
|
||||
Dim KdNr As Integer = SQl.getValueTxtBySql("SELECT Kreditkarten.AdressenNr FROM Kreditkarten WHERE Kreditkarten.KartenNr='" & row.Item("cardNumber") & "'", "FMZOLL",,, -1)
|
||||
|
||||
SDL.KartenNr = SQL.checkNullStr(oRDR.GetValue("CardNumber"))
|
||||
If Validto <> "" Then
|
||||
SDL.GültigBis = DateAdd("d", -1, DateAdd("m", 1, DateSerial("20" & Mid(Validto, 1, 2), Mid(Validto, 3, 2), 1)))
|
||||
End If
|
||||
|
||||
SDL.OBUID = SQL.checkNullStr(oRDR.GetValue("OBUID"))
|
||||
SDL.Vertragsabschlussdatum = SQL.checkNullStr(oRDR.GetValue("DatumVertragsabschluss"))
|
||||
SDL.Kategorie = SQL.checkNullStr(oRDR.GetValue("Kategorie"))
|
||||
SDL.Schadstoffklasse = SQL.checkNullStr(oRDR.GetValue("Schadstoffklasse"))
|
||||
SDL.Status = SQL.checkNullStr(oRDR.GetValue("Status"))
|
||||
SDL.SAVE()
|
||||
If KdNr > 0 Then
|
||||
|
||||
Call fktKundenSDLVerwalten(KdNr, SDLNr)
|
||||
Call fktKundenLkwVerwalten(KdNr, row.Item("vehicleLicensePlate"), row.Item("nationality"))
|
||||
|
||||
' Die MautAT Tabelle aktualisieren.
|
||||
|
||||
Dim SDL = New VERAG_PROG_ALLGEMEIN.cSDL(KdNr, row.Item("vehicleLicensePlate"), SDLNr)
|
||||
|
||||
If Not SDL.hasentry Then
|
||||
SDL.KundenNr = KdNr
|
||||
SDL.KfzKennzeichen = row.Item("vehicleLicensePlate")
|
||||
SDL.SDLNr = SDLNr
|
||||
SDL.History = 0 'fktLiefereHistorywert(!KundenNr, !SDLNr)
|
||||
SDL.Erfassungsdatum = Now
|
||||
Else
|
||||
SDL.Änderungsdatum = Now
|
||||
End If
|
||||
SDL.Sachbearbeiter = "ASFINAG"
|
||||
|
||||
Dim Validto = SQL.checkNullStr(row.Item("contractDate"))
|
||||
|
||||
SDL.KartenNr = SQL.checkNullStr(row.Item("cardNumber"))
|
||||
If Validto <> "" Then
|
||||
'MsgBox(Mid(Validto, 7, 2) & " " & Mid(Validto, 4, 2))
|
||||
SDL.GültigBis = DateAdd("d", -1, DateAdd("m", 1, DateSerial("20" & Mid(Validto, 7, 2), Mid(Validto, 4, 2), 1))) 'noch im DETAIL checken!
|
||||
End If
|
||||
|
||||
End While
|
||||
End Using
|
||||
End Using
|
||||
con.Close()
|
||||
SDL.OBUID = SQL.checkNullStr(row.Item("OBUID"))
|
||||
SDL.Vertragsabschlussdatum = SQL.checkNullStr(row.Item("contractDate"))
|
||||
SDL.Kategorie = SQL.checkNullStr(row.Item("vehicleCategory"))
|
||||
SDL.Schadstoffklasse = SQL.checkNullStr(row.Item("emissionCategory"))
|
||||
SDL.Status = SQL.checkNullStr(row.Item("status"))
|
||||
SDL.SAVE()
|
||||
End If
|
||||
|
||||
Dim strOBU = "OBU " & row.Item("OBUID") & " jetzt in " & KdNr & "/" & row.Item("vehicleLicensePlate") & "/" & SDLNr & "/" & 0 & "."
|
||||
|
||||
' Mehrfachvorkommen der OBU-ID prüfen.
|
||||
Dim strSQL = "SELECT OBUID, Vermerk FROM vwSDL WHERE (SDLNr = " & SDLNr & ") And (OBUID = '" & row.Item("OBUID") & "') And ((KundenNr <> " & KdNr & ") Or (KfzKennzeichen <> '" & row.Item("vehicleLicensePlate") & "'))"
|
||||
Dim dtCheckOBUID As DataTable = SQl.loadDgvBySql_Param(strSQL, "SDL")
|
||||
|
||||
If dtCheckOBUID.Rows.Count > 0 Then
|
||||
|
||||
For Each rowCheckOBUID As DataRow In dtCheckOBUID.Rows
|
||||
Dim SDL = New VERAG_PROG_ALLGEMEIN.cSDL(KdNr, row.Item("vehicleLicensePlate"), SDLNr)
|
||||
Dim leftString = Trim(strOBU & " " & SDL.Vermerk.Substring(0, 100))
|
||||
SDL.Vermerk = Trim(strOBU & " " & SDL.Vermerk.Substring(0, 100))
|
||||
SDL.OBUID = DBNull.Value
|
||||
SDL.SAVE()
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.MAIL)
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.SHOW)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
@@ -3212,7 +3294,6 @@ Public Class frmStartOptions
|
||||
fktConvert = fktConvert & Mid(KfzKennzeichen, I, 1)
|
||||
End Select
|
||||
Next I
|
||||
|
||||
End Function
|
||||
|
||||
Public Function fktKundenLkwVerwalten(ByRef KdNr As Integer, ByRef KfzKennzeichen As String, Nationalitaet As String)
|
||||
@@ -3491,13 +3572,14 @@ Public Class frmStartOptions
|
||||
Dim f As New frmAsfinag_NachrichtenVerabeitung("clf")
|
||||
f.ShowDialog()
|
||||
Me.Visible = True
|
||||
'ASFINAG_LKW(False)
|
||||
End Sub
|
||||
|
||||
Private Sub LinkLabel42_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel42.LinkClicked
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
Dim blt = New cAsfinag.Exportist
|
||||
blt.initPFad()
|
||||
blt.initExportPfade()
|
||||
showPic(blt.exportiereWhiteList, PictureBox18)
|
||||
Me.Cursor = Cursors.Default
|
||||
End Sub
|
||||
@@ -3506,103 +3588,15 @@ Public Class frmStartOptions
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
Dim blt = New cAsfinag.Exportist
|
||||
blt.initPFad()
|
||||
blt.initExportPfade()
|
||||
showPic(blt.exportiereBlackList, PictureBox19)
|
||||
Me.Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Private Sub LinkLabel45_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel45.LinkClicked
|
||||
|
||||
Dim MyData As String = ""
|
||||
Dim SQL = New SQL
|
||||
Dim erg = True
|
||||
showPic(importEZOLLWechselkurse(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM), PictureBox20)
|
||||
|
||||
Dim firstDaycurrentMonth = DateTime.Now.AddMonths(0)
|
||||
firstDaycurrentMonth = New DateTime(firstDaycurrentMonth.Year, firstDaycurrentMonth.Month, 1)
|
||||
|
||||
Dim lastDaycurrentMonth = DateTime.Now.AddMonths(1)
|
||||
lastDaycurrentMonth = New DateTime(lastDaycurrentMonth.Year, lastDaycurrentMonth.Month, 1).AddDays(-1)
|
||||
|
||||
Dim kursart = "1" 'notirete Währung
|
||||
Dim startdatum_tag2 = firstDaycurrentMonth.Day
|
||||
Dim startdatum_monat2 = firstDaycurrentMonth.Month
|
||||
Dim startdatum_jahr2 = firstDaycurrentMonth.Year
|
||||
Dim enddatum_tag2 = lastDaycurrentMonth.Day
|
||||
Dim enddatum_monat2 = lastDaycurrentMonth.Month
|
||||
Dim enddatum_jahr2 = lastDaycurrentMonth.Year
|
||||
|
||||
Try
|
||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
|
||||
|
||||
Using WC As New System.Net.WebClient()
|
||||
' C0008_URL()
|
||||
WC.Encoding = ASCIIEncoding.UTF8
|
||||
Dim URL = "https://www.zoll.de/SiteGlobals/Functions/Kurse/KursExport.xml?view=xmlexportkursesearchresultZOLLWeb&kursart=" & kursart &
|
||||
"&startdatum_tag2=" & startdatum_tag2 &
|
||||
"&startdatum_monat2=" & startdatum_monat2 &
|
||||
"&startdatum_jahr2=" & startdatum_jahr2 &
|
||||
"&enddatum_tag2=" & enddatum_tag2 &
|
||||
"&enddatum_monat2=" & enddatum_monat2 &
|
||||
"&enddatum_jahr2=" & enddatum_jahr2 &
|
||||
"&sort=asc&spalte=gueltigkeit"
|
||||
If URL = String.Empty Then Exit Sub
|
||||
|
||||
MyData = WC.DownloadString(URL)
|
||||
Dim doc As New XmlDocument()
|
||||
doc.LoadXml(MyData)
|
||||
If doc.HasChildNodes Then
|
||||
|
||||
If doc.GetElementsByTagName("kurs").Count > 0 Then
|
||||
Dim endDatum, startDatum
|
||||
Dim count As Integer = 1
|
||||
For Each node As XmlElement In doc.GetElementsByTagName("kurs")
|
||||
Dim wk As New cFremdwaehrungskurse()
|
||||
If node.Attributes("id") IsNot Nothing Then wk.fw_id = node.Attributes("id").Value
|
||||
If node.HasChildNodes Then
|
||||
For Each element As XmlElement In node.ChildNodes
|
||||
If element.Name = "land" AndAlso element.InnerText <> "" Then wk.fw_land = element.InnerText
|
||||
If element.Name = "iso2" AndAlso element.InnerText <> "" Then wk.fw_iso2 = element.InnerText
|
||||
If element.Name = "iso3" AndAlso element.InnerText <> "" Then wk.fw_iso3 = element.InnerText
|
||||
If element.Name = "kurswert" AndAlso element.InnerText <> "" Then wk.fw_kurswert = element.InnerText
|
||||
If element.Name = "startdatum" AndAlso element.InnerText <> "" Then
|
||||
wk.fw_startdatum = element.InnerText
|
||||
startDatum = wk.fw_startdatum
|
||||
End If
|
||||
If element.Name = "enddatum" AndAlso element.InnerText <> "" Then
|
||||
wk.fw_enddatum = element.InnerText
|
||||
endDatum = wk.fw_enddatum
|
||||
End If
|
||||
Next
|
||||
count = count + 1
|
||||
wk.SAVE()
|
||||
End If
|
||||
Next
|
||||
Dim wk_euro As New cFremdwaehrungskurse()
|
||||
wk_euro.fw_id = 0
|
||||
wk_euro.fw_land = "Europa"
|
||||
wk_euro.fw_kurswert = 1
|
||||
wk_euro.fw_iso3 = "EUR"
|
||||
wk_euro.fw_iso2 = "EU"
|
||||
wk_euro.fw_startdatum = firstDaycurrentMonth.ToShortDateString()
|
||||
wk_euro.fw_enddatum = lastDaycurrentMonth.ToShortDateString()
|
||||
wk_euro.SAVE()
|
||||
|
||||
|
||||
|
||||
Dim sqlCount = SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM tblZOLL_Wechselkurse WHERE [fw_startdatum]='" & startDatum & "' AND fw_enddatum='" & endDatum & "'", "FMZOLL")
|
||||
If count <> sqlCount Then
|
||||
MsgBox("Anzahl der Importierten Datensätze:" & sqlCount & vbNewLine & "Anzahl Datensätze in Datei: " & count)
|
||||
erg = False
|
||||
End If
|
||||
End If
|
||||
showPic(erg, PictureBox20)
|
||||
End If
|
||||
|
||||
End Using
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
|
||||
Dim f As New frmDatenarchivarchiv
|
||||
@@ -3751,4 +3745,134 @@ Public Class frmStartOptions
|
||||
Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
|
||||
doAASVermerke_Ankunft()
|
||||
End Sub
|
||||
|
||||
Private Sub LinkLabel46_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel46.LinkClicked
|
||||
|
||||
Try
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim frm As New Form
|
||||
Dim dgv As New DataGridView()
|
||||
Dim dt As DataTable = SQL.loadDgvBySql("SELECT dbo.CLFBody.* FROM dbo.CLF INNER JOIN dbo.CLFBody ON dbo.CLF.PKHistory = dbo.CLFBody.PKHistory AND dbo.CLF.PKFileName = dbo.CLFBody.PKFileName", "ASFINAG")
|
||||
|
||||
dgv.DataSource = dt
|
||||
If dgv IsNot Nothing Then
|
||||
frm.Size = New Size(1400, 1000)
|
||||
dgv.Size = New Size(frm.Size.Width - 50, frm.Size.Height - 50)
|
||||
dgv.Dock = DockStyle.Fill
|
||||
dgv.Anchor = AnchorStyles.Left
|
||||
dgv.Anchor = AnchorStyles.Top
|
||||
frm.Controls.Add(dgv)
|
||||
frm.StartPosition = FormStartPosition.CenterScreen
|
||||
frm.ShowDialog()
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function importEZOLLWechselkurse(isTestsystem As Boolean) As Boolean
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = isTestsystem
|
||||
|
||||
Dim MyData As String = ""
|
||||
Dim SQL = New SQL
|
||||
Dim erg = True
|
||||
|
||||
Dim firstDaycurrentMonth = DateTime.Now.AddMonths(0)
|
||||
firstDaycurrentMonth = New DateTime(firstDaycurrentMonth.Year, firstDaycurrentMonth.Month, 1)
|
||||
|
||||
Dim lastDaycurrentMonth = DateTime.Now.AddMonths(1)
|
||||
lastDaycurrentMonth = New DateTime(lastDaycurrentMonth.Year, lastDaycurrentMonth.Month, 1).AddDays(-1)
|
||||
|
||||
Dim kursart = "1" 'notirete Währung
|
||||
Dim startdatum_tag2 = firstDaycurrentMonth.Day
|
||||
Dim startdatum_monat2 = firstDaycurrentMonth.Month
|
||||
Dim startdatum_jahr2 = firstDaycurrentMonth.Year
|
||||
Dim enddatum_tag2 = lastDaycurrentMonth.Day
|
||||
Dim enddatum_monat2 = lastDaycurrentMonth.Month
|
||||
Dim enddatum_jahr2 = lastDaycurrentMonth.Year
|
||||
|
||||
Try
|
||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
|
||||
|
||||
Using WC As New System.Net.WebClient()
|
||||
' C0008_URL()
|
||||
WC.Encoding = ASCIIEncoding.UTF8
|
||||
Dim URL = "https://www.zoll.de/SiteGlobals/Functions/Kurse/KursExport.xml?view=xmlexportkursesearchresultZOLLWeb&kursart=" & kursart &
|
||||
"&startdatum_tag2=" & startdatum_tag2 &
|
||||
"&startdatum_monat2=" & startdatum_monat2 &
|
||||
"&startdatum_jahr2=" & startdatum_jahr2 &
|
||||
"&enddatum_tag2=" & enddatum_tag2 &
|
||||
"&enddatum_monat2=" & enddatum_monat2 &
|
||||
"&enddatum_jahr2=" & enddatum_jahr2 &
|
||||
"&sort=asc&spalte=gueltigkeit"
|
||||
If URL = String.Empty Then Return False
|
||||
|
||||
MyData = WC.DownloadString(URL)
|
||||
Dim doc As New XmlDocument()
|
||||
doc.LoadXml(MyData)
|
||||
If doc.HasChildNodes Then
|
||||
|
||||
If doc.GetElementsByTagName("kurs").Count > 0 Then
|
||||
Dim endDatum, startDatum
|
||||
Dim count As Integer = 1
|
||||
For Each node As XmlElement In doc.GetElementsByTagName("kurs")
|
||||
Dim wk As New cFremdwaehrungskurse()
|
||||
If node.Attributes("id") IsNot Nothing Then wk.fw_id = node.Attributes("id").Value
|
||||
If node.HasChildNodes Then
|
||||
For Each element As XmlElement In node.ChildNodes
|
||||
If element.Name = "land" AndAlso element.InnerText <> "" Then wk.fw_land = element.InnerText
|
||||
If element.Name = "iso2" AndAlso element.InnerText <> "" Then wk.fw_iso2 = element.InnerText
|
||||
If element.Name = "iso3" AndAlso element.InnerText <> "" Then wk.fw_iso3 = element.InnerText
|
||||
If element.Name = "kurswert" AndAlso element.InnerText <> "" Then wk.fw_kurswert = element.InnerText
|
||||
If element.Name = "startdatum" AndAlso element.InnerText <> "" Then
|
||||
wk.fw_startdatum = element.InnerText
|
||||
startDatum = wk.fw_startdatum
|
||||
End If
|
||||
If element.Name = "enddatum" AndAlso element.InnerText <> "" Then
|
||||
wk.fw_enddatum = element.InnerText
|
||||
endDatum = wk.fw_enddatum
|
||||
End If
|
||||
Next
|
||||
count = count + 1
|
||||
wk.SAVE()
|
||||
End If
|
||||
Next
|
||||
Dim wk_euro As New cFremdwaehrungskurse()
|
||||
wk_euro.fw_id = 0
|
||||
wk_euro.fw_land = "Europa"
|
||||
wk_euro.fw_kurswert = 1
|
||||
wk_euro.fw_iso3 = "EUR"
|
||||
wk_euro.fw_iso2 = "EU"
|
||||
wk_euro.fw_startdatum = firstDaycurrentMonth.ToShortDateString()
|
||||
wk_euro.fw_enddatum = lastDaycurrentMonth.ToShortDateString()
|
||||
wk_euro.SAVE()
|
||||
|
||||
Dim sqlCount = SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM tblZOLL_Wechselkurse WHERE [fw_startdatum]='" & startDatum & "' AND fw_enddatum='" & endDatum & "'", "FMZOLL")
|
||||
If count <> sqlCount Then
|
||||
MsgBox("Anzahl der Importierten Datensätze:" & sqlCount & vbNewLine & "Anzahl Datensätze in Datei: " & count)
|
||||
erg = False
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
End Using
|
||||
|
||||
Return erg
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub LinkLabel47_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel47.LinkClicked
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
|
||||
showPic(ASFINAG_LKW(False), PictureBox21)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user