示例#1
0
        /// <summary>
        /// You can change a rooms type to a bigger room. but not to a smaller one. because it might cause problems
        /// </summary>
        private void changeroomtypebutton_Click(object sender, EventArgs e)
        {
            if (allroomslistbox.SelectedIndex == -1)
            {
                MessageBox.Show("Error. You cannot do this while an item is selected from listbox."); return;
            }
            currRoomdetail = roomMngr.GetroomdetailAt(allroomslistbox.SelectedIndex);
            if ((int)currRoomdetail.Capacity > currRoomdetail.GetCapacity((RoomType)roomtypecombobox.SelectedIndex))
            {
                MessageBox.Show("New type is smaller than before. This may cause problems with the code so you cannot do this."); return;
            }
            currRoomdetail.Roomtype = (RoomType)roomtypecombobox.SelectedIndex;
            currRoomdetail.Capacity = currRoomdetail.GetCapacity((RoomType)roomtypecombobox.SelectedIndex);

            roomMngr.ChangeElement(allroomslistbox.SelectedIndex, currRoomdetail);
            UpdateGUI();
        }
示例#2
0
 /// <summary>
 /// AddRoom button creates a new room object with empty name lastname list and adds it to the manager.
 /// </summary>
 private void addnewroombutton_Click(object sender, EventArgs e)
 {
     if (allroomslistbox.SelectedIndex != -1)
     {
         MessageBox.Show("You choose a room from the list then pressed add a room button. You cannot do that. Please unselect your choice then try again."); return;
     }
     currRoomdetail          = new roomdetail(maxnumberofpeopleinoneroom);
     currRoomdetail.Roomtype = (RoomType)roomtypecombobox.SelectedIndex;
     currRoomdetail.Capacity = currRoomdetail.GetCapacity((RoomType)roomtypecombobox.SelectedIndex);
     roomMngr.Add(currRoomdetail.Name, currRoomdetail.Lastname, currRoomdetail.Checkindate, currRoomdetail.Checkoutdate, currRoomdetail.Roomtype, currRoomdetail.Money, currRoomdetail.Capacity);
     UpdateGUI();
 }
示例#3
0
        /// <summary>
        /// if there are people in the selected room. cancels reservation by deleting everyone from that list. and refreshes checkinoutdates. if there are noone gives error.
        /// </summary>
        private void cancelreservationbutton_Click(object sender, EventArgs e)
        {
            if (allroomslistbox.SelectedIndex == -1)
            {
                MessageBox.Show("You did not choose a valid room to cancel.Error"); return;
            }

            currRoomdetail = new roomdetail(currRoomdetail.GetCapacity((RoomType)roomtypecombobox.SelectedIndex));
            currRoomdetail = roomMngr.GetroomdetailAt(allroomslistbox.SelectedIndex);
            currRoomdetail.DefaultValues();
            currRoomdetail.Roomtype = (RoomType)roomtypecombobox.SelectedIndex;
            currRoomdetail.Capacity = currRoomdetail.GetCapacity((RoomType)roomtypecombobox.SelectedIndex);
            UpdateGUI();
        }
示例#4
0
        /// <summary>
        /// generates the usual parts for object. then opens the other form and sends it to there inside as a parameter to be filled other information there.
        /// </summary>
        private void reserveroombutton_Click(object sender, EventArgs e)
        {
            if (allroomslistbox.SelectedIndex == -1)
            {
                MessageBox.Show("You did not choose a valid room to edit or reserve.Error"); return;
            }
            currRoomdetail = roomMngr.GetroomdetailAt(allroomslistbox.SelectedIndex);
            int index = allroomslistbox.SelectedIndex;

            currRoomdetail.Roomtype = (RoomType)roomtypecombobox.SelectedIndex;
            currRoomdetail.Capacity = currRoomdetail.GetCapacity((RoomType)roomtypecombobox.SelectedIndex);
            RoomDetailForm dlg       = new RoomDetailForm(currRoomdetail);
            DialogResult   dlgResult = dlg.ShowDialog();

            if (dlgResult == DialogResult.OK)
            {
                roomMngr.ChangeElement(index, currRoomdetail);
            }
            UpdateGUI();
        }
示例#5
0
        /// <summary>
        /// 4 rooms that I added for you to test the program with every property that it has.
        /// </summary>
        public void AddReadyRoomsToTest()
        {
            //test room 1
            currRoomdetail          = new roomdetail(maxnumberofpeopleinoneroom);
            currRoomdetail.Roomtype = RoomType.Single_Room;
            currRoomdetail.Capacity = currRoomdetail.GetCapacity(RoomType.Single_Room);
            roomMngr.Add(currRoomdetail);

            //test room 2
            currRoomdetail          = new roomdetail(maxnumberofpeopleinoneroom);
            currRoomdetail.Roomtype = RoomType.Double_Room;
            currRoomdetail.Capacity = currRoomdetail.GetCapacity(RoomType.Double_Room);
            currRoomdetail.AddPerson("Berkay", "KÖKSAL");
            currRoomdetail.AddPerson("Ayberk", "KÖKSAL");
            currRoomdetail.Checkindate  = DateTime.Now;
            currRoomdetail.Checkoutdate = (currRoomdetail.Checkindate.AddDays(4));
            roomMngr.Add(currRoomdetail);

            //test room 3
            currRoomdetail          = new roomdetail(maxnumberofpeopleinoneroom);
            currRoomdetail.Roomtype = RoomType.Family_Room;
            currRoomdetail.Capacity = currRoomdetail.GetCapacity(RoomType.Family_Room);
            roomMngr.Add(currRoomdetail);

            //test room 4
            currRoomdetail          = new roomdetail(maxnumberofpeopleinoneroom);
            currRoomdetail.Roomtype = RoomType.Dormitory_Room;
            currRoomdetail.Capacity = currRoomdetail.GetCapacity(RoomType.Dormitory_Room);
            currRoomdetail.AddPerson("Adrian", "Rekalde");
            currRoomdetail.AddPerson("Elisabeth", "Rouvier");
            currRoomdetail.AddPerson("Michelle", "Thompson");
            currRoomdetail.Checkindate  = DateTime.Now;
            currRoomdetail.Checkoutdate = (currRoomdetail.Checkindate.AddDays(3));
            roomMngr.Add(currRoomdetail);


            currRoomdetail = new roomdetail(maxnumberofpeopleinoneroom);
        }