API Modaltrans
This commit is contained in:
@@ -2,20 +2,15 @@
|
||||
Imports System.Drawing
|
||||
Imports System.Net
|
||||
Imports System.Reflection
|
||||
Imports System.Security
|
||||
Imports System.Security.Cryptography
|
||||
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
|
||||
Imports Spire.Pdf.General.Paper.Uof
|
||||
Imports VERAG_PROG_ALLGEMEIN.agsCustomsExchange
|
||||
Imports VERAG_PROG_ALLGEMEIN.cOregonNCTSDeclarations
|
||||
Imports VERAG_PROG_ALLGEMEIN.IDEV_Intrastat
|
||||
|
||||
|
||||
|
||||
|
||||
Public Class cOregonNCTs_DeclarationData
|
||||
|
||||
Public Property id As Integer
|
||||
Public Property AvisoId As Integer
|
||||
Public Property auto_send As Boolean
|
||||
Public Property badge_code As String
|
||||
Public Property service_code As String
|
||||
@@ -91,6 +86,12 @@ Public Class cOregonNCTs_DeclarationData
|
||||
Public Property guarantee_code As Integer
|
||||
Public Property guarantee_reference As String
|
||||
Public Property status As String
|
||||
Public Property created As DateTime
|
||||
Public Property aviso_id As String
|
||||
Property parties As New List(Of cOregonNCTs_PartiesAttribute)
|
||||
Property traders As New List(Of cOregonNCTs_TraderAdditionsAttribute)
|
||||
Property goods As New List(Of cOregonNCTs_GoodsAttribute)
|
||||
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
@@ -99,7 +100,6 @@ Public Class cOregonNCTs_DeclarationData
|
||||
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("Id", id, , True, True))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("AvisoId", AvisoId))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("auto_send", auto_send))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("badge_code", badge_code))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("service_code", service_code))
|
||||
@@ -109,24 +109,27 @@ Public Class cOregonNCTs_DeclarationData
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ducr", ducr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mucr", mucr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ducr_part", ducr_part))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarant_eori", declarant_eori))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarant_name", declarant_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarant_address", declarant_address))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Carrier_Name", carrier_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarant_city_name", declarant_city_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarant_country_id", declarant_country_id))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarant_postcode", declarant_postcode))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarant_rep", declarant_rep))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Carrier_EORI", carrier_eori))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("export_country_id", export_country_id))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_eori", consignor_eori))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_name", consignor_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_address", consignor_address))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_city_name", consignor_city_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_country_id", consignor_country_id))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_postcode", consignor_postcode))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("multiple_consignor", multiple_consignor))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("import_country_id", import_country_id))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_eori", consignee_eori))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_name", consignee_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_address", consignee_address))
|
||||
@@ -134,32 +137,33 @@ Public Class cOregonNCTs_DeclarationData
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_country_id", consignee_country_id))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_postcode", consignee_postcode))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("multiple_consignee", multiple_consignee))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("invoice_amount", invoice_amount))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("invoice_curr", invoice_curr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("goods_location", goods_location))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("border_transport_type", border_transport_type))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Carrier_Name", carrier_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("border_vehicle_code", border_vehicle_code))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("border_vehicle_coun", border_vehicle_coun))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("inland_transport_type", inland_transport_type))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("container_no", container_no))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Carrier_EORI", carrier_eori))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gvms_interested", gvms_interested))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("freight_amount", freight_amount))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("freight_curr", freight_curr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("payment_method", payment_method))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("carrier_eori", carrier_eori))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("carrier_name", carrier_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("carrier_address", carrier_address))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("carrier_city_name", carrier_city_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("carrier_country_id", carrier_country_id))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("carrier_postcode", carrier_postcode))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("total_packages", total_packages))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("nature_of_transaction", nature_of_transaction))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("premises_code", premises_code))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("first_dan_no", first_dan_no))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("second_dan_no", second_dan_no))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Carrier_Name", carrier_name))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("insurance_amount", insurance_amount))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("insurance_curr", insurance_curr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("other_amounts", other_amounts))
|
||||
@@ -170,6 +174,7 @@ Public Class cOregonNCTs_DeclarationData
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("airfreight_cost", airfreight_cost))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("vat_adjustment", vat_adjustment))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("vat_adjustment_curr", vat_adjustment_curr))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("discount_amount", discount_amount))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("discount_curr", discount_curr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("discount_rate", discount_rate))
|
||||
@@ -179,7 +184,10 @@ Public Class cOregonNCTs_DeclarationData
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("arrival_transport_type", arrival_transport_type))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("guarantee_code", guarantee_code))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("guarantee_reference", guarantee_reference))
|
||||
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("status", status))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("created", created))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("aviso_id", aviso_id))
|
||||
|
||||
Return list
|
||||
End Function
|
||||
@@ -193,6 +201,45 @@ Public Class cOregonNCTs_DeclarationData
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
Shared Function LOADByBezugsNr(bezugsNr As String, loadALL As Boolean) As cOregonNCTs_DeclarationData
|
||||
Try
|
||||
Dim NCTS As New cOregonNCTs_DeclarationData
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
'
|
||||
Using cmd As New SqlCommand("SELECT TOP 1 * FROM tblOregonNCTS_DeclarationData WHERE commercial_ref Like '@bezugsNr' ", conn)
|
||||
cmd.Parameters.AddWithValue("@bezugsNr", bezugsNr)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In NCTS.getParameterList()
|
||||
Dim propInfo As PropertyInfo = NCTS.GetType.GetProperty(li.Scalarvariable)
|
||||
|
||||
If dr.Item(li.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(NCTS, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(NCTS, dr.Item(li.Text))
|
||||
End If
|
||||
|
||||
Next
|
||||
If loadALL Then
|
||||
NCTS.LOAD_Goods()
|
||||
NCTS.LOAD_Parties()
|
||||
NCTS.LOAD_Traders()
|
||||
End If
|
||||
|
||||
dr.Close()
|
||||
Return NCTS
|
||||
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
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Public Function UPDATE_STATUS(status) As Boolean
|
||||
Me.status = status
|
||||
Return Me.SAVE
|
||||
@@ -213,6 +260,160 @@ Public Class cOregonNCTs_DeclarationData
|
||||
Return id > 0
|
||||
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 tblOregonNCTS_DeclarationData (" & str & ") VALUES(" & values & ") ")
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
'##
|
||||
|
||||
Public Function SAVE_ALL(Optional errHinweis = "") As Boolean
|
||||
If Not SAVE(errHinweis) Then Return False
|
||||
If Not SAVE_GOODS() Or Not SAVE_Parties() Or Not SAVE_Traders() Then Return False
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function LOAD(Optional loadALL As Boolean = True) As Boolean
|
||||
Try
|
||||
LOAD = False
|
||||
If loadALL Then
|
||||
parties.Clear()
|
||||
goods.Clear()
|
||||
traders.Clear()
|
||||
End If
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_DeclarationData WHERE Id=@Id ", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", id)
|
||||
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
|
||||
If loadALL Then
|
||||
LOAD_Goods()
|
||||
LOAD_Parties()
|
||||
LOAD_Traders()
|
||||
End If
|
||||
LOAD = 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
|
||||
Return LOAD
|
||||
End Function
|
||||
|
||||
Public Sub LOAD_Parties()
|
||||
Try
|
||||
parties.Clear()
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_PartiesAttribute WHERE declarationdata_id=@id ", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", Me.id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
While dr.Read
|
||||
Dim l As New cOregonNCTs_PartiesAttribute
|
||||
For Each i In l.getParameterList()
|
||||
Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
|
||||
If dr.Item(i.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(l, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(l, dr.Item(i.Text))
|
||||
End If
|
||||
Next
|
||||
parties.Add(l)
|
||||
End While
|
||||
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 Sub LOAD_Traders()
|
||||
Try
|
||||
traders.Clear()
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_TraderAdditionsAttribute WHERE declarationdata_id=@Id ", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", Me.id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
While dr.Read
|
||||
Dim l As New cOregonNCTs_TraderAdditionsAttribute()
|
||||
For Each i In l.getParameterList()
|
||||
Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
|
||||
If dr.Item(i.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(l, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(l, dr.Item(i.Text))
|
||||
End If
|
||||
Next
|
||||
|
||||
traders.Add(l)
|
||||
End While
|
||||
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 Sub LOAD_Goods()
|
||||
Try
|
||||
traders.Clear()
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_GoodsAttribute WHERE declarationdata_id=@Id ", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", Me.id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
While dr.Read
|
||||
Dim l As New cOregonNCTs_GoodsAttribute()
|
||||
For Each i In l.getParameterList()
|
||||
Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
|
||||
If dr.Item(i.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(l, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(l, dr.Item(i.Text))
|
||||
End If
|
||||
Next
|
||||
|
||||
goods.Add(l)
|
||||
End While
|
||||
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
|
||||
Try
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
@@ -233,58 +434,82 @@ Public Class cOregonNCTs_DeclarationData
|
||||
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(" ", "") & ","
|
||||
Public Function SAVE_GOODS() As Boolean
|
||||
|
||||
If DELETE_Goods() Then
|
||||
|
||||
For Each p In goods
|
||||
p.declarationdata_id = id
|
||||
If p.INSERT() Then
|
||||
p.INSERT_WarenpositionPackstuecke(p.id, Me.id)
|
||||
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
values = values.Substring(0, values.Length - 1) 'wg. ','
|
||||
Return (" INSERT INTO tblOregonNCTS_DeclarationData (" & str & ") VALUES(" & values & ") ")
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
End Try
|
||||
Return ""
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
Public Sub LOAD()
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_DeclarationData WHERE Id=@Id ", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", id)
|
||||
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
|
||||
Public Function SAVE_Parties() As Boolean
|
||||
|
||||
If DELETE_parties() Then
|
||||
|
||||
For Each p In parties
|
||||
p.declarationdata_id = id
|
||||
If Not p.INSERT() Then
|
||||
Return False
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function SAVE_Traders() As Boolean
|
||||
|
||||
If DELETE_parties() Then
|
||||
|
||||
For Each p In traders
|
||||
p.declarationdata_id = id
|
||||
If Not p.INSERT() Then
|
||||
Return False
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Function DELETE_Goods() As Boolean
|
||||
Dim sqlstr = " DELETE FROM tblOregonNCTS_Declarations_GoodsAttribute WHERE declarationdata_id=" & Me.id & " "
|
||||
Return SQL.doSQL(sqlstr, "FMZOLL")
|
||||
End Function
|
||||
|
||||
Function DELETE_traders() As Boolean
|
||||
Dim sqlstr = " DELETE FROM [tblOregonNCTS_Declarations_TraderAdditionsAttribute] WHERE declarationdata_id=" & Me.id & " "
|
||||
' MsgBox(sqlstr)
|
||||
Return SQL.doSQL(sqlstr, "FMZOLL")
|
||||
End Function
|
||||
|
||||
Function DELETE_parties() As Boolean
|
||||
Dim sqlstr = " DELETE FROM [tblOregonNCTS_Declarations_PartiesAttribute] WHERE declarationdata_id=" & Me.id & " "
|
||||
Return SQL.doSQL(sqlstr, "FMZOLL")
|
||||
End Function
|
||||
|
||||
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
|
||||
End Class
|
||||
|
||||
|
||||
Public Class cOregonNCTs_GoodsAttribute
|
||||
Public Property id As Integer
|
||||
Public Property line_no As Integer
|
||||
Public Property commodity As String
|
||||
Public Property gtip_code As String
|
||||
Public Property gtip_language As String
|
||||
@@ -319,7 +544,8 @@ Public Class cOregonNCTs_GoodsAttribute
|
||||
Public Property third_quantity_type As String
|
||||
Public Property third_quantity As String
|
||||
Public Property supplementary_unit As String
|
||||
Public Property declarationDataID As Integer
|
||||
Public Property declarationdata_id As Integer
|
||||
Property decl_PAckattributes As New List(Of cOregonNCTs_PacksAttribute)
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
@@ -328,6 +554,7 @@ Public Class cOregonNCTs_GoodsAttribute
|
||||
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("Id", id, , True, True))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("line_no", line_no))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("commodity", commodity))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gtip_code", gtip_code))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gtip_language", gtip_language))
|
||||
@@ -362,7 +589,7 @@ Public Class cOregonNCTs_GoodsAttribute
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("third_quantity_type", third_quantity_type))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("third_quantity", third_quantity))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("supplementary_unit", supplementary_unit))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarationDataID", declarationDataID))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("declarationdata_id", declarationdata_id))
|
||||
|
||||
Return list
|
||||
End Function
|
||||
@@ -371,47 +598,18 @@ Public Class cOregonNCTs_GoodsAttribute
|
||||
|
||||
End Sub
|
||||
|
||||
Sub New(Id)
|
||||
Me.id = Id
|
||||
Sub New(id)
|
||||
Me.id = id
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
'##########################################################################
|
||||
|
||||
|
||||
Public Function SAVE(Optional errHinweis = "") As Boolean
|
||||
Public Function INSERT() As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblOregonNCTS_Declarations_GoodsAttribute WITH(updlock,serializable) WHERE Id=@Id) " &
|
||||
" BEGIN " & getUpdateCmd() & " END " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
" commit tran "
|
||||
|
||||
Dim IdTMP = id
|
||||
IdTMP = SQL.doSQLVarListID(IdTMP, sqlstr, "FMZOLL", , list, , errHinweis)
|
||||
If _id <= 0 Then id = IdTMP
|
||||
Return id > 0
|
||||
End Function
|
||||
|
||||
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 [tblOregonNCTS_Declarations_GoodsAttribute] SET " & str & " WHERE Id=@Id ")
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
declarationdata_id = SQL.doSQLVarListID(declarationdata_id, getInsertCmd, "FMZOLL", , list)
|
||||
Return declarationdata_id > 0
|
||||
End Function
|
||||
|
||||
Public Function getInsertCmd() As String
|
||||
Try
|
||||
@@ -426,19 +624,18 @@ Public Class cOregonNCTs_GoodsAttribute
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
values = values.Substring(0, values.Length - 1) 'wg. ','
|
||||
Return (" INSERT INTO tblOregonNCTS_Declarations_GoodsAttribute (" & str & ") VALUES(" & values & ") ")
|
||||
Return (" INSERT INTO tblOregonNCTS_Declarations_GoodsAttribute (" & str & ") VALUES(" & values & ") ")
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
|
||||
Public Sub LOAD()
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_GoodsAttribute WHERE Id=@Id ", conn)
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_GoodsAttribute WHERE Id=@Id", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
@@ -462,6 +659,59 @@ Public Class cOregonNCTs_GoodsAttribute
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub LOAD_PackAttributes()
|
||||
Try
|
||||
decl_PAckattributes.Clear()
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_PacksAttribute WHERE goods_attribute_Posid=@Id ", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", Me.id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
While dr.Read
|
||||
Dim l As New cOregonNCTs_PacksAttribute()
|
||||
For Each i In l.getParameterList()
|
||||
Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
|
||||
If dr.Item(i.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(l, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(l, dr.Item(i.Text))
|
||||
End If
|
||||
Next
|
||||
decl_PAckattributes.Add(l)
|
||||
End While
|
||||
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 INSERT_WarenpositionPackstuecke(wp_id, id) As Boolean
|
||||
|
||||
For Each p In decl_PAckattributes
|
||||
p.goods_attribute_Posid = wp_id
|
||||
p.goods_attribute_id = id
|
||||
If Not p.INSERT() Then
|
||||
Return False
|
||||
End If
|
||||
Next
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function DELETE_PackAttributes() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
|
||||
Dim sqlstr = " DELETE FROM [tblOregonNCTS_Declarations_PacksAttribute] WHERE goods_attribute_id=" & Me.declarationdata_id & " "
|
||||
Return SQL.doSQL(sqlstr, "FMZOLL")
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
'#######################################################################
|
||||
|
||||
|
||||
|
||||
Shared Sub LOAD_LIST_ByNCTS(ByRef GA_LIST As List(Of cOregonNCTs_GoodsAttribute), tco_nctsId As Integer)
|
||||
If GA_LIST Is Nothing Then GA_LIST = New List(Of cOregonNCTs_GoodsAttribute)
|
||||
GA_LIST.Clear()
|
||||
@@ -477,6 +727,7 @@ Public Class cOregonNCTs_PacksAttribute
|
||||
|
||||
Public Property Id As Integer
|
||||
Public Property goods_attribute_id As Integer
|
||||
Public Property goods_attribute_Posid As Integer
|
||||
Public Property pack_count As Integer
|
||||
Public Property pack_type As String
|
||||
Public Property notes As String
|
||||
@@ -490,6 +741,7 @@ Public Class cOregonNCTs_PacksAttribute
|
||||
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Id", Id, , True, True))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("goods_attribute_id", goods_attribute_id))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("goods_attribute_Posid", goods_attribute_Posid))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pack_count", pack_count))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pack_type", pack_type))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("notes", notes))
|
||||
@@ -506,6 +758,12 @@ Public Class cOregonNCTs_PacksAttribute
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
Public Function INSERT() As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
goods_attribute_Posid = SQL.doSQLVarListID(goods_attribute_Posid, getInsertCmd(), "FMZOLL", , list)
|
||||
Return goods_attribute_Posid > 0
|
||||
End Function
|
||||
|
||||
Public Function SAVE(Optional errHinweis = "") As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
@@ -864,9 +1122,7 @@ End Class
|
||||
Public Class cOregonNCTs_AdditionalCodesAttribute
|
||||
|
||||
Public Property id As Integer
|
||||
|
||||
Public Property goods_attribute_id As Integer
|
||||
|
||||
Public Property code As String
|
||||
Public Property notes As String
|
||||
|
||||
@@ -989,7 +1245,6 @@ Public Class cOregonNCTs_AdditionalCodesAttribute
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Public Class cOregonNCTs_PartiesAttribute
|
||||
|
||||
Public Property id As Integer
|
||||
@@ -1017,11 +1272,18 @@ Public Class cOregonNCTs_PartiesAttribute
|
||||
|
||||
End Sub
|
||||
|
||||
Sub New(Id)
|
||||
Sub New(Id, decId)
|
||||
Me.id = Id
|
||||
Me.declarationdata_id = decId
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
Public Function INSERT() As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
declarationdata_id = SQL.doSQLVarListID(declarationdata_id, getInsertCmd, "FMZOLL", , list)
|
||||
Return declarationdata_id > 0
|
||||
End Function
|
||||
|
||||
Public Function SAVE(Optional errHinweis = "") As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
@@ -1082,8 +1344,9 @@ Public Class cOregonNCTs_PartiesAttribute
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_PartiesAttribute WHERE Id=@Id ", conn)
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_PartiesAttribute WHERE Id=@Id AND declarationdata_id=@decId ", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", id)
|
||||
cmd.Parameters.AddWithValue("@decId", declarationdata_id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
@@ -1106,12 +1369,12 @@ Public Class cOregonNCTs_PartiesAttribute
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Shared Sub LOAD_LIST_ByNCTS(ByRef PA_LIST As List(Of cOregonNCTs_PartiesAttribute), tco_nctsId As Integer)
|
||||
Shared Sub LOAD_LIST_ByNCTS(ByRef PA_LIST As List(Of cOregonNCTs_PartiesAttribute), declarationdata_id As Integer)
|
||||
If PA_LIST Is Nothing Then PA_LIST = New List(Of cOregonNCTs_PartiesAttribute)
|
||||
PA_LIST.Clear()
|
||||
Dim SQL As New SQL
|
||||
For Each r In SQL.loadDgvBySql("SELECT id FROM tblOregonNCTS_Declarations_PartiesAttribute WHERE declarationdata_id=" & tco_nctsId, "FMZOLL").Rows
|
||||
PA_LIST.Add(New VERAG_PROG_ALLGEMEIN.cOregonNCTs_PartiesAttribute(r("id")))
|
||||
For Each r In SQL.loadDgvBySql("SELECT id FROM tblOregonNCTS_Declarations_PartiesAttribute WHERE declarationdata_id=" & declarationdata_id, "FMZOLL").Rows
|
||||
PA_LIST.Add(New VERAG_PROG_ALLGEMEIN.cOregonNCTs_PartiesAttribute(r("id"), declarationdata_id))
|
||||
Next
|
||||
End Sub
|
||||
|
||||
@@ -1120,7 +1383,6 @@ End Class
|
||||
Public Class cOregonNCTs_TraderAdditionsAttribute
|
||||
|
||||
Public Property id As Integer
|
||||
|
||||
Public Property declarationdata_id As Integer
|
||||
Public Property code As String
|
||||
Public Property amount As Integer
|
||||
@@ -1148,11 +1410,19 @@ Public Class cOregonNCTs_TraderAdditionsAttribute
|
||||
|
||||
End Sub
|
||||
|
||||
Sub New(Id)
|
||||
Sub New(Id, decId)
|
||||
Me.id = Id
|
||||
Me.declarationdata_id = decId
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
Public Function INSERT() As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
declarationdata_id = SQL.doSQLVarListID(declarationdata_id, getInsertCmd, "FMZOLL", , list)
|
||||
Return declarationdata_id > 0
|
||||
End Function
|
||||
|
||||
|
||||
Public Function SAVE(Optional errHinweis = "") As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
@@ -1213,8 +1483,9 @@ Public Class cOregonNCTs_TraderAdditionsAttribute
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_TraderAdditionsAttribute WHERE Id=@Id ", conn)
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblOregonNCTS_Declarations_TraderAdditionsAttribute WHERE Id=@Id And declarationdata_id=@decId ", conn)
|
||||
cmd.Parameters.AddWithValue("@Id", id)
|
||||
cmd.Parameters.AddWithValue("@decId", declarationdata_id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
@@ -1237,12 +1508,12 @@ Public Class cOregonNCTs_TraderAdditionsAttribute
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Shared Sub LOAD_LIST_ByNCTS(ByRef TAA_LIST As List(Of cOregonNCTs_TraderAdditionsAttribute), tco_nctsId As Integer)
|
||||
Shared Sub LOAD_LIST_ByNCTS(ByRef TAA_LIST As List(Of cOregonNCTs_TraderAdditionsAttribute), declarationdata_id As Integer)
|
||||
If TAA_LIST Is Nothing Then TAA_LIST = New List(Of cOregonNCTs_TraderAdditionsAttribute)
|
||||
TAA_LIST.Clear()
|
||||
Dim SQL As New SQL
|
||||
For Each r In SQL.loadDgvBySql("SELECT id FROM tblOregonNCTS_Declarations_TraderAdditionsAttribute WHERE declarationdata_id=" & tco_nctsId, "FMZOLL").Rows
|
||||
TAA_LIST.Add(New VERAG_PROG_ALLGEMEIN.cOregonNCTs_TraderAdditionsAttribute(r("id")))
|
||||
For Each r In SQL.loadDgvBySql("SELECT id FROM tblOregonNCTS_Declarations_TraderAdditionsAttribute WHERE declarationdata_id=" & declarationdata_id, "FMZOLL").Rows
|
||||
TAA_LIST.Add(New VERAG_PROG_ALLGEMEIN.cOregonNCTs_TraderAdditionsAttribute(r("id"), declarationdata_id))
|
||||
Next
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user