Exemplo n.º 1
0
  public Ticket get(int id) {
    Cursor c = dbData.Select("Select * from Invoice where Id=" + id);
    Ticket ticket = null;
    if (c != null) {
      if (c.moveToFirst()) {
        ticket = new Ticket();
        ticket.id = c.getInt(c.getColumnIndex("id"));
        ticket.productId = c.getString(c.getColumnIndex("productId"));
        ticket.dateCreate = c.getLong(c.getColumnIndex("dateCreate"));
        ticket.dateUpdate = c.getLong(c.getColumnIndex("dateUpdate"));
        ticket.dateDelete = c.getLong(c.getColumnIndex("dateDelete"));
      }
    }

    return ticket;
  }
Exemplo n.º 2
0
  public ArrayList<Ticket> get() {
    ArrayList<Ticket> tickets = new ArrayList<Ticket>();
    Cursor c = dbData.Select("Select * from Ticket");

    if (c != null) {
      if (c.moveToFirst())
        do {
          Ticket ticket = new Ticket();
          ticket.id = c.getInt(c.getColumnIndex("id"));
          ticket.productId = c.getString(c.getColumnIndex("productId"));
          ticket.dateCreate = c.getLong(c.getColumnIndex("dateCreate"));
          ticket.dateUpdate = c.getLong(c.getColumnIndex("dateUpdate"));
          ticket.dateDelete = c.getLong(c.getColumnIndex("dateDelete"));

          tickets.add(ticket);

        } while (c.moveToNext());
      c.close();
    }
    return tickets;
  }