TvSettingsNew
This commit is contained in:
@@ -3364,7 +3364,6 @@
|
|||||||
<EmbeddedResource Include="mdm\usrCntlMDMDatenverarbeitungAuswertungen_divers.resx">
|
<EmbeddedResource Include="mdm\usrCntlMDMDatenverarbeitungAuswertungen_divers.resx">
|
||||||
<DependentUpon>usrCntlMDMDatenverarbeitungAuswertungen_divers.vb</DependentUpon>
|
<DependentUpon>usrCntlMDMDatenverarbeitungAuswertungen_divers.vb</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="My Project\licenses.licx" />
|
|
||||||
<EmbeddedResource Include="OriginalArchiv_ATR\frmATR.resx">
|
<EmbeddedResource Include="OriginalArchiv_ATR\frmATR.resx">
|
||||||
<DependentUpon>frmATR.vb</DependentUpon>
|
<DependentUpon>frmATR.vb</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
@@ -196,6 +196,12 @@ Public Class cDatenbankAVISO
|
|||||||
Return Nothing
|
Return Nothing
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function CreateNewOpenConnection() As SqlConnection
|
||||||
|
Dim conn As New SqlConnection(cSqlDb.GetAVISOConnectionString())
|
||||||
|
conn.Open()
|
||||||
|
Return conn
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Shared Function GetNewOpenConnectionWithoutError(Optional newConn As Boolean = False) As SqlConnection
|
Public Shared Function GetNewOpenConnectionWithoutError(Optional newConn As Boolean = False) As SqlConnection
|
||||||
Try
|
Try
|
||||||
@@ -2473,52 +2479,166 @@ Public Class cTvTextBezeichnung
|
|||||||
Public Property TvTextBezeichnung As String
|
Public Property TvTextBezeichnung As String
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
Public Class cTvSettings
|
||||||
|
Public Property TVSettingID As Integer
|
||||||
|
Public Property StandortID As Integer
|
||||||
|
Public Property KachelWidthInPercent As Double?
|
||||||
|
Public Property KachelHeightInPercent As Double?
|
||||||
|
Public Property KachelFontSizeLkwNummer As Double?
|
||||||
|
Public Property KachelFontSizeDateTime As Double?
|
||||||
|
Public Property KachelRowGapInPercent As Double?
|
||||||
|
Public Property SeitenwechselInSek As Integer?
|
||||||
|
Public Property TextBalkenHeightInPercent As Double?
|
||||||
|
Public Property SelectedLogoValue As String
|
||||||
|
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
|
||||||
Public Class cAvisoTvNewDAL
|
Public Class cAvisoTvNewDAL
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Holt die StandortID basierend auf dem Standortnamen.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="standort">Der Name des Standorts.</param>
|
||||||
|
''' <returns>Die zugehörige StandortID oder 0, wenn nicht gefunden.</returns>
|
||||||
Public Function GetStandortID(standort As String) As Integer
|
Public Function GetStandortID(standort As String) As Integer
|
||||||
Dim standortID As Integer = 0
|
Dim standortID As Integer = 0
|
||||||
Dim sql As String = "SELECT StandortID FROM StandorteTV WHERE Standort = @Standort"
|
Dim sql As String = "SELECT StandortID FROM StandorteTV WHERE StandortBezeichnung = @StandortBezeichnung"
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim conn As SqlConnection = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
If conn Is Nothing Then
|
|
||||||
Throw New Exception("Die Datenbankverbindung konnte nicht hergestellt werden.")
|
|
||||||
End If
|
|
||||||
|
|
||||||
Using cmd As New SqlCommand(sql, conn)
|
Using cmd As New SqlCommand(sql, conn)
|
||||||
cmd.Parameters.AddWithValue("@Standort", standort)
|
cmd.Parameters.AddWithValue("@StandortBezeichnung", standort)
|
||||||
Dim result As Object = cmd.ExecuteScalar()
|
Dim result As Object = cmd.ExecuteScalar()
|
||||||
If result IsNot Nothing AndAlso Not IsDBNull(result) Then
|
If result IsNot Nothing AndAlso Not IsDBNull(result) Then
|
||||||
standortID = Convert.ToInt32(result)
|
standortID = Convert.ToInt32(result)
|
||||||
End If
|
End If
|
||||||
End Using
|
End Using
|
||||||
|
End Using
|
||||||
Catch ex As SqlException
|
Catch ex As SqlException
|
||||||
' Ausnahme weiterwerfen mit spezifischer Fehlermeldung
|
Throw New Exception("SQL Fehler beim Abrufen der StandortID: " & ex.Message, ex)
|
||||||
Throw New Exception("SQL Fehler beim Abrufen der StandortID: " & ex.Message)
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' Allgemeine Ausnahme weiterwerfen
|
Throw New Exception("Allgemeiner Fehler beim Abrufen der StandortID: " & ex.Message, ex)
|
||||||
Throw New Exception("Allgemeiner Fehler beim Abrufen der StandortID: " & ex.Message)
|
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return standortID
|
Return standortID
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function LadenAlleTvTextBezeichnungen() As List(Of cTvTextBezeichnung)
|
''' <summary>
|
||||||
Dim bezeichnungen As New List(Of cTvTextBezeichnung)()
|
''' Speichert die TV-Einstellungen in der Datenbank.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="settings">Die TV-Einstellungen, die gespeichert werden sollen.</param>
|
||||||
|
Public Sub SaveTvSettings(settings As cTvSettings)
|
||||||
|
Dim sqlCheck As String = "SELECT COUNT(*) FROM AvisoTvSettings WHERE StandortID = @StandortID"
|
||||||
|
Dim sqlUpdate As String = "UPDATE AvisoTvSettings SET
|
||||||
|
KachelWidthInPercent = @KachelWidthInPercent,
|
||||||
|
KachelHeightInPercent = @KachelHeightInPercent,
|
||||||
|
KachelFontSizeLkwNummer = @KachelFontSizeLkwNummer,
|
||||||
|
KachelFontSizeDateTime = @KachelFontSizeDateTime,
|
||||||
|
KachelRowGapInPercent = @KachelRowGapInPercent,
|
||||||
|
SeitenwechselInSek = @SeitenwechselInSek,
|
||||||
|
TextBalkenHeightInPercent = @TextBalkenHeightInPercent,
|
||||||
|
Logo = @Logo
|
||||||
|
WHERE StandortID = @StandortID"
|
||||||
|
Dim sqlInsert As String = "INSERT INTO AvisoTvSettings
|
||||||
|
(StandortID, KachelWidthInPercent, KachelHeightInPercent,KachelRowGapInPercent,
|
||||||
|
KachelFontSizeLkwNummer, KachelFontSizeDateTime,
|
||||||
|
SeitenwechselInSek, TextBalkenHeightInPercent,Logo)
|
||||||
|
VALUES
|
||||||
|
(@StandortID, @KachelWidthInPercent, @KachelHeightInPercent,@KachelRowGapInPercent,
|
||||||
|
@KachelFontSizeLkwNummer, @KachelFontSizeDateTime,
|
||||||
|
@SeitenwechselInSek, @TextBalkenHeightInPercent,@Logo)"
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim conn As SqlConnection = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
If conn Is Nothing Then
|
' Überprüfen, ob bereits Einstellungen für den Standort existieren
|
||||||
Throw New Exception("Die Datenbankverbindung konnte nicht hergestellt werden.")
|
Dim recordExists As Boolean
|
||||||
End If
|
Using cmdCheck As New SqlCommand(sqlCheck, conn)
|
||||||
|
cmdCheck.Parameters.AddWithValue("@StandortID", settings.StandortID)
|
||||||
|
recordExists = Convert.ToInt32(cmdCheck.ExecuteScalar()) > 0
|
||||||
|
End Using
|
||||||
|
|
||||||
|
' Wähle Update oder Insert basierend auf der Existenz
|
||||||
|
Dim sql As String = If(recordExists, sqlUpdate, sqlInsert)
|
||||||
|
|
||||||
|
Using cmdSave As New SqlCommand(sql, conn)
|
||||||
|
cmdSave.Parameters.AddWithValue("@StandortID", settings.StandortID)
|
||||||
|
cmdSave.Parameters.AddWithValue("@KachelWidthInPercent", settings.KachelWidthInPercent)
|
||||||
|
cmdSave.Parameters.AddWithValue("@KachelHeightInPercent", settings.KachelHeightInPercent)
|
||||||
|
cmdSave.Parameters.AddWithValue("@KachelRowGapInPercent", settings.KachelRowGapInPercent)
|
||||||
|
cmdSave.Parameters.AddWithValue("@KachelFontSizeLkwNummer", settings.KachelFontSizeLkwNummer)
|
||||||
|
cmdSave.Parameters.AddWithValue("@KachelFontSizeDateTime", settings.KachelFontSizeDateTime)
|
||||||
|
cmdSave.Parameters.AddWithValue("@SeitenwechselInSek", settings.SeitenwechselInSek)
|
||||||
|
cmdSave.Parameters.AddWithValue("@TextBalkenHeightInPercent", settings.TextBalkenHeightInPercent)
|
||||||
|
cmdSave.Parameters.AddWithValue("@Logo", settings.SelectedLogoValue)
|
||||||
|
cmdSave.ExecuteNonQuery()
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
Catch ex As SqlException
|
||||||
|
Throw New Exception("SQL Fehler beim Speichern der TV-Einstellungen: " & ex.Message, ex)
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw New Exception("Allgemeiner Fehler beim Speichern der TV-Einstellungen: " & ex.Message, ex)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Lädt die TV-Einstellungen basierend auf der StandortID.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="standortID">Die StandortID, für die die Einstellungen geladen werden sollen.</param>
|
||||||
|
''' <returns>Eine Liste der entsprechenden TV-Einstellungen.</returns>
|
||||||
|
Public Function GetTvSettingsByStandort(standortID As Integer) As List(Of cTvSettings)
|
||||||
|
Dim SettingsList As New List(Of cTvSettings)()
|
||||||
|
Dim sql As String = "SELECT * FROM AvisoTvSettings WHERE StandortID = @StandortID"
|
||||||
|
|
||||||
|
Try
|
||||||
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
|
Using cmd As New SqlCommand(sql, conn)
|
||||||
|
cmd.Parameters.AddWithValue("@StandortID", standortID)
|
||||||
|
|
||||||
|
Using dr As SqlDataReader = cmd.ExecuteReader()
|
||||||
|
While dr.Read()
|
||||||
|
Dim settings As New cTvSettings() With {
|
||||||
|
.TVSettingID = Convert.ToInt32(dr("TvSettingID")),
|
||||||
|
.StandortID = Convert.ToInt32(dr("StandortID")),
|
||||||
|
.KachelWidthInPercent = If(IsDBNull(dr("KachelWidthInPercent")), 0, Convert.ToDouble(dr("KachelWidthInPercent"))),
|
||||||
|
.KachelHeightInPercent = If(IsDBNull(dr("KachelHeightInPercent")), 0, Convert.ToDouble(dr("KachelHeightInPercent"))),
|
||||||
|
.KachelRowGapInPercent = If(IsDBNull(dr("KachelRowGapInPercent")), 0, Convert.ToDouble(dr("KachelRowGapInPercent"))),
|
||||||
|
.KachelFontSizeLkwNummer = If(IsDBNull(dr("KachelFontSizeLkwNummer")), 0, Convert.ToDouble(dr("KachelFontSizeLkwNummer"))),
|
||||||
|
.KachelFontSizeDateTime = If(IsDBNull(dr("KachelFontSizeDateTime")), 0, Convert.ToDouble(dr("KachelFontSizeDateTime"))),
|
||||||
|
.SeitenwechselInSek = If(IsDBNull(dr("SeitenwechselInSek")), 0, Convert.ToInt32(dr("SeitenwechselInSek"))),
|
||||||
|
.TextBalkenHeightInPercent = If(IsDBNull(dr("TextBalkenHeightInPercent")), 0, Convert.ToDouble(dr("TextBalkenHeightInPercent"))),
|
||||||
|
.SelectedLogoValue = If(IsDBNull(dr("Logo")), "", Convert.ToString(dr("Logo")))
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsList.Add(settings)
|
||||||
|
End While
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
Catch ex As SqlException
|
||||||
|
Throw New Exception("SQL Fehler beim Laden der TV-Einstellungen: " & ex.Message, ex)
|
||||||
|
Catch ex As Exception
|
||||||
|
Throw New Exception("Allgemeiner Fehler beim Laden der TV-Einstellungen: " & ex.Message, ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return SettingsList
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Lädt alle TV-Textbezeichnungen aus der Datenbank.
|
||||||
|
''' </summary>
|
||||||
|
''' <returns>Eine Liste aller TV-Textbezeichnungen.</returns>
|
||||||
|
Public Function LadenAlleTvTextBezeichnungen() As List(Of cTvTextBezeichnung)
|
||||||
|
Dim bezeichnungen As New List(Of cTvTextBezeichnung)()
|
||||||
Dim sql As String = "
|
Dim sql As String = "
|
||||||
SELECT TvTextBezeichnungID, TvTextBezeichnung
|
SELECT TvTextBezeichnungID, TvTextBezeichnung
|
||||||
FROM AvisoTvNew
|
FROM AvisoTvNew
|
||||||
ORDER BY TvTextBezeichnung
|
ORDER BY TvTextBezeichnung
|
||||||
"
|
"
|
||||||
|
|
||||||
|
Try
|
||||||
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
Using cmd As New SqlCommand(sql, conn)
|
Using cmd As New SqlCommand(sql, conn)
|
||||||
Using dr As SqlDataReader = cmd.ExecuteReader()
|
Using dr As SqlDataReader = cmd.ExecuteReader()
|
||||||
While dr.Read()
|
While dr.Read()
|
||||||
@@ -2530,32 +2650,27 @@ Public Class cAvisoTvNewDAL
|
|||||||
End While
|
End While
|
||||||
End Using
|
End Using
|
||||||
End Using
|
End Using
|
||||||
|
End Using
|
||||||
Catch ex As SqlException
|
Catch ex As SqlException
|
||||||
Throw New Exception("SQL Fehler beim Laden der TvTextBezeichnungen: " & ex.Message)
|
Throw New Exception("SQL Fehler beim Laden der TvTextBezeichnungen: " & ex.Message, ex)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Throw New Exception("Allgemeiner Fehler beim Laden der TvTextBezeichnungen: " & ex.Message)
|
Throw New Exception("Allgemeiner Fehler beim Laden der TvTextBezeichnungen: " & ex.Message, ex)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return bezeichnungen
|
Return bezeichnungen
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Überprüft, ob eine TV-Textbezeichnung bereits vorhanden ist.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="tvTextBezeichnung">Die TV-Textbezeichnung, die überprüft werden soll.</param>
|
||||||
' Methode zum Überprüfen, ob eine TvTextBezeichnung bereits für einen Standort existiert
|
''' <returns>True, wenn die Bezeichnung vorhanden ist; andernfalls False.</returns>
|
||||||
Public Function IstTvTextBezeichnungVorhanden(tvTextBezeichnung As String) As Boolean
|
Public Function IstTvTextBezeichnungVorhanden(tvTextBezeichnung As String) As Boolean
|
||||||
Dim vorhanden As Boolean = False
|
Dim vorhanden As Boolean = False
|
||||||
Dim sql As String = "SELECT COUNT(*)
|
Dim sql As String = "SELECT COUNT(*) FROM AvisoTvNew WHERE TvTextBezeichnung = @TvTextBezeichnung"
|
||||||
FROM AvisoTvNew
|
|
||||||
WHERE TvTextBezeichnung = @TvTextBezeichnung"
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim conn As SqlConnection = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
If conn Is Nothing Then
|
|
||||||
Throw New Exception("Die Datenbankverbindung konnte nicht hergestellt werden.")
|
|
||||||
End If
|
|
||||||
|
|
||||||
Using cmd As New SqlCommand(sql, conn)
|
Using cmd As New SqlCommand(sql, conn)
|
||||||
cmd.Parameters.AddWithValue("@TvTextBezeichnung", tvTextBezeichnung)
|
cmd.Parameters.AddWithValue("@TvTextBezeichnung", tvTextBezeichnung)
|
||||||
Dim count As Integer = Convert.ToInt32(cmd.ExecuteScalar())
|
Dim count As Integer = Convert.ToInt32(cmd.ExecuteScalar())
|
||||||
@@ -2563,20 +2678,24 @@ Public Class cAvisoTvNewDAL
|
|||||||
vorhanden = True
|
vorhanden = True
|
||||||
End If
|
End If
|
||||||
End Using
|
End Using
|
||||||
|
End Using
|
||||||
Catch ex As SqlException
|
Catch ex As SqlException
|
||||||
' Ausnahme weiterwerfen mit spezifischer Fehlermeldung
|
Throw New Exception("SQL Fehler beim Überprüfen der TvTextBezeichnung: " & ex.Message, ex)
|
||||||
Throw New Exception("SQL Fehler beim Überprüfen der TvTextBezeichnung: " & ex.Message)
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' Allgemeine Ausnahme weiterwerfen
|
Throw New Exception("Allgemeiner Fehler beim Überprüfen der TvTextBezeichnung: " & ex.Message, ex)
|
||||||
Throw New Exception("Allgemeiner Fehler beim Überprüfen der TvTextBezeichnung: " & ex.Message)
|
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return vorhanden
|
Return vorhanden
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
' Methode zum Lesen von AvisoTvNew-Einträgen
|
''' <summary>
|
||||||
|
''' Liest AvisoTvNew-Einträge basierend auf den angegebenen Kriterien.
|
||||||
Public Sub LesenAvisoTvNew(tvid As Integer, bezeichnung As String, standort As String, ByRef liste As List(Of cAvisoTvNew))
|
''' </summary>
|
||||||
|
''' <param name="tvid">Die TV-TextbezeichnungID.</param>
|
||||||
|
''' <param name="bezeichnung">Die Bezeichnung.</param>
|
||||||
|
''' <param name="standort">Der Standort.</param>
|
||||||
|
''' <param name="liste">Die Liste, in die die Ergebnisse eingefügt werden.</param>
|
||||||
|
Public Sub LesenAvisoTvNew(tvid As Integer, bezeichnung As String, StandortBezeichnung As String, ByRef liste As List(Of cAvisoTvNew))
|
||||||
Dim sql As String = "SELECT
|
Dim sql As String = "SELECT
|
||||||
stv.TvTextBezeichnungID,
|
stv.TvTextBezeichnungID,
|
||||||
stv.StandortID,
|
stv.StandortID,
|
||||||
@@ -2613,17 +2732,13 @@ Public Class cAvisoTvNewDAL
|
|||||||
sql &= " AND a.TVTextBezeichnung LIKE @TVTextBezeichnung"
|
sql &= " AND a.TVTextBezeichnung LIKE @TVTextBezeichnung"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not String.IsNullOrWhiteSpace(standort) Then
|
If Not String.IsNullOrWhiteSpace(StandortBezeichnung) Then
|
||||||
sql &= " AND s.Standort = @Standort"
|
sql &= " AND s.Standortbezeichnung = @StandortBezeichnung"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim conn As SqlConnection = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
If conn Is Nothing Then
|
Using cmd As New SqlCommand(sql, conn)
|
||||||
Throw New Exception("Die Datenbankverbindung konnte nicht hergestellt werden.")
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim cmd As New SqlCommand(sql, conn)
|
|
||||||
If tvid <> 0 Then
|
If tvid <> 0 Then
|
||||||
cmd.Parameters.AddWithValue("@TvTextBezeichnungID", tvid)
|
cmd.Parameters.AddWithValue("@TvTextBezeichnungID", tvid)
|
||||||
End If
|
End If
|
||||||
@@ -2632,11 +2747,11 @@ Public Class cAvisoTvNewDAL
|
|||||||
cmd.Parameters.AddWithValue("@TVTextBezeichnung", "%" & bezeichnung & "%")
|
cmd.Parameters.AddWithValue("@TVTextBezeichnung", "%" & bezeichnung & "%")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not String.IsNullOrWhiteSpace(standort) Then
|
If Not String.IsNullOrWhiteSpace(StandortBezeichnung) Then
|
||||||
cmd.Parameters.AddWithValue("@Standort", standort)
|
cmd.Parameters.AddWithValue("@StandortBezeichnung", StandortBezeichnung)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
Using dr As SqlDataReader = cmd.ExecuteReader()
|
||||||
While dr.Read()
|
While dr.Read()
|
||||||
Dim aviso As New cAvisoTvNew() With {
|
Dim aviso As New cAvisoTvNew() With {
|
||||||
.TvTextBezeichnungID = Convert.ToInt32(dr("TvTextBezeichnungID")),
|
.TvTextBezeichnungID = Convert.ToInt32(dr("TvTextBezeichnungID")),
|
||||||
@@ -2664,18 +2779,20 @@ Public Class cAvisoTvNewDAL
|
|||||||
}
|
}
|
||||||
liste.Add(aviso)
|
liste.Add(aviso)
|
||||||
End While
|
End While
|
||||||
dr.Close()
|
End Using
|
||||||
cmd.Dispose()
|
End Using
|
||||||
conn.Close()
|
End Using
|
||||||
Catch ex As SqlException
|
Catch ex As SqlException
|
||||||
' Ausnahme weiterwerfen mit spezifischer Fehlermeldung
|
Throw New Exception("SQL Fehler beim Lesen der Daten: " & ex.Message, ex)
|
||||||
Throw New Exception("SQL Fehler beim Lesen der Daten: " & ex.Message)
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' Allgemeine Ausnahme weiterwerfen
|
Throw New Exception("Allgemeiner Fehler beim Lesen der Daten: " & ex.Message, ex)
|
||||||
Throw New Exception("Allgemeiner Fehler beim Lesen der Daten: " & ex.Message)
|
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Liest alle AvisoTvNew-Einträge aus der Datenbank.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="liste">Die Liste, in die die Ergebnisse eingefügt werden.</param>
|
||||||
Public Sub LesenAlleAvisoTvNew(ByRef liste As List(Of cAvisoTvNew))
|
Public Sub LesenAlleAvisoTvNew(ByRef liste As List(Of cAvisoTvNew))
|
||||||
' Basis-SQL-Abfrage ohne Filter
|
' Basis-SQL-Abfrage ohne Filter
|
||||||
Dim sql As String = "SELECT
|
Dim sql As String = "SELECT
|
||||||
@@ -2700,22 +2817,12 @@ Public Class cAvisoTvNewDAL
|
|||||||
a.IsActive
|
a.IsActive
|
||||||
FROM AvisoTvNew a"
|
FROM AvisoTvNew a"
|
||||||
|
|
||||||
Dim conn As SqlConnection = Nothing
|
|
||||||
Dim cmd As SqlCommand = Nothing
|
|
||||||
Dim dr As SqlDataReader = Nothing
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
conn = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
If conn Is Nothing Then
|
Using cmd As New SqlCommand(sql, conn)
|
||||||
Throw New Exception("Die Datenbankverbindung konnte nicht hergestellt werden.")
|
|
||||||
End If
|
|
||||||
|
|
||||||
cmd = New SqlCommand(sql, conn)
|
|
||||||
|
|
||||||
' Keine Parameter erforderlich, da keine Filter
|
' Keine Parameter erforderlich, da keine Filter
|
||||||
|
|
||||||
' Daten lesen und Objekte erstellen
|
Using dr As SqlDataReader = cmd.ExecuteReader()
|
||||||
dr = cmd.ExecuteReader()
|
|
||||||
While dr.Read()
|
While dr.Read()
|
||||||
Dim aviso As New cAvisoTvNew() With {
|
Dim aviso As New cAvisoTvNew() With {
|
||||||
.TvTextBezeichnungID = If(IsDBNull(dr("TvTextBezeichnungID")), 0, Convert.ToInt32(dr("TvTextBezeichnungID"))),
|
.TvTextBezeichnungID = If(IsDBNull(dr("TvTextBezeichnungID")), 0, Convert.ToInt32(dr("TvTextBezeichnungID"))),
|
||||||
@@ -2728,55 +2835,44 @@ Public Class cAvisoTvNewDAL
|
|||||||
.EndDate = If(IsDBNull(dr("EndDate")), CType(Nothing, Date?), Convert.ToDateTime(dr("EndDate"))),
|
.EndDate = If(IsDBNull(dr("EndDate")), CType(Nothing, Date?), Convert.ToDateTime(dr("EndDate"))),
|
||||||
.StartTime = If(IsDBNull(dr("StartTime")), CType(Nothing, TimeSpan?), Convert.ToDateTime(dr("StartTime")).TimeOfDay),
|
.StartTime = If(IsDBNull(dr("StartTime")), CType(Nothing, TimeSpan?), Convert.ToDateTime(dr("StartTime")).TimeOfDay),
|
||||||
.EndTime = If(IsDBNull(dr("EndTime")), CType(Nothing, TimeSpan?), Convert.ToDateTime(dr("EndTime")).TimeOfDay),
|
.EndTime = If(IsDBNull(dr("EndTime")), CType(Nothing, TimeSpan?), Convert.ToDateTime(dr("EndTime")).TimeOfDay),
|
||||||
.IsRecurring = If(IsDBNull(dr("IsRecurring")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsRecurring"))),
|
.IsRecurring = If(IsDBNull(dr("IsRecurring")), False, Convert.ToBoolean(dr("IsRecurring"))),
|
||||||
.IsMonday = If(IsDBNull(dr("IsMonday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsMonday"))),
|
.IsMonday = If(IsDBNull(dr("IsMonday")), False, Convert.ToBoolean(dr("IsMonday"))),
|
||||||
.IsTuesday = If(IsDBNull(dr("IsTuesday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsTuesday"))),
|
.IsTuesday = If(IsDBNull(dr("IsTuesday")), False, Convert.ToBoolean(dr("IsTuesday"))),
|
||||||
.IsWednesday = If(IsDBNull(dr("IsWednesday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsWednesday"))),
|
.IsWednesday = If(IsDBNull(dr("IsWednesday")), False, Convert.ToBoolean(dr("IsWednesday"))),
|
||||||
.IsThursday = If(IsDBNull(dr("IsThursday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsThursday"))),
|
.IsThursday = If(IsDBNull(dr("IsThursday")), False, Convert.ToBoolean(dr("IsThursday"))),
|
||||||
.IsFriday = If(IsDBNull(dr("IsFriday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsFriday"))),
|
.IsFriday = If(IsDBNull(dr("IsFriday")), False, Convert.ToBoolean(dr("IsFriday"))),
|
||||||
.IsSaturday = If(IsDBNull(dr("IsSaturday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsSaturday"))),
|
.IsSaturday = If(IsDBNull(dr("IsSaturday")), False, Convert.ToBoolean(dr("IsSaturday"))),
|
||||||
.IsSunday = If(IsDBNull(dr("IsSunday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsSunday"))),
|
.IsSunday = If(IsDBNull(dr("IsSunday")), False, Convert.ToBoolean(dr("IsSunday"))),
|
||||||
.IsActive = If(IsDBNull(dr("IsActive")), False, Convert.ToBoolean(dr("IsActive")))
|
.IsActive = If(IsDBNull(dr("IsActive")), False, Convert.ToBoolean(dr("IsActive")))
|
||||||
}
|
}
|
||||||
|
|
||||||
liste.Add(aviso)
|
liste.Add(aviso)
|
||||||
End While
|
End While
|
||||||
dr.Close()
|
End Using
|
||||||
cmd.Dispose()
|
End Using
|
||||||
conn.Close()
|
End Using
|
||||||
Catch ex As SqlException
|
Catch ex As SqlException
|
||||||
' Ausnahme weiterwerfen mit spezifischer Fehlermeldung
|
Throw New Exception($"SQL Fehler beim Lesen der Daten: {ex.Message}", ex)
|
||||||
Throw New Exception($"SQL Fehler beim Lesen der Daten: {ex.Message}")
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' Allgemeine Ausnahme weiterwerfen
|
Throw New Exception($"Allgemeiner Fehler beim Lesen der Daten: {ex.Message}", ex)
|
||||||
Throw New Exception($"Allgemeiner Fehler beim Lesen der Daten: {ex.Message}")
|
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Speichert einen AvisoTvNew-Eintrag in der Datenbank.
|
||||||
|
''' </summary>
|
||||||
' Methode zum Speichern von AvisoTvNew-Einträgen
|
''' <param name="aviso">Der AvisoTvNew-Eintrag, der gespeichert werden soll.</param>
|
||||||
Public Sub SpeichernAvisoTvNew(aviso As cAvisoTvNew)
|
Public Sub SpeichernAvisoTvNew(aviso As cAvisoTvNew)
|
||||||
Dim conn As SqlConnection = Nothing
|
Dim sqlInsert As String
|
||||||
Dim cmd As SqlCommand = Nothing
|
Dim sqlUpdate As String
|
||||||
Dim cmdLink As SqlCommand = Nothing
|
|
||||||
Dim transaction As SqlTransaction = Nothing
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
conn = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
If conn Is Nothing Then
|
Using transaction As SqlTransaction = conn.BeginTransaction()
|
||||||
Throw New Exception("Die Datenbankverbindung konnte nicht hergestellt werden.")
|
Try
|
||||||
End If
|
|
||||||
|
|
||||||
' Beginnen einer Transaktion, um Konsistenz zu gewährleisten
|
|
||||||
transaction = conn.BeginTransaction()
|
|
||||||
|
|
||||||
Dim sql As String
|
|
||||||
|
|
||||||
If aviso.TvTextBezeichnungID = 0 Then
|
If aviso.TvTextBezeichnungID = 0 Then
|
||||||
' Neuanlage
|
' Neuanlage
|
||||||
sql = "INSERT INTO AvisoTvNew (
|
sqlInsert = "INSERT INTO AvisoTvNew (
|
||||||
TvTextBezeichnung,
|
TvTextBezeichnung,
|
||||||
FixeZeile1RTF,
|
FixeZeile1RTF,
|
||||||
FixeZeile1HTML,
|
FixeZeile1HTML,
|
||||||
@@ -2820,33 +2916,9 @@ Public Class cAvisoTvNewDAL
|
|||||||
@IsActive
|
@IsActive
|
||||||
);
|
);
|
||||||
SELECT CAST(scope_identity() AS int);"
|
SELECT CAST(scope_identity() AS int);"
|
||||||
Else
|
|
||||||
' Aktualisierung
|
|
||||||
sql = "UPDATE AvisoTvNew SET
|
|
||||||
FixeZeile1RTF = @FixeZeile1RTF,
|
|
||||||
FixeZeile1HTML = @FixeZeile1HTML,
|
|
||||||
FixeZeile2RTF = @FixeZeile2RTF,
|
|
||||||
FixeZeile2HTML = @FixeZeile2HTML,
|
|
||||||
FixeZeile3RTF = @FixeZeile3RTF,
|
|
||||||
FixeZeile3HTML = @FixeZeile3HTML,
|
|
||||||
StartDate = @StartDate,
|
|
||||||
EndDate = @EndDate,
|
|
||||||
StartTime = @StartTime,
|
|
||||||
EndTime = @EndTime,
|
|
||||||
IsRecurring = @IsRecurring,
|
|
||||||
IsMonday = @IsMonday,
|
|
||||||
IsTuesday = @IsTuesday,
|
|
||||||
IsWednesday = @IsWednesday,
|
|
||||||
IsThursday = @IsThursday,
|
|
||||||
IsFriday = @IsFriday,
|
|
||||||
IsSaturday = @IsSaturday,
|
|
||||||
IsSunday = @IsSunday,
|
|
||||||
IsActive = @IsActive
|
|
||||||
WHERE TvTextBezeichnungID = @TvTextBezeichnungID"
|
|
||||||
End If
|
|
||||||
|
|
||||||
cmd = New SqlCommand(sql, conn, transaction)
|
|
||||||
|
|
||||||
|
Using cmd As New SqlCommand(sqlInsert, conn, transaction)
|
||||||
|
cmd.Parameters.AddWithValue("@TvTextBezeichnung", aviso.TvTextBezeichnung)
|
||||||
cmd.Parameters.AddWithValue("@FixeZeile1RTF", If(String.IsNullOrWhiteSpace(aviso.FixeZeile1RTF), CType(Nothing, String), aviso.FixeZeile1RTF))
|
cmd.Parameters.AddWithValue("@FixeZeile1RTF", If(String.IsNullOrWhiteSpace(aviso.FixeZeile1RTF), CType(Nothing, String), aviso.FixeZeile1RTF))
|
||||||
cmd.Parameters.AddWithValue("@FixeZeile1HTML", If(String.IsNullOrWhiteSpace(aviso.FixeZeile1HTML), CType(Nothing, String), aviso.FixeZeile1HTML))
|
cmd.Parameters.AddWithValue("@FixeZeile1HTML", If(String.IsNullOrWhiteSpace(aviso.FixeZeile1HTML), CType(Nothing, String), aviso.FixeZeile1HTML))
|
||||||
cmd.Parameters.AddWithValue("@FixeZeile2RTF", If(String.IsNullOrWhiteSpace(aviso.FixeZeile2RTF), DBNull.Value, aviso.FixeZeile2RTF))
|
cmd.Parameters.AddWithValue("@FixeZeile2RTF", If(String.IsNullOrWhiteSpace(aviso.FixeZeile2RTF), DBNull.Value, aviso.FixeZeile2RTF))
|
||||||
@@ -2867,22 +2939,60 @@ Public Class cAvisoTvNewDAL
|
|||||||
cmd.Parameters.AddWithValue("@IsSunday", aviso.IsSunday)
|
cmd.Parameters.AddWithValue("@IsSunday", aviso.IsSunday)
|
||||||
cmd.Parameters.AddWithValue("@IsActive", aviso.IsActive)
|
cmd.Parameters.AddWithValue("@IsActive", aviso.IsActive)
|
||||||
|
|
||||||
If aviso.TvTextBezeichnungID <> 0 Then
|
|
||||||
cmd.Parameters.AddWithValue("@TvTextBezeichnungID", aviso.TvTextBezeichnungID)
|
|
||||||
End If
|
|
||||||
|
|
||||||
If aviso.TvTextBezeichnungID = 0 Then
|
|
||||||
cmd.Parameters.AddWithValue("@TvTextBezeichnung", aviso.TvTextBezeichnung)
|
|
||||||
|
|
||||||
' Neuanlage: Führen Sie das INSERT aus und holen Sie die generierte ID
|
|
||||||
Dim result As Object = cmd.ExecuteScalar()
|
Dim result As Object = cmd.ExecuteScalar()
|
||||||
If result Is Nothing OrElse IsDBNull(result) Then
|
If result Is Nothing OrElse IsDBNull(result) Then
|
||||||
Throw New Exception("Das INSERT hat keine ID zurückgegeben.")
|
Throw New Exception("Das INSERT hat keine ID zurückgegeben.")
|
||||||
End If
|
End If
|
||||||
aviso.TvTextBezeichnungID = Convert.ToInt32(result)
|
aviso.TvTextBezeichnungID = Convert.ToInt32(result)
|
||||||
|
End Using
|
||||||
Else
|
Else
|
||||||
' Aktualisierung: Führen Sie das UPDATE aus
|
' Aktualisierung
|
||||||
|
sqlUpdate = "UPDATE AvisoTvNew SET
|
||||||
|
FixeZeile1RTF = @FixeZeile1RTF,
|
||||||
|
FixeZeile1HTML = @FixeZeile1HTML,
|
||||||
|
FixeZeile2RTF = @FixeZeile2RTF,
|
||||||
|
FixeZeile2HTML = @FixeZeile2HTML,
|
||||||
|
FixeZeile3RTF = @FixeZeile3RTF,
|
||||||
|
FixeZeile3HTML = @FixeZeile3HTML,
|
||||||
|
StartDate = @StartDate,
|
||||||
|
EndDate = @EndDate,
|
||||||
|
StartTime = @StartTime,
|
||||||
|
EndTime = @EndTime,
|
||||||
|
IsRecurring = @IsRecurring,
|
||||||
|
IsMonday = @IsMonday,
|
||||||
|
IsTuesday = @IsTuesday,
|
||||||
|
IsWednesday = @IsWednesday,
|
||||||
|
IsThursday = @IsThursday,
|
||||||
|
IsFriday = @IsFriday,
|
||||||
|
IsSaturday = @IsSaturday,
|
||||||
|
IsSunday = @IsSunday,
|
||||||
|
IsActive = @IsActive
|
||||||
|
WHERE TvTextBezeichnungID = @TvTextBezeichnungID"
|
||||||
|
|
||||||
|
Using cmd As New SqlCommand(sqlUpdate, conn, transaction)
|
||||||
|
cmd.Parameters.AddWithValue("@FixeZeile1RTF", If(String.IsNullOrWhiteSpace(aviso.FixeZeile1RTF), CType(Nothing, String), aviso.FixeZeile1RTF))
|
||||||
|
cmd.Parameters.AddWithValue("@FixeZeile1HTML", If(String.IsNullOrWhiteSpace(aviso.FixeZeile1HTML), CType(Nothing, String), aviso.FixeZeile1HTML))
|
||||||
|
cmd.Parameters.AddWithValue("@FixeZeile2RTF", If(String.IsNullOrWhiteSpace(aviso.FixeZeile2RTF), DBNull.Value, aviso.FixeZeile2RTF))
|
||||||
|
cmd.Parameters.AddWithValue("@FixeZeile2HTML", If(String.IsNullOrWhiteSpace(aviso.FixeZeile2HTML), DBNull.Value, aviso.FixeZeile2HTML))
|
||||||
|
cmd.Parameters.AddWithValue("@FixeZeile3RTF", If(String.IsNullOrWhiteSpace(aviso.FixeZeile3RTF), DBNull.Value, aviso.FixeZeile3RTF))
|
||||||
|
cmd.Parameters.AddWithValue("@FixeZeile3HTML", If(String.IsNullOrWhiteSpace(aviso.FixeZeile3HTML), DBNull.Value, aviso.FixeZeile3HTML))
|
||||||
|
cmd.Parameters.AddWithValue("@StartDate", If(aviso.StartDate.HasValue, CType(aviso.StartDate.Value, Object), DBNull.Value))
|
||||||
|
cmd.Parameters.AddWithValue("@EndDate", If(aviso.EndDate.HasValue, CType(aviso.EndDate.Value, Object), DBNull.Value))
|
||||||
|
cmd.Parameters.AddWithValue("@StartTime", If(aviso.StartTime.HasValue, CType(aviso.StartTime.Value, Object), DBNull.Value))
|
||||||
|
cmd.Parameters.AddWithValue("@EndTime", If(aviso.EndTime.HasValue, CType(aviso.EndTime.Value, Object), DBNull.Value))
|
||||||
|
cmd.Parameters.AddWithValue("@IsRecurring", aviso.IsRecurring)
|
||||||
|
cmd.Parameters.AddWithValue("@IsMonday", aviso.IsMonday)
|
||||||
|
cmd.Parameters.AddWithValue("@IsTuesday", aviso.IsTuesday)
|
||||||
|
cmd.Parameters.AddWithValue("@IsWednesday", aviso.IsWednesday)
|
||||||
|
cmd.Parameters.AddWithValue("@IsThursday", aviso.IsThursday)
|
||||||
|
cmd.Parameters.AddWithValue("@IsFriday", aviso.IsFriday)
|
||||||
|
cmd.Parameters.AddWithValue("@IsSaturday", aviso.IsSaturday)
|
||||||
|
cmd.Parameters.AddWithValue("@IsSunday", aviso.IsSunday)
|
||||||
|
cmd.Parameters.AddWithValue("@IsActive", aviso.IsActive)
|
||||||
|
cmd.Parameters.AddWithValue("@TvTextBezeichnungID", aviso.TvTextBezeichnungID)
|
||||||
|
|
||||||
cmd.ExecuteNonQuery()
|
cmd.ExecuteNonQuery()
|
||||||
|
End Using
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Einfügen oder Aktualisieren in die StandortTvBezeichnung-Tabelle
|
' Einfügen oder Aktualisieren in die StandortTvBezeichnung-Tabelle
|
||||||
@@ -2903,72 +3013,43 @@ Public Class cAvisoTvNewDAL
|
|||||||
END
|
END
|
||||||
"
|
"
|
||||||
|
|
||||||
cmdLink = New SqlCommand(sqlLink, conn, transaction)
|
Using cmdLink As New SqlCommand(sqlLink, conn, transaction)
|
||||||
cmdLink.Parameters.AddWithValue("@StandortID", aviso.StandortID)
|
cmdLink.Parameters.AddWithValue("@StandortID", aviso.StandortID)
|
||||||
cmdLink.Parameters.AddWithValue("@TvTextBezeichnungID", aviso.TvTextBezeichnungID)
|
cmdLink.Parameters.AddWithValue("@TvTextBezeichnungID", aviso.TvTextBezeichnungID)
|
||||||
cmdLink.Parameters.AddWithValue("@Position", If(String.IsNullOrEmpty(aviso.Position), DBNull.Value, aviso.Position))
|
cmdLink.Parameters.AddWithValue("@Position", If(String.IsNullOrEmpty(aviso.Position), DBNull.Value, aviso.Position))
|
||||||
|
|
||||||
cmdLink.ExecuteNonQuery()
|
cmdLink.ExecuteNonQuery()
|
||||||
|
End Using
|
||||||
|
|
||||||
' Transaktion committen, wenn alle Operationen erfolgreich waren
|
' Transaktion committen, wenn alle Operationen erfolgreich waren
|
||||||
transaction.Commit()
|
transaction.Commit()
|
||||||
|
|
||||||
Catch ex As SqlException
|
|
||||||
' Fehlerbehandlung: Transaktion zurückrollen und Fehler weiterwerfen
|
|
||||||
If transaction IsNot Nothing Then
|
|
||||||
Try
|
|
||||||
transaction.Rollback()
|
|
||||||
Catch rollbackEx As Exception
|
|
||||||
Throw New Exception("Fehler beim Zurückrollen der Transaktion: " & rollbackEx.Message)
|
|
||||||
End Try
|
|
||||||
End If
|
|
||||||
Throw New Exception("SQL Fehler beim Speichern des Eintrags: " & ex.Message)
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' Allgemeine Fehlerbehandlung: Transaktion zurückrollen und Fehler weiterwerfen
|
' Fehlerbehandlung: Transaktion zurückrollen und Fehler weiterwerfen
|
||||||
If transaction IsNot Nothing Then
|
|
||||||
Try
|
Try
|
||||||
transaction.Rollback()
|
transaction.Rollback()
|
||||||
Catch rollbackEx As Exception
|
Catch rollbackEx As Exception
|
||||||
Throw New Exception("Fehler beim Zurückrollen der Transaktion: " & rollbackEx.Message)
|
Throw New Exception("Fehler beim Zurückrollen der Transaktion: " & rollbackEx.Message, rollbackEx)
|
||||||
End Try
|
End Try
|
||||||
End If
|
Throw ' Weiterwerfen der ursprünglichen Ausnahme
|
||||||
Throw New Exception("Allgemeiner Fehler beim Speichern des Eintrags: " & ex.Message)
|
End Try
|
||||||
Finally
|
End Using
|
||||||
' Ressourcen manuell freigeben
|
End Using
|
||||||
If cmdLink IsNot Nothing Then
|
Catch ex As SqlException
|
||||||
cmdLink.Dispose()
|
Throw New Exception("SQL Fehler beim Speichern des Eintrags: " & ex.Message, ex)
|
||||||
cmdLink = Nothing
|
Catch ex As Exception
|
||||||
End If
|
Throw New Exception("Allgemeiner Fehler beim Speichern des Eintrags: " & ex.Message, ex)
|
||||||
|
|
||||||
If cmd IsNot Nothing Then
|
|
||||||
cmd.Dispose()
|
|
||||||
cmd = Nothing
|
|
||||||
End If
|
|
||||||
|
|
||||||
If transaction IsNot Nothing Then
|
|
||||||
transaction.Dispose()
|
|
||||||
transaction = Nothing
|
|
||||||
End If
|
|
||||||
|
|
||||||
If conn IsNot Nothing Then
|
|
||||||
conn.Close()
|
|
||||||
conn = Nothing
|
|
||||||
End If
|
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Setzt einen AvisoTvNew-Eintrag auf inaktiv.
|
||||||
' Methode zum Setzen eines Eintrags auf inaktiv
|
''' </summary>
|
||||||
|
''' <param name="hID">Die ID des Eintrags, der inaktiv gesetzt werden soll.</param>
|
||||||
Public Sub SetzeAufInaktiv(ByVal hID As Integer)
|
Public Sub SetzeAufInaktiv(ByVal hID As Integer)
|
||||||
Dim sql As String = "UPDATE AvisoTvNew SET IsActive = 0 WHERE TVID = @TVID"
|
Dim sql As String = "UPDATE AvisoTvNew SET IsActive = 0 WHERE TVID = @TVID"
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim conn As SqlConnection = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
|
||||||
If conn Is Nothing Then
|
|
||||||
Throw New Exception("Die Datenbankverbindung konnte nicht hergestellt werden.")
|
|
||||||
End If
|
|
||||||
|
|
||||||
Using cmd As New SqlCommand(sql, conn)
|
Using cmd As New SqlCommand(sql, conn)
|
||||||
cmd.Parameters.AddWithValue("@TVID", hID)
|
cmd.Parameters.AddWithValue("@TVID", hID)
|
||||||
Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
|
Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
|
||||||
@@ -2976,12 +3057,11 @@ Public Class cAvisoTvNewDAL
|
|||||||
Throw New Exception("Der Datensatz konnte nicht auf inaktiv gesetzt werden. Möglicherweise existiert er nicht mehr.")
|
Throw New Exception("Der Datensatz konnte nicht auf inaktiv gesetzt werden. Möglicherweise existiert er nicht mehr.")
|
||||||
End If
|
End If
|
||||||
End Using
|
End Using
|
||||||
|
End Using
|
||||||
Catch ex As SqlException
|
Catch ex As SqlException
|
||||||
' Ausnahme weiterwerfen mit spezifischer Fehlermeldung
|
Throw New Exception("AvisoTvNew-Eintrag kann nicht auf inaktiv gesetzt werden! " & vbCrLf & ex.Message, ex)
|
||||||
Throw New Exception("AvisoTvNew-Eintrag kann nicht auf inaktiv gesetzt werden! " & vbCrLf & ex.Message)
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' Allgemeine Ausnahme weiterwerfen
|
Throw New Exception("Fehler beim Setzen auf inaktiv: " & ex.Message, ex)
|
||||||
Throw New Exception("Fehler beim Setzen auf inaktiv: " & ex.Message)
|
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -2990,6 +3070,7 @@ End Class
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Public Class cAvisoTV
|
Public Class cAvisoTV
|
||||||
Property TVID As Long = 0
|
Property TVID As Long = 0
|
||||||
Property FixeZeile1 As String
|
Property FixeZeile1 As String
|
||||||
|
|||||||
Reference in New Issue
Block a user