예제 #1
0
        private void removeRoomBtn_Click(object sender, RoutedEventArgs e) //removes the selected room from the selected listview [2.1.4]
        {
            HotelRoom r = (HotelRoom)lvRoomsSelected.SelectedItem;

            r.IsAvail = true;
            if (r.IsAvail == true) //checks whether the room is available
            {
                availableRooms.Add(r);
            }
            if (r.RoomType == "Standard") //check for standard or deluxe and allow which checkbox to be checked [2.1.3]
            {
                if (addWifiCheckBox.IsChecked == true)
                {
                    r.DailyRate = r.DailyRate - 10;
                }
                if (addBreakfastCheckBox.IsChecked == true)
                {
                    r.DailyRate = r.DailyRate - 20;
                }
            }
            else if (r.RoomType == "Deluxe")
            {
                if (addBedCheckBox.IsChecked == true)
                {
                    r.DailyRate = r.DailyRate - 25;
                }
            }
            tempRoomList.Remove(r);
            RefreshList();
        }
예제 #2
0
        private void addRoomBtn_Click(object sender, RoutedEventArgs e)
        {
            double    p = 0;
            HotelRoom r = (HotelRoom)lvAvailableRooms.SelectedItem;

            if (r.RoomType == "Standard") //check for standard or deluxe and allow which checkbox to be checked [2.1.3]
            {
                if (addWifiCheckBox.IsChecked == true)
                {
                    p += 10;
                }
                if (addBreakfastCheckBox.IsChecked == true)
                {
                    p += 20;
                }
            }
            else if (r.RoomType == "Deluxe")
            {
                if (addBedCheckBox.IsChecked == true)
                {
                    p = 25;
                }
            }
            r.DailyRate += p;
            r.IsAvail    = false;
            if (r.IsAvail == false)
            {
                availableRooms.Remove(r);
            }
            tempRoomList.Add(r);
            RefreshList();
        }
예제 #3
0
        } //updates the listview

        private void checkInBtn_Click(object sender, RoutedEventArgs e)
        {
            bool check = false;

            foreach (Guest g in guestList)
            {
                if (guestTxt.Text != g.Name)
                {
                    check = true;
                }
            }
            if (passportTxt.Text == "" || passportTxt.Text == " ")
            {
                statusUpdateText.Text = "Please enter a Passport Number";
            }
            else
            {
                if (check == true)                                                                                                                      //if guest.text cannot be found in the guestList.Name
                {
                    Stay       s     = new Stay(DateTime.Parse(checkInDatePicker.Date.ToString()), DateTime.Parse(checkOutDatePicker.Date.ToString())); //get datestart and dateend
                    Membership m     = new Membership("Ordinary", 0);
                    Guest      guest = new Guest(guestTxt.Text, passportTxt.Text, s, m, false);                                                         //create guest info 1:1
                    guestList.Add(guest);                                                                                                               //add into guestList
                    string roomscheckedin = "";
                    for (var i = 0; i < tempRoomList.Count; i++)
                    {
                        HotelRoom r = tempRoomList[i];
                        r.IsAvail       = false;
                        r.NoOfOccupants = Convert.ToInt32(noOfAdultTxt.Text) + Convert.ToInt32(noOfChildrentxt.Text);
                        if (r.RoomType == "Standard")
                        {
                            HotelRoom h         = new StandardRoom(r.RoomType, r.RoomNumber, r.BedConfiguration, r.DailyRate, r.IsAvail, r.NoOfOccupants);
                            int       noOfGuest = (Convert.ToInt32(noOfAdultTxt.Text) / 2) + (Convert.ToInt32(noOfChildrentxt.Text));
                            if (noOfGuest <= r.NoOfOccupants)
                            {
                                s.AddRoom(h);
                            }
                            else
                            {
                                statusUpdateText.Text = "Add an Additional Bed\nOr Change Your Selected Choice";
                            }
                        }
                        else if (r.RoomType == "Deluxe")
                        {
                            HotelRoom h         = new DeluxeRoom(r.RoomType, r.RoomNumber, r.BedConfiguration, r.DailyRate, r.IsAvail, r.NoOfOccupants);
                            int       noOfGuest = (Convert.ToInt32(noOfAdultTxt.Text) / 2) + (Convert.ToInt32(noOfChildrentxt.Text));
                            if (noOfGuest < r.NoOfOccupants)
                            {
                                s.AddRoom(h);
                            }
                            else
                            {
                                statusUpdateText.Text = "Add an Additional Bed\nOr Change Your Selected Choice";
                            }
                        }
                        List <HotelRoom> roomList         = s.RoomList;
                        string           guestStayDetails = "";
                        foreach (HotelRoom room in roomList)
                        {
                            guestStayDetails += room.ToString() + guest.ToString();
                        }
                        roomsBookedTxt.Text = guestStayDetails;
                        roomscheckedin     += r.RoomNumber.ToString() + " ";
                    }
                    tempRoomList.Clear(); //clears the selected room list
                    RefreshList();        //refreshes room list [2.1.5]
                    statusUpdateText.Text = "Status update: Rooms" + " " + roomscheckedin + "checked in successfully.";
                    roomscheckedin        = "";
                }
                else if (check == false)                         //existing guest code goes here [2.1.6]
                {
                    for (var i = 0; i < tempRoomList.Count; i++) //loops thru the tempRoomList
                    {
                        HotelRoom r = tempRoomList[i];
                        r.IsAvail       = false;                                                                      //sets every room isAvail to false
                        r.NoOfOccupants = Convert.ToInt32(noOfAdultTxt.Text) + Convert.ToInt32(noOfChildrentxt.Text); //calculates total number of occupants
                        if (r.RoomType == "Standard")                                                                 //checks if the room is standard. if it is, create a standard room object
                        {
                            HotelRoom h = new StandardRoom(r.RoomType, r.RoomNumber, r.BedConfiguration, r.DailyRate, r.IsAvail, r.NoOfOccupants);
                            foreach (Guest g in guestList)
                            {
                                if (g.Name == guestTxt.Text)
                                {
                                    int noOfGuest = (Convert.ToInt32(noOfAdultTxt.Text) / 2) + (Convert.ToInt32(noOfChildrentxt.Text));
                                    if (noOfGuest <= r.NoOfOccupants)
                                    {
                                        g.HotelStay.AddRoom(h); //add it into the guest.RoomList
                                    }
                                    else
                                    {
                                        statusUpdateText.Text = "Add an Additional Bed\nOr Change Your Selected Choice";
                                    }
                                }
                            }
                        }
                        else if (r.RoomType == "Deluxe") //checks if the room is deluxe. if it is, create a deluxe room object
                        {
                            HotelRoom h = new DeluxeRoom(r.RoomType, r.RoomNumber, r.BedConfiguration, r.DailyRate, r.IsAvail, r.NoOfOccupants);
                            foreach (Guest g in guestList)
                            {
                                if (g.Name == guestTxt.Text)
                                {
                                    int noOfGuest = (Convert.ToInt32(noOfAdultTxt.Text) / 2) + (Convert.ToInt32(noOfChildrentxt.Text));
                                    if (noOfGuest < r.NoOfOccupants)
                                    {
                                        g.HotelStay.AddRoom(h);  //add it into the guest.RoomList
                                    }
                                    else
                                    {
                                        statusUpdateText.Text = "Add an Additional Bed\nOr Change Your Selected Choice";
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #4
0
 public void AddRoom(HotelRoom room)
 {
     roomList.Add(room);
 }