feature_gesamtsicherheiten
This commit is contained in:
@@ -21,22 +21,28 @@ Public Class cSicherheiten
|
||||
Property gs_LKWKZ As String
|
||||
Property gs_atr As String = ""
|
||||
Property gs_warenort As String
|
||||
Property gs_warenwertFix As Object
|
||||
Property gs_sicherheitsbetragFix As Object
|
||||
Property gs_zollsatz As Object
|
||||
Property gs_avisoId As Integer
|
||||
|
||||
Public hasEntry = False
|
||||
|
||||
Dim SQL As New SQL
|
||||
|
||||
Sub New(gs_gsID)
|
||||
Sub New(gs_gsID, gs_posNr)
|
||||
Me.gs_gsId = gs_gsID
|
||||
Me.gs_posNr = gs_posNr
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
Sub New(gs_gsNr)
|
||||
Me.gs_gsNr = gs_gsNr
|
||||
LOADGSNR()
|
||||
End Sub
|
||||
|
||||
Sub New()
|
||||
|
||||
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("gs_gsId", gs_gsId,, True))
|
||||
@@ -57,9 +63,8 @@ Public Class cSicherheiten
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_LKWKZ", gs_LKWKZ))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_atr", gs_atr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_warenort", gs_warenort))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_warenwertFix", gs_warenwertFix))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_sicherheitsbetragFix", gs_sicherheitsbetragFix))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_zollsatz", gs_zollsatz))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_avisoId", gs_avisoId))
|
||||
|
||||
Return list
|
||||
End Function
|
||||
@@ -69,7 +74,7 @@ Public Class cSicherheiten
|
||||
Public Function SAVE() As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId) " &
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId AND gs_posNr=@gs_posNr) " &
|
||||
" BEGIN " & getUpdateCmd() & " END " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
@@ -81,7 +86,7 @@ Public Class cSicherheiten
|
||||
Public Function SAVEOBJECT() As Integer
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId) " &
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId AND gs_posNr=@gs_posNr) " &
|
||||
" BEGIN " & getUpdateCmd() & " END " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
@@ -97,8 +102,39 @@ Public Class cSicherheiten
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||
Using cmd As New SqlCommand("SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId ", conn)
|
||||
Using cmd As New SqlCommand("SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId AND gs_posNr=@gs_posNr ", conn)
|
||||
cmd.Parameters.AddWithValue("@gs_gsID", gs_gsId)
|
||||
cmd.Parameters.AddWithValue("@gs_posNr", gs_posNr)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||
|
||||
If dr.Item(li.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(Me, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||
End If
|
||||
|
||||
Next
|
||||
hasEntry = True
|
||||
End If
|
||||
dr.Close()
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub LOADGSNR()
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||
Using cmd As New SqlCommand("SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsNr=@gs_gsNr ", conn)
|
||||
cmd.Parameters.AddWithValue("@gs_gsNr", gs_gsNr)
|
||||
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
@@ -134,7 +170,7 @@ Public Class cSicherheiten
|
||||
End If
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
Return (" UPDATE [tblGesamtsicherheit] SET " & str & " WHERE gs_gsId=@gs_gsId ")
|
||||
Return (" UPDATE [tblGesamtsicherheit] SET " & str & " WHERE gs_gsId=@gs_gsId AND gs_posNr=@gs_posNr ")
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
@@ -165,7 +201,7 @@ Public Class cSicherheiten
|
||||
|
||||
|
||||
Public Function Delete()
|
||||
SQL.doSQL("delete from [tblGesamtsicherheit] where gs_gsId = '" & Me.gs_gsId & "'", "AVISO")
|
||||
SQL.doSQL("delete from [tblGesamtsicherheit] where gs_gsId = '" & Me.gs_gsId & "' AND gs_posNr='" & Me.gs_posNr & "'", "AVISO")
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user