private void btnBook_Click(object sender, RoutedEventArgs e) { if (ListBox.SelectedItem != null) { if (overtimeManager.CheckForOverlap(_userEntered, ListBox.SelectedItem) == true) { overtimeManager.SetUser_IDs_ForBookedOvertime(_userEntered, ListBox.SelectedItem); ListBox.ItemsSource = null; if (overtimeManager.SelectedOvertime.Day.Equals("Monday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForMonday(); } else if (overtimeManager.SelectedOvertime.Day.Equals("Tuesday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForTuesday(); } else if (overtimeManager.SelectedOvertime.Day.Equals("Wednesday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForWednesday(); } else if (overtimeManager.SelectedOvertime.Day.Equals("Thursday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForThursday(); } else if (overtimeManager.SelectedOvertime.Day.Equals("Friday")) { ListBox.ItemsSource = overtimeManager.PopulateOvertimeForFriday(); } } else { MessageBox.Show("The Overtime slot you have selected overlaps with 1 or more of the booked overtimes. Please cancel any overlapping overtimes if you want to book this slot."); } } else { MessageBox.Show("Please select a slot to book for overtime."); } }
private void btnWednesday_Click(object sender, RoutedEventArgs e) { ListBox1.ItemsSource = overtimeManager.PopulateOvertimeForWednesday(); }