public List <DetalleReserva> listarDetalleXReserva(int idReserva) { ReservaDAO reservaDao = new ReservaDAO(); TarifaDAO tarifaDao = new TarifaDAO(); List <DetalleReserva> listadoDetalle = null; DetalleReserva detalle = null; string query = "Select * from Reserva_Tarifa where IdRserva=@pr1"; SqlParameter[] dbParams = new SqlParameter[] { DBHelper.MakeParam("@pr1", idReserva) }; using (SqlDataReader lector = DBHelper.ExecuteDataReader(query, dbParams)) { if (lector != null && lector.HasRows) { listadoDetalle = new List <DetalleReserva>(); while (lector.Read()) { detalle = new DetalleReserva(); detalle.Reserva = reservaDao.ObtenerReservaxId(int.Parse(lector["idRserva"].ToString())); detalle.Tarifa = tarifaDao.ObtenerTarifaxId(int.Parse(lector["idTarifa"].ToString())); detalle.HoraInicio = lector["HoraInicio"].ToString(); detalle.HoraFin = lector["HoraFin"].ToString(); detalle.Precio = double.Parse(lector["Tarifa"].ToString()); listadoDetalle.Add(detalle); } } } return(listadoDetalle); }
public bool pagarconTarjeta(Pago pago, string nroTarjeta, int idReserva) { bool reserva = false; bool exito = false; ReservaDAO reservadao = new ReservaDAO(); TarjetaDAO tarjetadao = new TarjetaDAO(); double montoAPagar = reservadao.retornarmonto(idReserva); double saldoDisponible = tarjetadao.retornarSaldoTarjeta(nroTarjeta); if (saldoDisponible > montoAPagar) { //Quitar saldo : bool resul = false; resul = tarjetadao.quitarSaldo(montoAPagar, nroTarjeta); if (resul) { //Insertar Pago : string query = "INSERT INTO Pago values(@p1,@p2,@p3,@p4)"; SqlParameter[] dbParams = new SqlParameter[] { DBHelper.MakeParam("@p1", pago.nroPago), DBHelper.MakeParam("@p2", montoAPagar), DBHelper.MakeParam("@p3", "Cancelado"), DBHelper.MakeParam("@p4", idReserva) }; exito = DBHelper.ExecuteNonQuery(query, dbParams) > 0; if (exito) { //Cancelar Reservar : reserva = reservadao.cancelarReserva(idReserva); } } } return(reserva); }
public bool reservarPagoEfectivo(Pago pago, int idReserva) { ReservaDAO reservadao = new ReservaDAO(); double montoAPagar = reservadao.retornarmonto(idReserva); bool exito = false; string query = "INSERT INTO Pago values(@p1,@p2,@p3,@p4)"; SqlParameter[] dbParams = new SqlParameter[] { DBHelper.MakeParam("@p1", pago.nroPago), DBHelper.MakeParam("@p2", montoAPagar), DBHelper.MakeParam("@p3", "Pendiente"), DBHelper.MakeParam("@p4", idReserva) }; exito = DBHelper.ExecuteNonQuery(query, dbParams) > 0; return(exito); }
public bool pagarConEfectivo(string nropago) { ReservaDAO reservadao = new ReservaDAO(); bool resul = false; int idReservaUp = retornaidReserva(nropago); bool exito = false; string query = "update Pago set estado='Cancelado' where nroPago=@pnroPago"; SqlParameter[] dbParam = new SqlParameter[] { DBHelper.MakeParam("@pnroPago", nropago) }; exito = DBHelper.ExecuteNonQuery(query, dbParam) > 0; if (exito) { //Cancelar-Reserva. resul = reservadao.cancelarReserva(idReservaUp); } return(resul); }