div. Änderungen
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Reflection
|
||||
Imports Spire.Pdf
|
||||
|
||||
Public Class cGesamtsicherheitsReferenz
|
||||
|
||||
@@ -14,6 +13,7 @@ Public Class cGesamtsicherheitsReferenz
|
||||
Property gsr_Saldo As Object = Nothing
|
||||
Property gsr_ATR As Boolean = False
|
||||
Property gsr_standort As Object = Nothing
|
||||
Property gsr_firma As Object = Nothing
|
||||
|
||||
Public hasEntry = False
|
||||
|
||||
@@ -23,11 +23,23 @@ Public Class cGesamtsicherheitsReferenz
|
||||
|
||||
End Sub
|
||||
|
||||
Sub New(_gsr_standort)
|
||||
|
||||
Sub New(gsr_id As Integer)
|
||||
gsr_id = gsr_id
|
||||
LOADID()
|
||||
End Sub
|
||||
|
||||
Sub New(_gsr_standort As String)
|
||||
gsr_standort = _gsr_standort
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
Sub New(_gsr_standort As String, _gsr_firma As String)
|
||||
gsr_standort = _gsr_standort
|
||||
gsr_firma = _gsr_firma
|
||||
LOAD(_gsr_firma)
|
||||
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("gsr_standort", gsr_standort,, True))
|
||||
@@ -56,7 +68,7 @@ Public Class cGesamtsicherheitsReferenz
|
||||
Return SQL.doSQLVarList(sqlstr, "AVISO", , list)
|
||||
End Function
|
||||
|
||||
Public Sub LOAD()
|
||||
Public Sub LOAD(Optional Firma As String = "")
|
||||
|
||||
|
||||
Try
|
||||
@@ -64,8 +76,41 @@ Public Class cGesamtsicherheitsReferenz
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||
|
||||
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblGesamtsicherheitReferenz WHERE gsr_Standort=@gsr_standort ", conn)
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblGesamtsicherheitReferenz WHERE gsr_Standort=@gsr_standort " & IIf(Firma <> "", "AND gsr_firma=@gsr_firma", ""), conn)
|
||||
cmd.Parameters.AddWithValue("@gsr_standort", gsr_standort)
|
||||
If Firma <> "" Then cmd.Parameters.AddWithValue("@gsr_firma", gsr_firma)
|
||||
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 LOADID(Optional Firma As String = "")
|
||||
|
||||
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblGesamtsicherheitReferenz WHERE gsr_id=@gsr_id ", conn)
|
||||
cmd.Parameters.AddWithValue("@gsr_id", gsr_id)
|
||||
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
|
||||
Reference in New Issue
Block a user