RPT
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Reflection
|
||||
|
||||
Public Class cAuditFlow
|
||||
|
||||
Private ReadOnly SQL As New SQL
|
||||
|
||||
''' <summary>
|
||||
''' Erzeugt alle fälligen Prüfungen ab dem gegebenen Startdatum.
|
||||
''' Unterstützt sowohl Intervall-basierte als auch einmalige Prüfobjekte.
|
||||
@@ -96,4 +100,37 @@ Public Class cAuditFlow
|
||||
Throw New ArgumentException("Ungültiger Intervalltyp: " & typ)
|
||||
End Select
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Löscht alle offenen (wartPruef_Erledigung = 0) Prüfungen für ein Prüfobjekt.
|
||||
''' Standard: nur fällige (Faelligkeitsdatum <= heute).
|
||||
''' Rückgabewert: Anzahl gelöschter Datensätze; -1 bei Fehler.
|
||||
''' </summary>
|
||||
Shared Function DELETE_ALL_OPEN_FAELLIGE(wartPOId As Integer, Optional onlyFaellige As Boolean = True) As Integer
|
||||
Try
|
||||
Dim sqlStr As String =
|
||||
"DELETE FROM [tblAuditFlow_Pruefungen] " &
|
||||
"WHERE [wartPruef_wartPOId]=@wartPruef_wartPOId " &
|
||||
" AND ISNULL([wartPruef_Erledigung],0)=0"
|
||||
|
||||
If onlyFaellige Then
|
||||
sqlStr &= " AND [wartPruef_Faelligkeitsdatum] <= CAST(GETDATE() AS DATE)"
|
||||
End If
|
||||
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand(sqlStr, conn)
|
||||
cmd.Parameters.AddWithValue("@wartPruef_wartPOId", wartPOId)
|
||||
Dim affected As Integer = cmd.ExecuteNonQuery()
|
||||
Return affected
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, MethodInfo.GetCurrentMethod().Name)
|
||||
Return -1
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user