This commit is contained in:
2024-12-12 10:43:19 +01:00
parent 68fe0128b7
commit 55776c337d

View File

@@ -2455,7 +2455,7 @@ Public Class cAvisoTvNew
Public Property FixeZeile3RTF As String Public Property FixeZeile3RTF As String
Public Property StandortID As Integer Public Property StandortID As Integer
Public Property Standort As String Public Property Standort As String
Public Property Art As String Public Property Prio As Integer
Public Property StartDate As Date? Public Property StartDate As Date?
Public Property EndDate As Date? Public Property EndDate As Date?
Public Property StartTime As TimeSpan? Public Property StartTime As TimeSpan?
@@ -2469,7 +2469,6 @@ Public Class cAvisoTvNew
Public Property IsSaturday As Boolean? Public Property IsSaturday As Boolean?
Public Property IsSunday As Boolean? Public Property IsSunday As Boolean?
Public Property IsActive As Boolean Public Property IsActive As Boolean
Public Property Position As String
End Class End Class
@@ -2489,6 +2488,8 @@ Public Class cTvSettings
Public Property KachelRowGapInPercent As Double? Public Property KachelRowGapInPercent As Double?
Public Property SeitenwechselInSek As Integer? Public Property SeitenwechselInSek As Integer?
Public Property TextBalkenHeightInPercent As Double? Public Property TextBalkenHeightInPercent As Double?
Public Property TextFlaggeLeft As Double?
Public Property TextFlaggeBottom As Double?
Public Property SelectedLogoValue As String Public Property SelectedLogoValue As String
@@ -2539,16 +2540,18 @@ Public Class cAvisoTvNewDAL
KachelRowGapInPercent = @KachelRowGapInPercent, KachelRowGapInPercent = @KachelRowGapInPercent,
SeitenwechselInSek = @SeitenwechselInSek, SeitenwechselInSek = @SeitenwechselInSek,
TextBalkenHeightInPercent = @TextBalkenHeightInPercent, TextBalkenHeightInPercent = @TextBalkenHeightInPercent,
FlaggeLeft = @FlaggeLeft,
FlaggeBottom = @FlaggeBottom,
Logo = @Logo Logo = @Logo
WHERE StandortID = @StandortID" WHERE StandortID = @StandortID"
Dim sqlInsert As String = "INSERT INTO AvisoTvSettings Dim sqlInsert As String = "INSERT INTO AvisoTvSettings
(StandortID, KachelWidthInPercent, KachelHeightInPercent,KachelRowGapInPercent, (StandortID, KachelWidthInPercent, KachelHeightInPercent,KachelRowGapInPercent,
KachelFontSizeLkwNummer, KachelFontSizeDateTime, KachelFontSizeLkwNummer, KachelFontSizeDateTime,
SeitenwechselInSek, TextBalkenHeightInPercent,Logo) SeitenwechselInSek, TextBalkenHeightInPercent,FlaggeLeft,FlaggeBottom,Logo)
VALUES VALUES
(@StandortID, @KachelWidthInPercent, @KachelHeightInPercent,@KachelRowGapInPercent, (@StandortID, @KachelWidthInPercent, @KachelHeightInPercent,@KachelRowGapInPercent,
@KachelFontSizeLkwNummer, @KachelFontSizeDateTime, @KachelFontSizeLkwNummer, @KachelFontSizeDateTime,
@SeitenwechselInSek, @TextBalkenHeightInPercent,@Logo)" @SeitenwechselInSek, @TextBalkenHeightInPercent,@FlaggeLeft,@FlaggeBottom,@Logo)"
Try Try
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection() Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
@@ -2571,6 +2574,8 @@ Public Class cAvisoTvNewDAL
cmdSave.Parameters.AddWithValue("@KachelFontSizeDateTime", settings.KachelFontSizeDateTime) cmdSave.Parameters.AddWithValue("@KachelFontSizeDateTime", settings.KachelFontSizeDateTime)
cmdSave.Parameters.AddWithValue("@SeitenwechselInSek", settings.SeitenwechselInSek) cmdSave.Parameters.AddWithValue("@SeitenwechselInSek", settings.SeitenwechselInSek)
cmdSave.Parameters.AddWithValue("@TextBalkenHeightInPercent", settings.TextBalkenHeightInPercent) cmdSave.Parameters.AddWithValue("@TextBalkenHeightInPercent", settings.TextBalkenHeightInPercent)
cmdSave.Parameters.AddWithValue("@FlaggeLeft", settings.TextFlaggeLeft)
cmdSave.Parameters.AddWithValue("@FlaggeBottom", settings.TextFlaggeBottom)
cmdSave.Parameters.AddWithValue("@Logo", settings.SelectedLogoValue) cmdSave.Parameters.AddWithValue("@Logo", settings.SelectedLogoValue)
cmdSave.ExecuteNonQuery() cmdSave.ExecuteNonQuery()
End Using End Using
@@ -2608,6 +2613,8 @@ Public Class cAvisoTvNewDAL
.KachelFontSizeDateTime = If(IsDBNull(dr("KachelFontSizeDateTime")), 0, Convert.ToDouble(dr("KachelFontSizeDateTime"))), .KachelFontSizeDateTime = If(IsDBNull(dr("KachelFontSizeDateTime")), 0, Convert.ToDouble(dr("KachelFontSizeDateTime"))),
.SeitenwechselInSek = If(IsDBNull(dr("SeitenwechselInSek")), 0, Convert.ToInt32(dr("SeitenwechselInSek"))), .SeitenwechselInSek = If(IsDBNull(dr("SeitenwechselInSek")), 0, Convert.ToInt32(dr("SeitenwechselInSek"))),
.TextBalkenHeightInPercent = If(IsDBNull(dr("TextBalkenHeightInPercent")), 0, Convert.ToDouble(dr("TextBalkenHeightInPercent"))), .TextBalkenHeightInPercent = If(IsDBNull(dr("TextBalkenHeightInPercent")), 0, Convert.ToDouble(dr("TextBalkenHeightInPercent"))),
.TextFlaggeBottom = If(IsDBNull(dr("FlaggeBottom")), 0, Convert.ToDouble(dr("FlaggeBottom"))),
.TextFlaggeLeft = If(IsDBNull(dr("FlaggeLeft")), 0, Convert.ToDouble(dr("FlaggeLeft"))),
.SelectedLogoValue = If(IsDBNull(dr("Logo")), "", Convert.ToString(dr("Logo"))) .SelectedLogoValue = If(IsDBNull(dr("Logo")), "", Convert.ToString(dr("Logo")))
} }
@@ -2693,19 +2700,18 @@ Public Class cAvisoTvNewDAL
''' </summary> ''' </summary>
''' <param name="tvid">Die TV-TextbezeichnungID.</param> ''' <param name="tvid">Die TV-TextbezeichnungID.</param>
''' <param name="bezeichnung">Die Bezeichnung.</param> ''' <param name="bezeichnung">Die Bezeichnung.</param>
''' <param name="standort">Der Standort.</param> ''' <param name="StandortBezeichnung">Der Standort.</param>
''' <param name="liste">Die Liste, in die die Ergebnisse eingefügt werden.</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)) 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,
stv.Prio,
a.TvTextBezeichnung, a.TvTextBezeichnung,
s.Standort, s.Standort,
stv.Position,
a.FixeZeile1RTF, a.FixeZeile1RTF,
a.FixeZeile2RTF, a.FixeZeile2RTF,
a.FixeZeile3RTF, a.FixeZeile3RTF,
a.Art,
a.StartDate, a.StartDate,
a.EndDate, a.EndDate,
a.StartTime, a.StartTime,
@@ -2758,15 +2764,14 @@ Public Class cAvisoTvNewDAL
.StandortID = Convert.ToInt32(dr("StandortID")), .StandortID = Convert.ToInt32(dr("StandortID")),
.TvTextBezeichnung = Convert.ToString(dr("TVTextBezeichnung")), .TvTextBezeichnung = Convert.ToString(dr("TVTextBezeichnung")),
.Standort = Convert.ToString(dr("Standort")), .Standort = Convert.ToString(dr("Standort")),
.Position = If(IsDBNull(dr("Position")), Nothing, Convert.ToString(dr("Position"))),
.FixeZeile1RTF = If(IsDBNull(dr("FixeZeile1RTF")), Nothing, Convert.ToString(dr("FixeZeile1RTF"))), .FixeZeile1RTF = If(IsDBNull(dr("FixeZeile1RTF")), Nothing, Convert.ToString(dr("FixeZeile1RTF"))),
.FixeZeile2RTF = If(IsDBNull(dr("FixeZeile2RTF")), Nothing, Convert.ToString(dr("FixeZeile2RTF"))), .FixeZeile2RTF = If(IsDBNull(dr("FixeZeile2RTF")), Nothing, Convert.ToString(dr("FixeZeile2RTF"))),
.FixeZeile3RTF = If(IsDBNull(dr("FixeZeile3RTF")), Nothing, Convert.ToString(dr("FixeZeile3RTF"))), .FixeZeile3RTF = If(IsDBNull(dr("FixeZeile3RTF")), Nothing, Convert.ToString(dr("FixeZeile3RTF"))),
.Art = If(IsDBNull(dr("Art")), Nothing, Convert.ToString(dr("Art"))), .Prio = If(IsDBNull(dr("Prio")), Nothing, Convert.ToInt32(dr("Prio"))),
.StartDate = If(IsDBNull(dr("StartDate")), CType(Nothing, Date?), Convert.ToDateTime(dr("StartDate"))), .StartDate = If(IsDBNull(dr("StartDate")), CType(Nothing, Date?), Convert.ToDateTime(dr("StartDate"))),
.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?), CType(dr("StartTime"), TimeSpan)),
.EndTime = If(IsDBNull(dr("EndTime")), CType(Nothing, TimeSpan?), Convert.ToDateTime(dr("EndTime")).TimeOfDay), .EndTime = If(IsDBNull(dr("EndTime")), CType(Nothing, TimeSpan?), CType(dr("EndTime"), TimeSpan)),
.IsRecurring = If(IsDBNull(dr("IsRecurring")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsRecurring"))), .IsRecurring = If(IsDBNull(dr("IsRecurring")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsRecurring"))),
.IsMonday = If(IsDBNull(dr("IsMonday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsMonday"))), .IsMonday = If(IsDBNull(dr("IsMonday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsMonday"))),
.IsTuesday = If(IsDBNull(dr("IsTuesday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsTuesday"))), .IsTuesday = If(IsDBNull(dr("IsTuesday")), CType(Nothing, Boolean?), Convert.ToBoolean(dr("IsTuesday"))),
@@ -2801,7 +2806,7 @@ Public Class cAvisoTvNewDAL
a.FixeZeile1RTF, a.FixeZeile1RTF,
a.FixeZeile2RTF, a.FixeZeile2RTF,
a.FixeZeile3RTF, a.FixeZeile3RTF,
a.Art, a.Prio,
a.StartDate, a.StartDate,
a.EndDate, a.EndDate,
a.StartTime, a.StartTime,
@@ -2820,8 +2825,6 @@ Public Class cAvisoTvNewDAL
Try Try
Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection() Using conn As SqlConnection = cDatenbankAVISO.CreateNewOpenConnection()
Using cmd As New SqlCommand(sql, conn) Using cmd As New SqlCommand(sql, conn)
' Keine Parameter erforderlich, da keine Filter
Using 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 {
@@ -2830,11 +2833,11 @@ Public Class cAvisoTvNewDAL
.FixeZeile1RTF = If(IsDBNull(dr("FixeZeile1RTF")), Nothing, dr("FixeZeile1RTF").ToString()), .FixeZeile1RTF = If(IsDBNull(dr("FixeZeile1RTF")), Nothing, dr("FixeZeile1RTF").ToString()),
.FixeZeile2RTF = If(IsDBNull(dr("FixeZeile2RTF")), Nothing, dr("FixeZeile2RTF").ToString()), .FixeZeile2RTF = If(IsDBNull(dr("FixeZeile2RTF")), Nothing, dr("FixeZeile2RTF").ToString()),
.FixeZeile3RTF = If(IsDBNull(dr("FixeZeile3RTF")), Nothing, dr("FixeZeile3RTF").ToString()), .FixeZeile3RTF = If(IsDBNull(dr("FixeZeile3RTF")), Nothing, dr("FixeZeile3RTF").ToString()),
.Art = If(IsDBNull(dr("Art")), Nothing, dr("Art").ToString()), .Prio = If(IsDBNull(dr("Prio")), 0, Convert.ToInt32(dr("Prio"))),
.StartDate = If(IsDBNull(dr("StartDate")), CType(Nothing, Date?), Convert.ToDateTime(dr("StartDate"))), .StartDate = If(IsDBNull(dr("StartDate")), CType(Nothing, Date?), Convert.ToDateTime(dr("StartDate"))),
.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?), CType(dr("StartTime"), TimeSpan)),
.EndTime = If(IsDBNull(dr("EndTime")), CType(Nothing, TimeSpan?), Convert.ToDateTime(dr("EndTime")).TimeOfDay), .EndTime = If(IsDBNull(dr("EndTime")), CType(Nothing, TimeSpan?), CType(dr("EndTime"), TimeSpan)),
.IsRecurring = If(IsDBNull(dr("IsRecurring")), False, Convert.ToBoolean(dr("IsRecurring"))), .IsRecurring = If(IsDBNull(dr("IsRecurring")), False, Convert.ToBoolean(dr("IsRecurring"))),
.IsMonday = If(IsDBNull(dr("IsMonday")), False, Convert.ToBoolean(dr("IsMonday"))), .IsMonday = If(IsDBNull(dr("IsMonday")), False, Convert.ToBoolean(dr("IsMonday"))),
.IsTuesday = If(IsDBNull(dr("IsTuesday")), False, Convert.ToBoolean(dr("IsTuesday"))), .IsTuesday = If(IsDBNull(dr("IsTuesday")), False, Convert.ToBoolean(dr("IsTuesday"))),
@@ -2891,7 +2894,8 @@ Public Class cAvisoTvNewDAL
IsThursday, IsThursday,
IsFriday, IsFriday,
IsSaturday, IsSaturday,
IsSunday, IsSunday,
Prio,
IsActive IsActive
) VALUES ( ) VALUES (
@TvTextBezeichnung, @TvTextBezeichnung,
@@ -2913,6 +2917,7 @@ Public Class cAvisoTvNewDAL
@IsFriday, @IsFriday,
@IsSaturday, @IsSaturday,
@IsSunday, @IsSunday,
@Prio,
@IsActive @IsActive
); );
SELECT CAST(scope_identity() AS int);" SELECT CAST(scope_identity() AS int);"
@@ -2929,6 +2934,7 @@ Public Class cAvisoTvNewDAL
cmd.Parameters.AddWithValue("@EndDate", If(aviso.EndDate.HasValue, CType(aviso.EndDate.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("@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("@EndTime", If(aviso.EndTime.HasValue, CType(aviso.EndTime.Value, Object), DBNull.Value))
cmd.Parameters.AddWithValue("@Prio", aviso.Prio)
cmd.Parameters.AddWithValue("@IsRecurring", aviso.IsRecurring) cmd.Parameters.AddWithValue("@IsRecurring", aviso.IsRecurring)
cmd.Parameters.AddWithValue("@IsMonday", aviso.IsMonday) cmd.Parameters.AddWithValue("@IsMonday", aviso.IsMonday)
cmd.Parameters.AddWithValue("@IsTuesday", aviso.IsTuesday) cmd.Parameters.AddWithValue("@IsTuesday", aviso.IsTuesday)
@@ -2966,7 +2972,8 @@ Public Class cAvisoTvNewDAL
IsFriday = @IsFriday, IsFriday = @IsFriday,
IsSaturday = @IsSaturday, IsSaturday = @IsSaturday,
IsSunday = @IsSunday, IsSunday = @IsSunday,
IsActive = @IsActive IsActive = @IsActive,
Prio = @Prio
WHERE TvTextBezeichnungID = @TvTextBezeichnungID" WHERE TvTextBezeichnungID = @TvTextBezeichnungID"
Using cmd As New SqlCommand(sqlUpdate, conn, transaction) Using cmd As New SqlCommand(sqlUpdate, conn, transaction)
@@ -2989,6 +2996,7 @@ Public Class cAvisoTvNewDAL
cmd.Parameters.AddWithValue("@IsSaturday", aviso.IsSaturday) cmd.Parameters.AddWithValue("@IsSaturday", aviso.IsSaturday)
cmd.Parameters.AddWithValue("@IsSunday", aviso.IsSunday) cmd.Parameters.AddWithValue("@IsSunday", aviso.IsSunday)
cmd.Parameters.AddWithValue("@IsActive", aviso.IsActive) cmd.Parameters.AddWithValue("@IsActive", aviso.IsActive)
cmd.Parameters.AddWithValue("@Prio", aviso.Prio)
cmd.Parameters.AddWithValue("@TvTextBezeichnungID", aviso.TvTextBezeichnungID) cmd.Parameters.AddWithValue("@TvTextBezeichnungID", aviso.TvTextBezeichnungID)
cmd.ExecuteNonQuery() cmd.ExecuteNonQuery()
@@ -2997,40 +3005,44 @@ Public Class cAvisoTvNewDAL
' Einfügen oder Aktualisieren in die StandortTvBezeichnung-Tabelle ' Einfügen oder Aktualisieren in die StandortTvBezeichnung-Tabelle
Dim sqlLink As String = " Dim sqlLink As String = "
IF EXISTS ( IF EXISTS (
SELECT 1 FROM StandortTvBezeichnung SELECT 1
WHERE StandortID = @StandortID AND TvTextBezeichnungID = @TvTextBezeichnungID FROM StandortTvBezeichnung
) WHERE StandortID = @StandortID
BEGIN AND TvTextBezeichnungID = @TvTextBezeichnungID
UPDATE StandortTvBezeichnung )
SET Position = @Position BEGIN
WHERE StandortID = @StandortID AND TvTextBezeichnungID = @TvTextBezeichnungID UPDATE StandortTvBezeichnung
END SET
ELSE Prio = @Prio
BEGIN WHERE StandortID = @StandortID
INSERT INTO StandortTvBezeichnung (StandortID, TvTextBezeichnungID, Position) AND TvTextBezeichnungID = @TvTextBezeichnungID
VALUES (@StandortID, @TvTextBezeichnungID, @Position) END
END ELSE
" BEGIN
INSERT INTO StandortTvBezeichnung (StandortID, TvTextBezeichnungID)
VALUES (@StandortID, @TvTextBezeichnungID)
END
"
Using cmdLink As 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("@Prio", aviso.Prio)
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.ExecuteNonQuery() cmdLink.ExecuteNonQuery()
End Using End Using
' Transaktion committen, wenn alle Operationen erfolgreich waren ' Transaktion committen
transaction.Commit() transaction.Commit()
Catch ex As Exception Catch ex As Exception
' Fehlerbehandlung: Transaktion zurückrollen und Fehler weiterwerfen ' Fehler: Transaktion zurückrollen
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, rollbackEx) Throw New Exception("Fehler beim Zurückrollen der Transaktion: " & rollbackEx.Message, rollbackEx)
End Try End Try
Throw ' Weiterwerfen der ursprünglichen Ausnahme Throw
End Try End Try
End Using End Using
End Using End Using
@@ -3071,6 +3083,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