Ejemplo n.º 1
0
 /// <summary>
 /// Removes the room from the Guest
 /// </summary>
 public void RemoveRoom()
 {
     if (BookedRoom != null)
     {
         BookedRoom = null;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Assigns the input room to the Guest if it is available and a valid room.
 /// </summary>
 /// <param name="_room">The room you are trying to assign to the guest</param>
 public void AssignRoom(HotelRoom _room)
 {
     if (_room != null && _room.isNotOccupied /* And logic for checking whether the room is available between StayingFrom to StayingTo */)
     {
         if (_room.isNotOccupied == true)
         {
             _room.SetOccupant(this);
             BookedRoom = _room;
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// A method which calls the current Guest's room number
 /// </summary>
 /// <returns> The selected HotelRoom </returns>
 private HotelRoom curRoom()
 {
     if (getCurrDataGrid() != null)
     {
         if (getCurrDataGrid().CurrentRow != null)
         {
             HotelRoom eh = (HotelRoom)getCurrDataGrid().CurrentRow.DataBoundItem;
             return((HotelRoom)getCurrDataGrid().CurrentRow.DataBoundItem);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds the guest selected to the room selected.
        /// </summary>
        private void button1_Click(object sender, EventArgs e)
        {
            if (curGuest() != null && curRoom() != null && curRoom().isNotOccupied)
            {
                Guest     g = curGuest();
                HotelRoom h = curRoom();

                h.SetOccupant(g);
                g.AssignRoom(h);

                listOfGuestsWithoutRooms.Remove(g);
                listOfGuestsWithRooms.Add(g);
            }
            UpdateVisualsInDataGridViewRow();
            refreshDataGrids();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Remove the guest from his/her room.
        /// </summary>
        private void button3_Click(object sender, EventArgs e)
        {
            if (curRoom() != null && !curRoom().isNotOccupied)
            {
                Guest     g = curRoom().currOccupant;
                HotelRoom h = curRoom();

                // Remove guest from room and room from guest.
                g.RemoveRoom();
                h.SetOccupant();

                listOfGuestsWithoutRooms.Add(g);
                listOfGuestsWithRooms.Remove(g);
            }
            UpdateVisualsInDataGridViewRow();
            refreshDataGrids();
        }