Esempio n. 1
0
        private void btnSearchRoom_Click(object sender, RoutedEventArgs e)
        {
            // check that the room has something that is 3 characters long
            if (txtSearchRoom.Text != "" && txtSearchRoom.Text.Length == 3)
            {
                // see if it is all numbers
                try
                {
                    Int32.Parse(txtSearchRoom.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("Invalid Room Number");
                    return;
                }

                // try to get the guest associated with that room number
                Guest guest;
                try
                {
                    guest = _guestManager.GetGuestByRoomID(txtSearchRoom.Text);
                    if (guest != null)
                    {
                        _activeGuests.Clear();
                        _activeGuests.Add(guest);
                        btnClearRoomSearch.Visibility = Visibility.Visible;
                        dgClerkRooms.ItemsSource      = _activeGuests;
                        refreshClerkRooms();
                    }
                    else
                    {
                        MessageBox.Show("Could not find Guest Associated with that room");
                        txtSearchRoom.SelectAll();
                        txtSearchRoom.Focus();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERROR: " + ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Invalid Room Number");
            }
            //refreshClerkRooms();
        }