private void botonModificar_Click(object sender, EventArgs e) { if (textReserva.Text == "") { showToolTip("Ingrese un número de Reserva.", textReserva, textReserva.Location); return; } Reserva reserva = DAOReserva.obtener(Int32.Parse(textReserva.Text)); if (reserva == null) { showToolTip("Número de Reserva inválido. Ingrese su número nuevamente.", textReserva, textReserva.Location); return; } if (reserva.Estado == 6) { showToolTip("Reserva ya efectivizada. No es posible modificarla.", textReserva, textReserva.Location); return; } if (reserva.Estado > 2) { showToolTip("Reserva cancelada. No es posible modificarla.", textReserva, textReserva.Location); return; } new ModificarReserva(reserva).Show(); this.Dispose(); }
private void botonBuscar_Click(object sender, EventArgs e) { if (textEstadia.Text == "") { showToolTip("Ingrese un código de estadia.", textEstadia, textEstadia.Location); return; } reserva = DAOReserva.obtener(Int32.Parse(textEstadia.Text)); if (reserva != null) { if (reserva.Estado == 6) { dataGridEstadia.DataSource = DAOConsumible.obtenerTablaByEstadia(reserva.CodigoReserva); dataGridEstadia.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridEstadia.AutoResizeColumns(); dataGridEstadia.AutoResizeRows(); } else if (reserva.Estado <= 2) { showToolTip("Reserva no efectivizada aún. Por favor, ingrese una reserva efectivizada.", textEstadia, textEstadia.Location); } else { showToolTip("Reserva Cancelada. Por favor, ingrese una reserva válida.", textEstadia, textEstadia.Location); } } else { showToolTip("Ingrese un código de estadia válido.", textEstadia, textEstadia.Location); } }
private void botonConfirmar_Click(object sender, EventArgs e) { //Efectuar Reserva if (dataGridClientes.CurrentRow == null) { MessageBox.Show("Seleccione un Cliente para confirmar la reserva.", "", MessageBoxButtons.OK); return; } int codHuesped = Convert.ToInt32(dataGridClientes.CurrentRow.Cells["idHuesped"].Value); datos_Reserva.Huesped = codHuesped; if (!DAOReserva.agregar(datos_Reserva)) { MessageBox.Show("Error al confirmar la reserva.", "", MessageBoxButtons.OK); return; } datos_Reserva.CodigoReserva = DAOReserva.obtener(datos_Reserva).CodigoReserva; //Agregamos los detalles de las habitaciones foreach (Detalle_Reserva detalle in datos_Reserva.detalles_reserva) { detalle.CodigoReserva = datos_Reserva.CodigoReserva; DAOReserva.agregarHabitacion(detalle); } MessageBox.Show("Su número de reserva es: " + datos_Reserva.CodigoReserva.ToString() + ". Recuerde el mismo, ya que identifica su reserva.", "", MessageBoxButtons.OK); Globals.habilitarAnterior(); Globals.VentanaAnterior.Dispose(); this.Close(); }
private void botonBuscar_Click(object sender, EventArgs e) { limpiar(); if (textEstadia.Text == "") { showToolTip("Ingrese un número de reserva.", textEstadia, textEstadia.Location); return; } reserva_seleccionada = DAOReserva.obtener(Int32.Parse(textEstadia.Text)); if (reserva_seleccionada == null) { showToolTip("Ingrese un número de reserva válido.", textEstadia, textEstadia.Location); return; } //DAOReserva if (reserva_seleccionada.Estado > 2 && reserva_seleccionada.Estado < 6) { MessageBox.Show("La reserva seleccionada se encuentra cancelada.", "", MessageBoxButtons.OK); return; } datos_huesped = DAOHuesped.obtener(reserva_seleccionada.Huesped); textHuesped.Text = datos_huesped.Nombre + " " + datos_huesped.Apellido; textFecReserva.Text = reserva_seleccionada.Fecha_Reserva_struct.Value.ToShortDateString(); textFecInicio.Text = reserva_seleccionada.Fecha_Inicio_struct.Value.ToShortDateString(); textFecFin.Text = reserva_seleccionada.Fecha_Fin_struct.Value.ToShortDateString(); }
private void botonBuscar_Click(object sender, EventArgs e) { if (textEstadia.Text == "") { showToolTip("Ingrese un número de estadía.", textEstadia, textEstadia.Location); return; } Factura factura = DAOEstadia.obtenerFactura(Int32.Parse(textEstadia.Text)); if (factura != null) { MessageBox.Show("Factura ya generada anteriormente. Por favor, seleccione otra Reserva", "", MessageBoxButtons.OK); return; } estadia = DAOEstadia.obtener(Int32.Parse(textEstadia.Text)); reserva = DAOReserva.obtener(Int32.Parse(textEstadia.Text)); if (estadia != null) { //Buscar y rellenar los valores dataGridFacturaEstadia.DataSource = DAOConsumible.obtenerTablaByEstadia(Int32.Parse(textEstadia.Text)); double precioConsumibles = dataGridFacturaEstadia.Rows.Cast <DataGridViewRow>().Sum(X => Convert.ToInt32(X.Cells[4].Value)); int cantPersonas_originales = DAOHabitacion.obtenerCantHabitacionesByReserva(reserva.CodigoReserva); double precioBase = Globals.obtenerPrecio(reserva.CodigoRegimen, cantPersonas_originales, Globals.infoSesion.Hotel.Recargo); mostrarDatos(precioBase, precioConsumibles); DateTime eIngreso = (DateTime)estadia.Fecha_Ingreso_struct; DateTime eEgreso = (DateTime)estadia.Fecha_Egreso_struct; DateTime rIngreso = (DateTime)reserva.Fecha_Inicio_struct; DateTime rEgreso = (DateTime)reserva.Fecha_Fin_struct; mostrarDatosEstadia(eIngreso, eEgreso, rIngreso, rEgreso); datosMostrados = true; } else { showToolTip("Ingrese un número de estadía válido.", textEstadia, textEstadia.Location); } }