Imports System.Net
Imports System.Xml
Imports System.IO
Imports System.Text
Imports System.Data.SqlClient
Imports DAKOSY_Worker.cAES_ZustaendigeZST

Public Class cIMPORT_Codelisten


    Public Shared Function IMPORT(CodelistenCode, TESTSYSTEM) As Boolean
        Select Case CodelistenCode
            Case "C0008"
                Return Import_C0008(TESTSYSTEM)
            Case "C0017"
                Return Import_C0017(TESTSYSTEM)
            Case "C0013"
                Return Import_C0013(TESTSYSTEM)
            Case "C0014"
                Return Import_C0014(TESTSYSTEM)
            Case "C0010"
                Return Import_C0010(TESTSYSTEM)
            Case "A0122"
                Return Import_A0122(TESTSYSTEM)
            Case "A0127"
                Return Import_A0127(TESTSYSTEM)
            Case "I0400"
                Return Import_I0400(TESTSYSTEM)
            Case "I0200"
                Return Import_I0200(TESTSYSTEM)
            Case "I0700"
                Return Import_I0700(TESTSYSTEM)
            Case "C0141"
                Return Import_C0141(TESTSYSTEM)
            Case "I0610"
                Return Import_I0610(TESTSYSTEM)
            Case "C0219"
                Return Import_C0219(TESTSYSTEM)
        End Select
        Return False
    End Function


    Shared Function Import_C0008(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("C0008_URL", TESTSYSTEM, "VERAG")

                If URL = String.Empty Then Return False

                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cLaenderCodes
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes

                                Dim Code = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cLaenderCodes.cLaenderCode(Code, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)

        End Try
        Return False

    End Function


    Shared Function Import_C0010(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0010_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("C0010_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False

                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cLaenderCodesC0010
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes

                                Dim Code = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cLaenderCodesC0010.cLaenderCodesC0010(Code, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function

    Shared Function Import_C0017(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("C0017_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cPackstueckeVerpackungsarten
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                '     MsgBox(Entry.SelectNodes("Code")(0).InnerText)
                                Dim Code = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cPackstueckeVerpackungsarten.cVerpackungsart(Code, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function


    Shared Function Import_C0014(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("C0014_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cVorpapierArten
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                '     MsgBox(Entry.SelectNodes("Code")(0).InnerText)
                                Dim Code = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cVorpapierArten.cVorpapierArt(Code, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function



    Shared Function Import_C0141(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("C0141_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cZollstellen
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                '     MsgBox(Entry.SelectNodes("Code")(0).InnerText)
                                Dim Code = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cZollstellen.cZollstelle(Code, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function


    Shared Function Import_C0013(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("C0013_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cUnterlageArten
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                '     MsgBox(Entry.SelectNodes("Code")(0).InnerText)
                                Dim Code = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cUnterlageArten.cUnterlageArt(Code, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function


    Shared Function Import_A0122(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' A0122_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("A0122_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False

                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cAnmArtenUeberfuehrung
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes

                                Dim Code = ""
                                Dim Qualifier = ""
                                Dim Note = ""
                                Dim Description = ""
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Qualifier").Count > 0 Then Qualifier = Entry.SelectNodes("Qualifier")(0).InnerText
                                If Entry.SelectNodes("Note").Count > 0 Then Note = Entry.SelectNodes("Note")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText

                                LC.Add(New cAnmArtenUeberfuehrung.cAnmArtUeberfuehrung(Code, Qualifier, Note, Description))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function

    Shared Function Import_A0127(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' A0122_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("A0127_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False

                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cBeteiligtenKonstellationen
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes

                                Dim Code = ""
                                Dim Description = ""
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText

                                LC.Add(New cBeteiligtenKonstellationen.cBeteiligtenKonstellation(Code, Description))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function



    Shared Function Import_I0400(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("I0400_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cWaehrungsliste
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                '     MsgBox(Entry.SelectNodes("Code")(0).InnerText)
                                Dim Code = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cWaehrungsliste.cWaehrungI0400(Code, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function


    Shared Function Import_C0219(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("C0219_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cBefoerderungsmittelartenC0219
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                '     MsgBox(Entry.SelectNodes("Code")(0).InnerText)
                                Dim Code = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cBefoerderungsmittelartenC0219.cBefoerderungsmittelart(Code, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function


    Shared Function Import_I0200(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("I0200_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cEZA_Unterlagearten
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                '     MsgBox(Entry.SelectNodes("Code")(0).InnerText)
                                Dim DocumentCode = ""
                                Dim Division = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("DocumentCode").Count > 0 Then DocumentCode = Entry.SelectNodes("DocumentCode")(0).InnerText
                                If Entry.SelectNodes("Division").Count > 0 Then Division = Entry.SelectNodes("Division")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cEZA_Unterlagearten.cEZA_UnterlageartenI0200(DocumentCode, Division, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function



    Shared Function Import_I0610(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("I0610_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cAES_ZustaendigeZST
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                Dim Code = ""
                                Dim Qualifier = ""
                                Dim Description = ""
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Qualifier").Count > 0 Then Qualifier = Entry.SelectNodes("Qualifier")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText

                                LC.Add(New cAES_ZustaendigeZST.cAES_ZustaendigeZST_I0610(Code, Qualifier, Description))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function


    Shared Function Import_I0700(TESTSYSTEM) As Boolean
        Dim MyData As String = ""
        Try
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Using WC As New System.Net.WebClient()
                ' C0008_URL()
                WC.Encoding = ASCIIEncoding.UTF8
                Dim URL = cDY_Paramter.GET_PARAM_ByName("I0700_URL", TESTSYSTEM, "VERAG")
                If URL = String.Empty Then Return False
                ' MsgBox(URL)
                MyData = WC.DownloadString(URL)
                Dim doc As New XmlDocument()
                doc.LoadXml(MyData)

                Dim LC As New cMasseinheit
                If doc.HasChildNodes Then
                    If doc.GetElementsByTagName("Codelist").Count > 0 Then
                        If doc.GetElementsByTagName("Codelist")(0).HasChildNodes Then
                            For Each Entry As XmlNode In doc.GetElementsByTagName("Codelist")(0).ChildNodes
                                '     MsgBox(Entry.SelectNodes("Code")(0).InnerText)
                                Dim Code = ""
                                Dim Qualifier = ""
                                Dim CodeQualifier = ""
                                Dim Description = ""
                                Dim StartDate = Nothing
                                Dim EndDate = Nothing
                                If Entry.SelectNodes("Code").Count > 0 Then Code = Entry.SelectNodes("Code")(0).InnerText
                                If Entry.SelectNodes("Qualifier").Count > 0 Then Qualifier = Entry.SelectNodes("Qualifier")(0).InnerText
                                If Entry.SelectNodes("Description").Count > 0 Then Description = Entry.SelectNodes("Description")(0).InnerText
                                If Entry.SelectNodes("StartDate").Count > 0 Then StartDate = CDate(Entry.SelectNodes("StartDate")(0).InnerText)
                                If Entry.SelectNodes("EndDate").Count > 0 Then EndDate = CDate(Entry.SelectNodes("EndDate")(0).InnerText)

                                LC.Add(New cMasseinheit.cMasseinheitI0700(Code, Qualifier, Code & Qualifier, Description, StartDate, EndDate))

                            Next
                        End If
                    End If
                End If
                If LC.Count > 0 Then
                    Return LC.INSERT_DB(TESTSYSTEM)
                End If
            End Using

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
        End Try
        Return False

    End Function



End Class



Class cWaehrungsliste
    Inherits List(Of cWaehrungI0400)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_I0400_Waehrungsliste]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_I0400_Waehrungsliste] (Code, Description, StartDate, EndDate) VALUES (@Code, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cWaehrungI0400
        Property Code As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class

Class cBefoerderungsmittelartenC0219
    Inherits List(Of cBefoerderungsmittelart)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_C0219_TypeTransportMeans]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_C0219_TypeTransportMeans] (Code, Description, StartDate, EndDate) VALUES (@Code, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cBefoerderungsmittelart
        Property Code As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class

Class cMasseinheit
    Inherits List(Of cMasseinheitI0700)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_I0700_Masseinheiten]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Qualifier", l.Qualifier))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("CodeQualifier", l.CodeQualifier))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_I0700_Masseinheiten] (Code, Qualifier,CodeQualifier,Description, StartDate, EndDate) VALUES (@Code,@Qualifier,@CodeQualifier,@Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cMasseinheitI0700
        Property Code As String = ""
        Property Qualifier As String = ""
        Property CodeQualifier As String = ""

        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Qualifier, CodeQualifier, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Qualifier = Qualifier
            Me.CodeQualifier = CodeQualifier
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class



End Class

Class cEZA_Unterlagearten
    Inherits List(Of cEZA_UnterlageartenI0200)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_I0200_Unterlagearten]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("DocumentCode", l.DocumentCode))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Division", l.Division))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_I0200_Unterlagearten] (Code,DocumentCode,Division, Description, StartDate, EndDate) VALUES (@Code,@DocumentCode,@Division, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cEZA_UnterlageartenI0200
        Property Code As String = ""
        Property DocumentCode As String = ""
        Property Division As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(DocumentCode, Division, Description, StartDate, EndDate)
            Me.Code = Division & "/" & DocumentCode
            Me.DocumentCode = DocumentCode
            Me.Division = Division
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class



Class cAES_ZustaendigeZST
    Inherits List(Of cAES_ZustaendigeZST_I0610)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_I0610_ZustaendigeZSTAES]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Qualifier", l.Qualifier))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_I0610_ZustaendigeZSTAES] (Code, Qualifier, Description) VALUES (@Code, @Qualifier, @Description); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cAES_ZustaendigeZST_I0610
        Property Code As String = ""
        Property Qualifier As String = ""
        Property Description As String = ""

        Sub New(Code, Qualifier, Description)
            Me.Code = Code
            Me.Qualifier = Qualifier
            Me.Description = Description

        End Sub
    End Class

End Class


Class cLaenderCodesC0010
    Inherits List(Of cLaenderCodesC0010)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_C0010_LaenderAES]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_C0010_LaenderAES] (Code, Description, StartDate, EndDate) VALUES (@Code, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cLaenderCodesC0010
        Property Code As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class


Class cLaenderCodes
    Inherits List(Of cLaenderCode)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_C0008_LaenderFull]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_C0008_LaenderFull] (Code, Description, StartDate, EndDate) VALUES (@Code, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cLaenderCode
        Property Code As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class



Public Class cAnmArtenUeberfuehrung
    Inherits List(Of cAnmArtUeberfuehrung)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_A0122_AnmArtUeberfuehrung]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Qualifier", l.Qualifier))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Note", l.Note))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_A0122_AnmArtUeberfuehrung] (Code, Qualifier, Note, Description) VALUES (@Code, @Qualifier, @Note, @Description); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function


    Shared Function LOAD() As List(Of cAnmArtUeberfuehrung)
        Try
            Dim LIST As New List(Of cAnmArtUeberfuehrung)
            Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
            Dim dt As DataTable = SQL.loadDgvBySql("SELECT * FROM [tbl_DY_ZollDE_A0122_AnmArtUeberfuehrung]", "FMZOLL")
            If dt IsNot Nothing Then
                For Each r In dt.Rows
                    LIST.Add(New cAnmArtenUeberfuehrung.cAnmArtUeberfuehrung(r("Code"), r("Qualifier"), r("Note"), r("Description")))
                Next
            End If
            Return LIST
        Catch ex As Exception
            MsgBox(ex.Message & ex.StackTrace)
        End Try
        Return Nothing
    End Function

    Public Class cAnmArtUeberfuehrung
        Property Code As String = ""
        Property Qualifier As String = ""
        Property Note As String = ""
        Property Description As String = ""

        Sub New(Code, Qualifier, Note, Description)
            Me.Code = Code
            Me.Qualifier = Qualifier
            Me.Note = Note
            Me.Description = Description
        End Sub
    End Class

End Class

Public Class cBeteiligtenKonstellationen
    Inherits List(Of cBeteiligtenKonstellation)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_A0127_BeteiligtenKonstellation]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_A0127_BeteiligtenKonstellation] (Code, Description) VALUES (@Code, @Description); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function


    Shared Function LOAD() As List(Of cBeteiligtenKonstellation)
        Try
            Dim LIST As New List(Of cBeteiligtenKonstellation)
            Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
            Dim dt As DataTable = SQL.loadDgvBySql("SELECT * FROM [tbl_DY_ZollDE_A0127_BeteiligtenKonstellation]", "FMZOLL")
            If dt IsNot Nothing Then
                For Each r In dt.Rows
                    LIST.Add(New cBeteiligtenKonstellationen.cBeteiligtenKonstellation(r("Code"), r("Description")))
                Next
            End If
            Return LIST
        Catch ex As Exception
            MsgBox(ex.Message & ex.StackTrace)
        End Try
        Return Nothing
    End Function

    Public Class cBeteiligtenKonstellation
        Property Code As String = ""
        Property Description As String = ""

        Sub New(Code, Description)
            Me.Code = Code
            Me.Description = Description
        End Sub
    End Class

End Class




Class cPackstueckeVerpackungsarten
    Inherits List(Of cVerpackungsart)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_C0017_PackstueckeVerpackungsarten]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_C0017_PackstueckeVerpackungsarten] (Code, Description, StartDate, EndDate) VALUES (@Code, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cVerpackungsart
        Property Code As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class



Class cVorpapierArten
    Inherits List(Of cVorpapierArt)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_C0014_VorpapierArten]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_C0014_VorpapierArten] (Code, Description, StartDate, EndDate) VALUES (@Code, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cVorpapierArt
        Property Code As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class


Class cZollstellen
    Inherits List(Of cZollstelle)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_C0141_Zollstellen]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_C0141_Zollstellen] (Code, Description, StartDate, EndDate) VALUES (@Code, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cZollstelle
        Property Code As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class

Class cUnterlageArten
    Inherits List(Of cUnterlageArt)

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Function INSERT_DB(TESTSSYSTEM) As Boolean

        If SQL.doSQL("DELETE FROM [tbl_DY_ZollDE_C0013_UnterlagenArten]", , , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
            Dim ok = True
            For Each l In Me
                Dim List As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Code", l.Code))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("Description", l.Description))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("StartDate", l.StartDate))
                List.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EndDate", l.EndDate))
                If Not SQL.doSQL("INSERT INTO [tbl_DY_ZollDE_C0013_UnterlagenArten] (Code, Description, StartDate, EndDate) VALUES (@Code, @Description, @StartDate, @EndDate); ", "FMZOLL", , List, SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSSYSTEM)) Then
                    ok = False
                End If
            Next
            Return ok
        End If
        Return False
    End Function

    Class cUnterlageArt
        Property Code As String = ""
        Property Description As String = ""
        Property StartDate As Object = Nothing
        Property EndDate As Object = Nothing

        Sub New(Code, Description, StartDate, EndDate)
            Me.Code = Code
            Me.Description = Description
            Me.StartDate = StartDate
            Me.EndDate = EndDate
        End Sub
    End Class

End Class


Public Class cDY_Paramter
    Shared SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Shared Function GET_PARAM_ByName(dyParam_name, TESTSYSTEM, Optional FIRMA_DY = "") As String
        If FIRMA_DY = "" Then FIRMA_DY = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
        Return SQL.getValueTxtBySql("SELECT TOP 1 [dyParam_value]  FROM [tbl_DY_Paramter] WHERE  [dyParam_name]='" & dyParam_name & "' AND  dyParam_firma='" & FIRMA_DY & "' AND dyParam_testsystem = " & IIf(TESTSYSTEM, 1, 0), "FMZOLL", , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSYSTEM))
    End Function
End Class

