Beispiel #1
0
        public void WhenSelectedItemIsBookedAndCancelIsClicked_ThenRemnoveTheUserIdConnectionToTheSelectedSlot()
        {
            var    user     = userManager.GetUserForUserName("Dawood");
            object overtime = db.Overtime.Where(o => o.OvertimeId == user.UserId).FirstOrDefault();

            overtimeManager.SetUser_IDs_ForBookedOvertime(user, overtime);
            overtimeManager.RemoveUser_IDs_FromBookedOvertime(overtime);
            Assert.AreEqual(null, overtimeManager.SelectedOvertime.UserId);
        }
 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.");
     }
 }