private void Availeble_Rooms_gridView_SelectionChanged(object sender, EventArgs e) { //Enable Texboxes and reservsation button tb_RoomName.Enabled = true; tB_HotelName.Enabled = true; tb_RoomType.Enabled = true; button_Reservation.Enabled = true; foreach (DataGridViewRow row in availeble_Rooms_gridView.Rows) { if (row.Selected) { //fills the texboxes and a reserve room variabl ewith th acontents of current selected room try { tb_RoomName.Text = row.Cells["Room Name"].Value.ToString(); tb_RoomType.Text = row.Cells["Family Room"].Value.ToString(); tB_HotelName.Text = row.Cells[2].Value.ToString(); ReserveRoom.Room_Name = row.Cells["Room Name"].Value.ToString(); ReserveRoom.FamilyType = row.Cells["Family Room"].Value.ToString(); ReserveRoom.Hotel_ID = Int32.Parse(row.Cells["Hotel ID"].Value.ToString()); ReserveRoom.Status = row.Cells["Status"].Value.ToString(); ReserveRoom.Room_ID = Int32.Parse(row.Cells["RoomID"].Value.ToString()); ReserveRoom.Price = Int32.Parse(row.Cells["Price($)"].Value.ToString()); FormCollection fc = Application.OpenForms; //TO DO: Actualizarea datelor din formul de realizare de rezervari fara a deshide din nou acel form + LOG mesages foreach (Form frm in fc) { if (frm.Name == "ReserveRoom") { frm.Close(); ReserveRoom RR = new ReserveRoom(comboBox_Country.Text); RR.Show(); break; } } break; } catch (OracleException ex) { DAL.Log.LogMessage(ex); } } } }
private void Button_Reservation_Click(object sender, EventArgs e) { panel_for_current_selected.Location = new Point(0, button_Reservation.Location.Y); ReserveRoom rooms = new ReserveRoom(comboBox_Country.Text); FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { if (frm.Name == "ReserveRoom") { frm.Close(); break; } } rooms.Show(); }