This commit is contained in:
2024-03-15 13:07:41 +01:00
29 changed files with 1004 additions and 198 deletions

View File

@@ -0,0 +1,122 @@
Imports System.Data.SqlClient
Imports System.Reflection
Public Class cUStVLeistender
Property UStV_Leistender As String
Property UstV_Leistender_PLZ As Object = Nothing
Property UstV_Leistender_Strasse As Object = Nothing
Property UstV_Leistender_Stadt As Object = Nothing
Property UstV_Leistender_StrasseNr As Object = Nothing
Property UstV_Leistender_Land As Object = Nothing
Property UstV_Leistender_UstNr As Object = Nothing
Property UstV_Leistender_Adresse As Boolean
Public hasEntry = False
Dim SQL As New SQL
Sub New(UStV_Leistender)
Me.UStV_Leistender = UStV_Leistender
LOAD()
End Sub
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStV_Leistender", UStV_Leistender,, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_PLZ", UstV_Leistender_PLZ))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_Strasse", UstV_Leistender_Strasse))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_Stadt", UstV_Leistender_Stadt))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_StrasseNr", UstV_Leistender_StrasseNr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_Land", UstV_Leistender_Land))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_UstNr", UstV_Leistender_UstNr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_Adresse", UstV_Leistender_Adresse))
Return list
End Function
Public Function SAVE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblUStVLeistender WHERE UStV_Leistender=@UStV_Leistender) " &
" BEGIN " & getUpdateCmd() & " END " & " commit tran "
'" Else " &
'" BEGIN " & getInsertCmd() & " END " &
'" commit tran "
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
End Function
Public Sub LOAD()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblUStVLeistender WHERE UStV_Leistender=@UStV_Leistender ", conn)
cmd.Parameters.AddWithValue("@UStV_Leistender", UStV_Leistender)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
For Each li In getParameterList()
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
If dr.Item(li.Text) Is DBNull.Value Then
propInfo.SetValue(Me, Nothing)
Else
propInfo.SetValue(Me, dr.Item(li.Text))
End If
Next
hasEntry = True
End If
dr.Close()
End Using
End Using
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
Public Function getUpdateCmd() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim str As String = ""
For Each i In list
If Not i.isPrimaryParam Then
str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
Return (" UPDATE [tblUStVLeistender] SET " & str & " WHERE UStV_Leistender=@UStV_Leistender ")
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return ""
End Function
Public Function getInsertCmd() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim str As String = ""
Dim values As String = ""
For Each i In list
If Not i.isPrimaryParam Then
str &= "[" & i.Text & "],"
values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
values = values.Substring(0, values.Length - 1) 'wg. ','
Return (" INSERT INTO tblUStVLeistender (" & str & ") VALUES(" & values & ") ")
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return ""
End Function
End Class

View File

@@ -5,38 +5,28 @@ Imports System.Reflection
Public Class cAvisoAnhangsarten_LIST
Public LIST As New List(Of cAvisoAnhangsarten)
Dim SQL As New SQL
Sub New()
LOAD_LIST()
Sub New(aktiv As Boolean, firma As String, filiale As String)
LOAD_LIST(aktiv, firma, filiale)
End Sub
Public Sub LOAD_LIST()
Public Sub LOAD_LIST(aktiv As Boolean, Firma As String, Filiale As String)
Try
LIST.Clear()
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
Using cmd As New SqlCommand("SELECT * FROM [tblAvisoAnhangsArten] ", conn)
' cmd.Parameters.AddWithValue("@OffertenNr", OffertenNr)
Dim dr = cmd.ExecuteReader()
While dr.Read
Dim l As New cAvisoAnhangsarten
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
LIST.Add(l)
For Each r In SQL.loadDgvBySql("Select aa_id FROM [tblAvisoAnhangsArten] WHERE aa_aktiv=" & IIf(aktiv, "1", "0") & " And ((aa_firma Is null And aa_filiale Is null) " & IIf(Firma <> "", " Or aa_firma = '" & Firma & "'", "") & IIf(Filiale <> "", " OR aa_filiale = '" & Filiale & "'", "") & ")", "AVISO").Rows
LIST.Add(New VERAG_PROG_ALLGEMEIN.cAvisoAnhangsarten(r("aa_id")))
Next
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
End Class
@@ -49,6 +39,7 @@ Public Class cAvisoAnhangsarten
Property aa_aktiv As Object = Nothing
Property aa_bezeichnung As Object = Nothing
Property aa_firma As Object = Nothing
Property aa_filiale As Object = Nothing
Public hasEntry = False
@@ -72,6 +63,7 @@ Public Class cAvisoAnhangsarten
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("aa_aktiv", aa_aktiv))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("aa_bezeichnung", aa_bezeichnung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("aa_firma", aa_firma))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("aa_filiale", aa_filiale))
Return list
End Function

View File

@@ -14,6 +14,7 @@ Public Class cNCTSGestellungsadressen
Property nga_Ansprechpartner As Object = Nothing
Property nga_bestZollst As Object = Nothing
Property nga_SB As Object = Nothing
Property nga_ATANr As Object = Nothing
Property nga_firma As Object = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
Property nga_Aenderungsdatum As Date = Now
Property nga_gestellungsMail As Object = Nothing
@@ -46,6 +47,7 @@ Public Class cNCTSGestellungsadressen
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("nga_EORI", nga_EORI))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("nga_EORI_NL", nga_EORI_NL))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("nga_ATANr", nga_ATANr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("nga_Ansprechpartner", nga_Ansprechpartner))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("nga_bestZollst", nga_bestZollst))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("nga_SB", nga_SB))

View File

@@ -809,6 +809,14 @@ Public Class cSendungen
Return adresse.Trim
End Function
Public Function getNCTSATANr(Optional htmlOptimized As Boolean = False) As String
Dim ataNr = ""
ataNr &= If(Me.tblSnd_ATANr, "") & vbNewLine
If htmlOptimized Then ataNr = ataNr.Trim.Replace(vbNewLine, "<br/>")
Return ataNr.Trim
End Function
Public Function getEmpfaengerAdress(Optional htmlOptimized As Boolean = False, Optional ansprechpartner As Boolean = False) As String
If tblSnd_EmpfaengerKdNr > 0 Then