private void button1_Click(object sender, EventArgs e) { GenerarReservaPrincipal form = new GenerarReservaPrincipal(); form.Show(); }
private void btnSeleccionar_Click(object sender, EventArgs e) { if (lblRegimenId.Text == "") { System.Windows.Forms.MessageBox.Show("Debe seleccionar un regimen para continuar con la reserva."); this.labelRegimenPendiente.ForeColor = System.Drawing.Color.Red; } else { this.labelRegimenPendiente.ForeColor = System.Drawing.Color.Black; List <Habitacion> habs = new List <Habitacion>(); decimal precioTotal = 0, maxHuespedes, recargoEstrellas; decimal precioBase = Convert.ToDecimal(lblPrecioRegimen.Text); foreach (DataGridViewRow row in dataGridView1.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { habs.Add(new Habitacion(Convert.ToInt32(row.Cells[4].Value), Convert.ToInt32(row.Cells[3].Value), Convert.ToInt32(row.Cells[1].Value))); maxHuespedes = (Convert.ToDecimal(row.Cells[5].Value)); recargoEstrellas = Convert.ToDecimal(row.Cells[8].Value) * (decimal)0.01; precioTotal += maxHuespedes * (1 + recargoEstrellas) * precioBase; } } int cantDiasReserva = (dtpFechaCheckout.Value - dtpFechaCheckin.Value).Days; precioTotal = decimal.Round(precioTotal, 2) * Convert.ToDecimal(cantDiasReserva); if (habs.Count > 0) { if (_res == null) // es nueva reserva { GenerarReservaPrincipal f2 = null; for (int i = 0; i < Application.OpenForms.Count; i++) { if (Application.OpenForms[i] is GenerarReservaPrincipal) { f2 = (GenerarReservaPrincipal)Application.OpenForms[i]; break; } } if (f2 == null) { f2 = new GenerarReservaPrincipal(); } f2.pasarReserva(new Reserva(dtpFechaCheckin.Value, dtpFechaCheckout.Value, 0, precioTotal, Convert.ToInt32(lblRegimenId.Text), Convert.ToInt32(cmbHotel.SelectedValue), habs)); ((GenerarReservaPrincipal)this.Owner).GenerarReservaPrincipal_Load(sender, e); this.Close(); f2.Show(); } else { Cliente c = (new Cliente()).getClienteById(_res.cliente_id); _res.fecha_desde = dtpFechaCheckin.Value; _res.fecha_hasta = dtpFechaCheckout.Value; _res.regimen_id = Convert.ToInt32(lblRegimenId.Text); _res.hotel_id = Convert.ToInt32(cmbHotel.SelectedValue); _res.total = precioTotal; _res.usuario_modificacion_id = 1; //Sesion.usuario.UsuarioId; _res.total = precioTotal; frmConfirmarReserva frm = new frmConfirmarReserva(c, _res, habs); frm.Owner = this; frm.Show(); } } } }