private void dtgHotel_CellClick(object sender, DataGridViewCellEventArgs e) { Int32 numero = dtgHotel.GetCellCount(DataGridViewElementStates.Selected); if (numero == 7) { codigoh = Convert.ToInt32(dtgHotel.SelectedRows[0].Cells["id"].Value.ToString()); nombreh = dtgHotel.SelectedRows[0].Cells["nombrehotl"].Value.ToString(); lugarh = dtgHotel.SelectedRows[0].Cells["lugar"].Value.ToString(); paish = dtgHotel.SelectedRows[0].Cells["nombre_pais"].Value.ToString(); precioh = Convert.ToInt32(dtgHotel.SelectedRows[0].Cells["precio_h"].Value.ToString()); alojamiento alo = new alojamiento(); try { string foto = alo.TraerInfo("SELECT foto FROM hoteles WHERE codigo = '" + dtgHotel.CurrentRow.Cells[0].Value + "'"); Bitmap foto2 = new Bitmap(foto); pictureBox1.Image = (Image)foto2; } catch (Exception er) { MessageBox.Show(er.Message); } } else { MessageBox.Show("Debe estar la fila selecciona para poder Reservar el Hotel.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) {// este evento lo que hace es mostrar la imagen del hotel en pantalla Int32 numero = dataGridView1.GetCellCount(DataGridViewElementStates.Selected); if (numero == 5) { codigo = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["CODIGO"].Value.ToString()); nombre = dataGridView1.SelectedRows[0].Cells["NOMBRE"].Value.ToString(); lugar = dataGridView1.SelectedRows[0].Cells["LUGAR"].Value.ToString(); pais = dataGridView1.SelectedRows[0].Cells["PAIS"].Value.ToString(); precio = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["PRECIO"].Value.ToString()); alojamiento alo = new alojamiento(); try { string foto = alo.TraerInfo("SELECT foto FROM hoteles WHERE codigo = '" + dataGridView1.CurrentRow.Cells[0].Value + "'"); Bitmap foto2 = new Bitmap(foto); pictureBox1.Image = (Image)foto2; } catch (Exception er) { MessageBox.Show(er.Message); } } else { MessageBox.Show("Debe estar la fila selecciona para poder Reservar el Hotel.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void Reservar() {//este metodo lo que hace es capturar la informacion de la pantanlla para guardarla en la tabla de las reservas. alojamiento alo = new alojamiento(); DateTime llegada = DateTime.Parse(dataTLlegada.Text); DateTime salida = DateTime.Parse(dateTPSalida.Text); int cantiHabitacio = Convert.ToInt32(spinnerHab.Value); int precioHotelMas13 = (((cantiHabitacio * precio) * 13) / 100) * cantidadDias; int precioTotal = precio + precioHotelMas13; try { if (cantiHabitacio == 0) { MessageBox.Show("Debe seleccionar la cantida de habitaciones.", "Avertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (codigo == 0 || nombre.Equals("") || lugar.Equals("") || pais.Equals("") || precio == 0) { MessageBox.Show("Debe seleccionar la fila del Hotel para poder Reservarlo.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { alo.InsertarReserva("INSERT INTO reservas (cedula, niños, adultos, id_hotel, total_hotel, nombre, fecha_inicio, fecha_final, fin_pais_destino, nombre_hotel, tipo_accion, canti_habitaciones) " + "VALUES ( '" + cedu + "', '" + cntMenores + "', '" + cntAdultos + "', '" + codigo + "', '" + precioTotal + "', '" + nombreuser + "', '" + dateTPSalida.Value + "', '" + dataTLlegada.Value + "', '" + pais + "', '" + nombre + "', '" + false + "', '" + cantiHabitacio + "')"); MessageBox.Show("Se ha registrado la reserva!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception error) { MessageBox.Show(error.Message); } }
public void CargarVuelo() { dataGridView1.Rows.Clear(); string ho = hoy.ToString("dd/MM/yyyy"); string[] pais1 = textBox1.Text.Split(','); string[] pais2 = textBox2.Text.Split(','); try { if (pais1[0] == pais2[0]) { MessageBox.Show("Los paises deben ser diferentes", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (dtSalida.Value.ToString() == dtLlegada.Value.ToString()) { MessageBox.Show("Debe seleecionar una Fecha", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (Convert.ToDateTime(dtSalida.Value.ToShortDateString()) < Convert.ToDateTime(ho) || Convert.ToDateTime(dtLlegada.Value.ToShortDateString()) < Convert.ToDateTime(ho)) { MessageBox.Show("Debe ingresar la fecha actual o una fecha posterior", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (cntPersonas == 0) { MessageBox.Show("Debe ingresar la cantidad de personas", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { alojamiento a = new alojamiento(); DB_Vuelos v = new DB_Vuelos(); Vuelos vue = new Vuelos(); string paiso = a.TraerInfo("SELECT pais_origen FROM rutas WHERE pais_origen = '" + pais1[0] + "'"); string paisd = a.TraerInfo("SELECT pais_destino FROM rutas WHERE pais_destino = '" + pais2[0] + "'"); string direccionEscala = v.escala_vuelo_Directo(paiso, paisd); pais = v.Escala_en_paises(paiso, paisd); escalas = v.escalas_vuelo(paisd); precios = vue.precioEscala(paisd); duracion = vue.duracionEscala(paisd); dataGridView1.Rows.Clear(); vue.mostrarInfo(dataGridView1, paiso, paisd, direccionEscala, pais, escalas, precios, duracion, cntAdultos + cntMenores, Convert.ToInt32(spinnerHab.Value.ToString())); } } catch (Exception e) { MessageBox.Show("Debe seleccionar el pais de origen " + e.Message, "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void reservar() { alojamiento alo = new alojamiento(); int preciovehi = (preciov * 13) / 100; int totalvehi = (preciovehi + preciov) * cantidadDias; int precioho = (precioh * 13) / 100; int totalhotel = (precioho + precioh) * cantidadDias; int preciovu = (preciovue * 13) / 100; int totalpreciovue = preciovue + preciovu; int totalcompra = totalvehi + totalhotel + totalpreciovue; alo.InsertarReserva("INSERT INTO reservas(ini_pais_origen, fin_pais_destino, escalas, vehiculo, total_vuelo , total_vehículo , total_hotel, total_compra, nombre, cedula, niños, adultos, id_hotel, fecha_inicio, fecha_final, nombre_hotel, tipo_accion,duracion_vuelo, canti_habitaciones)" + "VALUES('" + paisOri + "', '" + paisDes + "', '" + escalasvue + "', '" + codigov + "', '" + totalpreciovue + "', '" + totalvehi + "', '" + totalhotel + "', '" + totalcompra + "', '" + nombre1 + "', '" + cedula1 + "', '" + Convert.ToInt32(spinerMenores.Value.ToString()) + "', '" + Convert.ToInt32(spinnerAdultos.Value.ToString()) + "' , '" + codigoh + "', '" + dtLlegada.Text + "', '" + dtLlegada.Text + "', '" + nombreh + "', '" + accion + "', '" + duracionvuelo + "', '" + cantidaHabitaciones + "')"); MessageBox.Show("Se ha registrado la reserva!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void ExtraerNombre() { alojamiento alo = new alojamiento(); nombre = alo.TraerInfo("SELECT name FROM admin_user WHERE cedula = '" + usuario + "'"); }