Esempio n. 1
0
        //Search button Click, it will search for rooms thats is available in the given time date
        protected void SearchBtn_Click(object sender, EventArgs e)
        {
            if (startDatePicker.SelectedDate != new DateTime() && endDatePicker.SelectedDate != new DateTime())
            {
                List <string> additions = new List <string>();

                if (cb_balcony.Checked)
                {
                    additions.Add("Altan");
                }
                if (DoubleBed.Checked)
                {
                    additions.Add("Dobbeltseng");
                }
                if (TwoBeds.Checked)
                {
                    additions.Add("2 enkeltsenge");
                }
                if (cb_bathtub.Checked)
                {
                    additions.Add("Badekar");
                }
                if (cb_jacuzzi.Checked)
                {
                    additions.Add("Jacuzzi");
                }
                if (cb_kitchen.Checked)
                {
                    additions.Add("Eget køkken");
                }

                List <Room>    rooms        = reception.GetAvailableRooms(additions, startDatePicker.SelectedDate, endDatePicker.SelectedDate);
                SearchResult[] searchResult = new SearchResult[rooms.Count];

                for (int i = 0; i < rooms.Count; i++)
                {
                    searchResult[i] = new SearchResult(rooms[i], (int)(endDatePicker.SelectedDate - startDatePicker.SelectedDate).TotalDays);
                }
                RoomListView.DataSource = searchResult;
                RoomListView.DataBind();
            }
        }