Esempio n. 1
0
 public void insertPayment(Payment payment) {
   ContentValues values = new ContentValues();
   values.put("idRide1", payment.getIdRide1());
   values.put("idRide2", payment.getIdRide2());
   values.put("idRide3", payment.getIdRide3());
   values.put("sentWs", payment.isSentWs());
   db.insert("payment", null, values);
 }
Esempio n. 2
0
 public void updatePayment(Payment payment) {
   ContentValues values = new ContentValues();
   values.put("idRide1", payment.getIdRide1());
   values.put("idRide2", payment.getIdRide2());
   values.put("idRide3", payment.getIdRide3());
   values.put("sentWs", payment.isSentWs());
   db.update(
       "payment", values, "_id = ?", new String[] {String.valueOf("" + payment.getIdPayment())});
 }
Esempio n. 3
0
 public List<Payment> findAllPayments() {
   List<Payment> payments = new LinkedList<Payment>();
   String[] columms = new String[] {"_id", "idRide1", "idRide2", "idRide3", "sentWs"};
   Cursor cursor = db.query("payment", columms, null, null, null, null, null);
   if (cursor.getCount() > 0) {
     cursor.moveToFirst();
     do {
       Payment payment = new Payment();
       payment.setIdPayment(cursor.getInt(0));
       payment.setIdRide1(cursor.getInt(1));
       payment.setIdRide2(cursor.getInt(2));
       payment.setIdRide3(cursor.getInt(3));
       payment.setSentWs(cursor.getInt(4) == 1);
       payments.add(payment);
     } while (cursor.moveToNext());
   }
   return payments;
 }