public void TestCheckInGuestValid()
        {
            //Arrange
            int validGuestID = _guests[0].GuestID;

            _guestManager.DeactivateGuest(validGuestID);
            //Act
            _guestManager.CheckInGuest(validGuestID);
            //Assert
            Assert.IsTrue(_guestManager.ReadGuestByGuestID(validGuestID).CheckedIn);
        }
コード例 #2
0
        /// <summary>
        /// James Heim
        /// Created 2019-04-11
        ///
        ///
        /// </summary>
        private void checkInGuest()
        {
            if (!_guest.CheckedIn)
            {
                // Guest is not checked in yet.

                // Check if the guest is assigned a room.
                if (_room != null)
                {
                    try
                    {
                        // Set CheckInDate on RoomReservation
                        _roomReservationManager.UpdateCheckInDateToNow(_roomReservation);

                        // Set CheckedIn on Guest
                        _guestManager.CheckInGuest(_guest.GuestID);

                        // Disable the Checkin button.
                        btnCheckIn.IsEnabled = false;

                        // Inform the user the change has been saved.
                        MessageBox.Show(_guest.FirstName + " has been checked in.");

                        // Done. Close form.
                        DialogResult = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error Checking Guest In");
                    }
                }
            }
            else
            {
                // Guest is already checked in -- Do nothing.
                // Button should have been disabled.
            }
        }
コード例 #3
0
 /// <summary>
 /// Alisa Roehr
 /// Created: 2019/03/01
 ///
 /// for checking in and out guests.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnCheckGuest_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dgGuests.SelectedItem != null)
         {
             Guest guest = _guestManager.ReadGuestByGuestID(((Guest)dgGuests.SelectedItem).GuestID);
             if (guest.CheckedIn == false)
             {
                 _guestManager.CheckInGuest(guest.GuestID);
             }
             else if (guest.CheckedIn == true)
             {
                 _guestManager.CheckOutGuest(guest.GuestID);
             }
             _guests = _guestManager.ReadAllGuests();
             dgGuests.ItemsSource = _guests;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Checking In or Out Guest Failed!");
     }
 }