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