//select room type & set room number protected void chooseRoom_SelectedIndexChanged(object sender, EventArgs e) { CurrentType = (RoomType.Type)chooseRoom.SelectedIndex + 1; Debug.WriteLine("selected index " + chooseRoom.SelectedIndex); int currentAddId = 1; //enable/disable extra options if (CurrentType == RoomType.Type.singleRoom) { RoomNumber.Text = "1"; Enableoptions(true, false, true, false); SetOptions(false, true, false, false); //check if aircondition is enabled for single room if (RoomOptions.Items[2].Selected) { RoomNumber.Text = "2"; currentAddId = 3; } else if (RoomOptions.Items[0].Selected) { currentAddId = 1; } currentAddId = 2; } else if (CurrentType == RoomType.Type.DoubleRoom) { RoomNumber.Text = "3"; Enableoptions(true, false, true, false); SetOptions(false, true, false, false); currentAddId = 2; } else if (CurrentType == RoomType.Type.LuxuryRoom) { RoomNumber.Text = "4"; Enableoptions(false, false, false, false); SetOptions(false, true, true, false); currentAddId = 5; } else if (CurrentType == RoomType.Type.Suite) { RoomNumber.Text = "5"; Enableoptions(false, false, false, true); SetOptions(false, true, true, false); currentAddId = 5; } UpdatePrice(currentAddId); }
//update room options data protected void RoomOptions_SelectedIndexChanged(object sender, EventArgs e) { /* * CheckBoxList1.Items[0].Selected = Golf * CheckBoxList1.Items[1].Selected = minibar * CheckBoxList1.Items[2].Selected = aircondition * CheckBoxList1.Items[3].Selected = pet */ //update price when checkboxes are changed if (RoomOptions.Items[2].Selected) { //update price with aircondition CurrentType = (RoomType.Type)chooseRoom.SelectedIndex + 1; UpdatePrice(3); } else if (!RoomOptions.Items[2].Selected) { //update price without aircondition CurrentType = (RoomType.Type)chooseRoom.SelectedIndex + 1; UpdatePrice(2); } //update price for suite if (RoomOptions.Items[3].Selected) { //update price when pet is enabled CurrentType = (RoomType.Type)chooseRoom.SelectedIndex + 1; UpdatePrice(4); } else if (!RoomOptions.Items[3].Selected) { //update price when pet is disabled CurrentType = (RoomType.Type)chooseRoom.SelectedIndex + 1; UpdatePrice(5); } }