Example #1
0
        //=====================================================================================================================
        // ADD ROOM BUTTON //
        //=====================================================================================================================
        private void AddrmBtn_Click(object sender, RoutedEventArgs e)
        {
            HotelRoom r = (HotelRoom)availrmLv.SelectedItem;

            r.IsAvail = false; // room becomes unavailable until removed from list

            /* set addon booleans for rooms based on checkboxes */
            if (r is DeluxeRoom dr)
            {
                if (bedCb.IsChecked == true)
                {
                    dr.AdditionalBed  = true;
                    dr.NoOfOccupants += 1;
                }
            }
            else if (r is StandardRoom sr)
            {
                if (breakfastCb.IsChecked == true)
                {
                    sr.RequireBreakfast = true;
                }
                if (wifiCb.IsChecked == true)
                {
                    sr.RequireWifi = true;
                }
            }

            /* Add selected room to guest's roomList and refresh selectedrm listview  */
            guest.HotelStay.AddRoom(r);
            selectrmLv.ItemsSource = null;
            selectrmLv.ItemsSource = guest.HotelStay.RoomList;

            /* Remove selected room from avail room list and refresh */
            availRms.Remove(r);
            availrmLv.ItemsSource = null;
            availrmLv.ItemsSource = availRms;

            /* Uncheck checkboxes */
            wifiCb.IsChecked      = false;
            breakfastCb.IsChecked = false;
            bedCb.IsChecked       = false;

            /* UI Visibility */
            hiddenchkInPage.Hide();
            chkinBtn.Visibility = Visibility.Visible;
        }
Example #2
0
        //=====================================================================================================================
        // REMOVE ROOM BUTTON //
        //=====================================================================================================================
        private void RemovermBtn_Click(object sender, RoutedEventArgs e)
        {
            HotelRoom r = (HotelRoom)selectrmLv.SelectedItem;

            /* Set addon booleans for rooms to false */
            if (r is DeluxeRoom dr)
            {
                if (dr.AdditionalBed == true)
                {
                    dr.AdditionalBed  = false;
                    dr.NoOfOccupants -= 1;
                }
            }
            else if (r is StandardRoom sr)
            {
                sr.RequireBreakfast = false;
                sr.RequireWifi      = false;
            }

            /* Remove selected room from guest's roomList and refresh */
            guest.HotelStay.RoomList.Remove(r);
            selectrmLv.ItemsSource = null;
            selectrmLv.ItemsSource = guest.HotelStay.RoomList;

            /* Add selected room to available room list and refresh */
            r.IsAvail = true; // room made available
            availRms.Add(r);
            availRms.Sort();  // sort roomList by room number
            availrmLv.ItemsSource = null;
            availrmLv.ItemsSource = availRms;

            /* Uncheck checkboxes */
            wifiCb.IsChecked      = false;
            breakfastCb.IsChecked = false;
            bedCb.IsChecked       = false;

            /* UI Visibility */
            hiddenchkInPage.Hide();
            if (guest.HotelStay.RoomList.Any()) //guest's roomList contains at least one room
            {
                chkinBtn.Visibility = Visibility.Visible;
            }
        }
Example #3
0
 /* Methods */
 public void AddRoom(HotelRoom r)
 {
     RoomList.Add(r);
 }