Ejemplo n.º 1
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);
        }
 /// <summary>
 /// add person button will check if name or lastname is empty or not. if they both are valid it will add this to room object. then it will take dates and other details.
 /// </summary>
 private void addpersonbutton_Click(object sender, EventArgs e)
 {
     if (costumerslistbox.SelectedIndex != -1)
     {
         MessageBox.Show("Error. You choose someone from the listbox then clicked add. You cannot do that."); return;
     }
     if (checkinputinformation())
     {
         if (m_roomdetail.CurrentNumOfCostumers() < m_roomdetail.Capacity)
         {
             m_roomdetail.AddPerson(costumernametextbox.Text, costumerlastnametextbox.Text);
             m_roomdetail.Checkindate  = checkindatetimepicker.Value;
             m_roomdetail.Checkoutdate = checkoutdatetimepicker.Value;
         }
         else
         {
             MessageBox.Show("This room has reached its limit please check your execution.");
         }
         UpdateGUI();
     }
 }