private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex.Equals(1)) { int row = e.RowIndex; DataGridViewRow selectedRow = dataGridView1.Rows[row]; darBajaHabitacion baja = new darBajaHabitacion(); HabitacionElegida habitacion = new HabitacionElegida(); habitacion.SetHabiID(Int32.Parse(selectedRow.Cells[9].Value.ToString())); habitacion.SetNumero(Int32.Parse(selectedRow.Cells[2].Value.ToString())); baja.EnviarNumeroHabitacion(habitacion.GetHabiID(), habitacion.GetNumero(), this); baja.ShowDialog(); } if (e.ColumnIndex.Equals(0)) { //this.Hide(); int row = e.RowIndex; int tieneVista = 0; int estaHabilitado = 0; DataGridViewRow selectedRow = dataGridView1.Rows[row]; int piso = this.mapearPiso(selectedRow); HabitacionElegida habitacion = new HabitacionElegida(); //System.Windows.Forms.MessageBox.Show(dataGridView1.Columns.Count.ToString()); habitacion.SetNumero(Int32.Parse(selectedRow.Cells[2].Value.ToString())); if (piso.Equals(0)) { habitacion.SetPiso(Int32.Parse(selectedRow.Cells[3].Value.ToString())); } else { habitacion.SetPiso(piso); } habitacion.SetDescripcion(selectedRow.Cells[4].Value.ToString()); habitacion.SetTipo(selectedRow.Cells[5].Value.ToString()); habitacion.SetDireccion(selectedRow.Cells[6].Value.ToString()); habitacion.SetHabiID(Int32.Parse(selectedRow.Cells[9].Value.ToString())); habitacion.SetHotelID(this.ObtenerHotelID(habitacion)); if (selectedRow.Cells[6].Value.Equals(true)) { tieneVista = 1; } if (selectedRow.Cells[7].Value.Equals(true)) { estaHabilitado = 1; } habitacion.SetVista(tieneVista); habitacion.SetHabilitado(estaHabilitado); modificarDatosHabitacioncs modifDatos = new modificarDatosHabitacioncs(); modifDatos.RecibirHabitacion(habitacion); modifDatos.ShowDialog(); } }
public void RecibirHabitacion(HabitacionElegida habitacion) { this.habitacionID = habitacion.GetHabiID(); this.hotel_ID = habitacion.GetHotelID(); this.habitacionNumero = habitacion.GetNumero(); this.labelHotelActual.Text = habitacion.GetDireccion().ToString(); this.labelPisoEnHotel.Text = habitacion.GetPiso().ToString(); this.piso = Int32.Parse(habitacion.GetPiso().ToString()); if (habitacion.GetDescripcion().ToString().Equals("")) { this.labelDescripcionActual.Text = "(vacio)"; this.descripcion = ""; } else { this.descripcion = habitacion.GetDescripcion().ToString(); this.labelDescripcionActual.Text = habitacion.GetDescripcion().ToString(); } if (habitacion.GetHabilitado().Equals(1)) { this.radioButtonHabilitadoSI.Checked = true; this.labelHabilitadoActualmente.Text="Sí"; } else { this.radioButtonHabilitadoNO.Checked = true; this.labelHabilitadoActualmente.Text="No"; } if (habitacion.GetVista().Equals(1)) { this.radioButtonVistaSI.Checked = true; this.labelTieneVistaExterior.Text="Sí"; } else { this.radioButtonVistaNO.Checked = true; this.labelTieneVistaExterior.Text = "No"; } this.labelNumeroHabitacionActual.Text = habitacion.GetNumero().ToString(); this.numeroHabitacion = Int32.Parse(habitacion.GetNumero().ToString()); }