diff --git a/SDL/frmEssensbestellungen.vb b/SDL/frmEssensbestellungen.vb index 2175e3b5..d500547e 100644 --- a/SDL/frmEssensbestellungen.vb +++ b/SDL/frmEssensbestellungen.vb @@ -12,6 +12,8 @@ Public Class frmEssensbestellungen Dim menu As String = "MenĂ¼" Dim alacarte As String = "A la carte" Dim outdated As Boolean = False + Dim urlaub As String = "urlaub" + Dim feiertag As String = "feiertag" Private Sub frmEssensbestellungen_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -46,7 +48,8 @@ Public Class frmEssensbestellungen If rbMenu_montag.Checked Then essen.eb_montag = menu setWarning(False) - Else + ElseIf rbMenuAlt_montag.Checked Then + If txtAlt_montag.Text.ToString.Replace(" ", "") <> "" Then essen.eb_montag = txtAlt_montag.Text.ToString setWarning(False) @@ -54,7 +57,8 @@ Public Class frmEssensbestellungen setWarning(True) Exit Sub End If - + Else + essen.eb_montag = Nothing End If setWarning(False) Else @@ -66,7 +70,7 @@ Public Class frmEssensbestellungen If rbMenu_dienstag.Checked Then essen.eb_dienstag = menu setWarning(False) - Else + ElseIf rbMenuAlt_dienstag.Checked Then If txtAlt_dienstag.Text.ToString.Replace(" ", "") <> "" Then essen.eb_dienstag = txtAlt_dienstag.Text.ToString setWarning(False) @@ -74,6 +78,8 @@ Public Class frmEssensbestellungen setWarning(True) Exit Sub End If + Else + essen.eb_dienstag = Nothing End If setWarning(False) Else @@ -84,7 +90,7 @@ Public Class frmEssensbestellungen If rbMenu_mittwoch.Checked Then essen.eb_mittwoch = menu setWarning(False) - Else + ElseIf rbMenuAlt_mittwoch.Checked Then If txtAlt_mittwoch.Text.ToString.Replace(" ", "") <> "" Then essen.eb_mittwoch = txtAlt_mittwoch.Text.ToString setWarning(False) @@ -92,6 +98,8 @@ Public Class frmEssensbestellungen setWarning(True) Exit Sub End If + Else + essen.eb_mittwoch = Nothing End If setWarning(False) Else @@ -102,7 +110,7 @@ Public Class frmEssensbestellungen If rbMenu_donnerstag.Checked Then essen.eb_donnerstag = menu setWarning(False) - Else + ElseIf rbMenuAlt_donnerstag.Checked Then If txtAlt_donnerstag.Text.ToString.Replace(" ", "") <> "" Then essen.eb_donnerstag = txtAlt_donnerstag.Text.ToString setWarning(False) @@ -110,6 +118,8 @@ Public Class frmEssensbestellungen setWarning(True) Exit Sub End If + Else + essen.eb_donnerstag = Nothing End If setWarning(False) Else @@ -120,7 +130,7 @@ Public Class frmEssensbestellungen If rbMenu__freitag.Checked Then essen.eb_freitag = menu setWarning(False) - Else + ElseIf rbMenuAlt_freitag.Checked Then If txtAlt_freitag.Text.ToString.Replace(" ", "") <> "" Then essen.eb_freitag = txtAlt_freitag.Text.ToString setWarning(False) @@ -128,6 +138,8 @@ Public Class frmEssensbestellungen setWarning(True) Exit Sub End If + Else + essen.eb_freitag = Nothing End If setWarning(False) Else @@ -227,63 +239,81 @@ Public Class frmEssensbestellungen End Sub Private Sub cbFields_CheckedChanged(sender As Object, e As EventArgs) Handles cb_montag.CheckedChanged, cb_dienstag.CheckedChanged, cb_mittwoch.CheckedChanged, cbdonnerstag.CheckedChanged, cb_freitag.CheckedChanged + + If cb_montag.Checked Then - rbMenuAlt_montag.Enabled = True - rbMenu_montag.Enabled = True - If checkIfGroupBoxIsSetFirstTime(GroupBoxMontag) Then - rbMenu_montag.Checked = True + If Not txtMenu_montag.Text.ToLower.StartsWith(urlaub) AndAlso Not txtMenu_montag.Text.ToLower.StartsWith(feiertag) Then + rbMenuAlt_montag.Enabled = True + rbMenu_montag.Enabled = True + If checkIfGroupBoxIsSetFirstTime(GroupBoxMontag) Then + rbMenu_montag.Checked = True + End If End If + Else rbMenuAlt_montag.Enabled = False rbMenu_montag.Enabled = False txtAlt_montag.Text = "" End If + If cb_dienstag.Checked Then - rbMenuAlt_dienstag.Enabled = True - rbMenu_dienstag.Enabled = True - If checkIfGroupBoxIsSetFirstTime(GroupBoxDienstag) Then - rbMenu_dienstag.Checked = True + If Not txtMenu_dienstag.Text.ToLower.StartsWith(urlaub) AndAlso Not txtMenu_dienstag.Text.ToLower.StartsWith(feiertag) Then + rbMenuAlt_dienstag.Enabled = True + rbMenu_dienstag.Enabled = True + If checkIfGroupBoxIsSetFirstTime(GroupBoxDienstag) Then + rbMenu_dienstag.Checked = True + End If End If + Else - rbMenu_dienstag.Enabled = False + rbMenu_dienstag.Enabled = False rbMenuAlt_dienstag.Enabled = False txtAlt_dienstag.Text = "" End If If cb_mittwoch.Checked Then - rbMenuAlt_mittwoch.Enabled = True - rbMenu_mittwoch.Enabled = True - If checkIfGroupBoxIsSetFirstTime(Mittwoch) Then - rbMenu_mittwoch.Checked = True + If Not txtMenu_mittwoch.Text.ToLower.StartsWith(urlaub) AndAlso Not txtMenu_mittwoch.Text.ToLower.StartsWith(feiertag) Then + rbMenuAlt_mittwoch.Enabled = True + rbMenu_mittwoch.Enabled = True + If checkIfGroupBoxIsSetFirstTime(Mittwoch) Then + rbMenu_mittwoch.Checked = True + End If End If + Else - rbMenu_mittwoch.Enabled = False + rbMenu_mittwoch.Enabled = False rbMenuAlt_mittwoch.Enabled = False txtAlt_mittwoch.Text = "" End If If cbdonnerstag.Checked Then - rbMenuAlt_donnerstag.Enabled = True - rbMenu_donnerstag.Enabled = True - If checkIfGroupBoxIsSetFirstTime(GroupBoxDonnerstag) Then - rbMenu_donnerstag.Checked = True + If Not txtMenu_donnerstag.Text.ToLower.StartsWith(urlaub) AndAlso Not txtMenu_donnerstag.Text.ToLower.StartsWith(feiertag) Then + rbMenuAlt_donnerstag.Enabled = True + rbMenu_donnerstag.Enabled = True + If checkIfGroupBoxIsSetFirstTime(GroupBoxDonnerstag) Then + rbMenu_donnerstag.Checked = True + End If End If + Else - rbMenu_donnerstag.Enabled = False + rbMenu_donnerstag.Enabled = False rbMenuAlt_donnerstag.Enabled = False txtAlt_donnerstag.Text = "" End If If cb_freitag.Checked Then - rbMenuAlt_freitag.Enabled = True - rbMenu__freitag.Enabled = True - If checkIfGroupBoxIsSetFirstTime(GroupBoxFreitag) Then - rbMenu__freitag.Checked = True + If Not txtMenu_freitag.Text.ToLower.StartsWith(urlaub) AndAlso Not txtMenu_freitag.Text.ToLower.StartsWith(feiertag) Then + rbMenuAlt_freitag.Enabled = True + rbMenu__freitag.Enabled = True + If checkIfGroupBoxIsSetFirstTime(GroupBoxFreitag) Then + rbMenu__freitag.Checked = True + End If End If + Else - rbMenu__freitag.Enabled = False + rbMenu__freitag.Enabled = False rbMenuAlt_freitag.Enabled = False txtAlt_freitag.Text = "" End If