Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }