private void ActualizaFilaDeListaDisponibilidad(int rowIndex) { if (rowIndex < 0 || rowIndex > this.grdListaDisponibilidad.Rows.Count) { throw new System.ArgumentOutOfRangeException( "fila fuera de rango: " + nameof(rowIndex)); } DataGridViewRow row = this.grdListaDisponibilidad.Rows[rowIndex]; Habitacion habitacion = this.habitacionesDisponibles[rowIndex]; // Assign data row.Cells[ColNum].Value = (rowIndex + 1).ToString().PadLeft(4, ' '); row.Cells[ColCliente].Value = habitacion.Identificador.ToString(); row.Cells[ColTipoHabitacion].Value = habitacion.Tipo.ToString(); row.Cells[ColComodidades].Value = habitacion.Comodidades.ToString(); row.Cells[ColUltimaReserva].Value = habitacion.FechaReserva.ToString(); // Assign tooltip text foreach (DataGridViewCell cell in row.Cells) { cell.ToolTipText = habitacion.ToString(); } return; }
private void ActualizaFilaDeListaHabitaciones(int rowIndex, List <Habitacion> habitacionesDisponibles) { if (rowIndex < 0 || rowIndex > this.grdLista.Rows.Count) { throw new System.ArgumentOutOfRangeException( "fila fuera de rango: " + nameof(rowIndex)); } DataGridViewRow row = this.grdLista.Rows[rowIndex]; Habitacion habitacion = habitacionesDisponibles[rowIndex]; // Assign data row.Cells[0].Value = habitacion.Identificador; row.Cells[1].Value = habitacion.Tipo; row.Cells[2].Value = habitacion.Comodidades; // Assign tooltip text foreach (DataGridViewCell cell in row.Cells) { cell.ToolTipText = habitacion.ToString(); } this.FilaSeleccionada(); return; }
protected void btnMostrarHabitacion_Click(object sender, EventArgs e) { int idHabitacion = Convert.ToInt32(txtMostrarHabitacion.Text); IRepositorioHabitaciones repoHab = FabricaReposBienvenidosUY.CrearRepositorioHabitacion(); Habitacion h = repoHab.FindById(idHabitacion); if (h != null) { lblMostrarHabitacion.Text = h.ToString(); } else { lblMostrarHabitacion.Text = "No hay habitaciones para mostrar."; } }
protected void btnSeleccionarHab_Click(object sender, EventArgs e) { try { if (GVHabitaciones.SelectedIndex != -1) { Hotel hot = LogicaHoteles.Buscar(GVHoteles.Rows[GVHoteles.SelectedIndex].Cells[1].Text); Habitacion hab = LogicaHabitaciones.Buscar(hot, Convert.ToInt32(GVHabitaciones.Rows[GVHabitaciones.SelectedIndex].Cells[1].Text)); lblHabitacion.Text = "Seleccion: " + hab.ToString(); btnCalcularCosto.Enabled = true; btnReservar.Enabled = false; } lblMensaje.Text = "Seleccione una habitacion primero."; } catch (Exception ex) { lblMensaje.Text = ex.Message; } }
private void ActualizarFilaLista(int numFila) { if (numFila < 0 || numFila > this.MainWindowView.GrdLista.Rows.Count) { throw new System.ArgumentOutOfRangeException("Fila fuera de rango: " + nameof(numFila)); } DataGridViewRow fila = this.MainWindowView.GrdLista.Rows[numFila]; Habitacion habitacion = this.Registro.List[numFila]; fila.Cells[0].Value = (numFila + 1).ToString().PadLeft(4, ' '); fila.Cells[1].Value = habitacion.Tipo; fila.Cells[2].Value = habitacion.FechaReserva; fila.Cells[3].Value = habitacion.Identificador; fila.Cells[4].Value = habitacion.FechaRenovacion; fila.Cells[5].Value = habitacion.Comodidades; foreach (DataGridViewCell celda in fila.Cells) { celda.ToolTipText = habitacion.ToString(); } }