Ejemplo n.º 1
0
  public ArrayList<SellInItemDTO> selectAll() {
    ArrayList<SellInItemDTO> list = new ArrayList<SellInItemDTO>();
    final Calendar dd = Calendar.getInstance();
    SimpleDateFormat da = new SimpleDateFormat("yyyy-MM-dd");

    Cursor cursor =
        this.db.query(
            TABLE_NAME,
            new String[] {"sellin_json"},
            "date like ? AND user_id=?",
            new String[] {
              String.valueOf(da.format(dd.getTime())) + "%", Contents.getLogInfo().getUserId()
            },
            null,
            null,
            "id asc");
    if (cursor.moveToFirst()) {
      do {
        SellInItemDTO jd = new SellInItemDTO();
        jd.fromJSON(cursor.getString(0));

        list.add(jd);
      } while (cursor.moveToNext());
    }
    if (cursor != null && !cursor.isClosed()) {
      cursor.close();
    }
    return list;
  }
Ejemplo n.º 2
0
  public ArrayList<SellInItemDTO> selectTemp() {
    ArrayList<SellInItemDTO> list = new ArrayList<SellInItemDTO>();

    Cursor cursor =
        this.db.query(
            TABLE_NAME,
            new String[] {"sellin_json,date,sell_in_date_time"},
            "uploaded=? AND user_id=?",
            new String[] {"0", Contents.getLogInfo().getUserId()},
            null,
            null,
            "id asc");
    if (cursor.moveToFirst()) {
      do {
        SellInItemDTO jd = new SellInItemDTO();
        jd.fromJSON(cursor.getString(0));
        jd.setDate(cursor.getString(1));
        jd.setSellInDateTime(cursor.getString(2));
        list.add(jd);
      } while (cursor.moveToNext());
    }
    if (cursor != null && !cursor.isClosed()) {
      cursor.close();
    }
    return list;
  }
Ejemplo n.º 3
0
  public long insert(SellInItemDTO _sell) {
    final Calendar dd = Calendar.getInstance();
    SimpleDateFormat da = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    _sell.setDate(String.valueOf(da.format(dd.getTime())));

    this.insertStmt.bindString(1, _sell.toJSON());
    this.insertStmt.bindString(2, "0");
    this.insertStmt.bindString(3, Contents.getLogInfo().getUserId());
    this.insertStmt.bindString(4, String.valueOf(da.format(dd.getTime())));
    this.insertStmt.bindString(5, _sell.getSellInDateTime());
    return this.insertStmt.executeInsert();
  }
Ejemplo n.º 4
0
  public ArrayList<SellInItemDTO> selectICCID(String ICCID) {
    ArrayList<SellInItemDTO> list = new ArrayList<SellInItemDTO>();
    final Calendar dd = Calendar.getInstance();
    SimpleDateFormat da = new SimpleDateFormat("yyyy-MM-dd");

    Cursor cursor =
        this.db.query(
            TABLE_NAME,
            new String[] {"sellin_json"},
            "date like ? AND user_id=?",
            new String[] {
              String.valueOf(da.format(dd.getTime())) + "%", Contents.getLogInfo().getUserId()
            },
            null,
            null,
            "id asc");
    if (cursor.moveToFirst()) {
      do {
        SellInItemDTO jd = new SellInItemDTO();
        jd.fromJSON(cursor.getString(0));
        ArrayList<String> jdi = jd.getItems();

        boolean valid = true;
        for (int i = 0; i < jdi.size(); i++) {
          if (jdi.get(i).equalsIgnoreCase(ICCID)) {
            valid = false;
            break;
          }
        }

        if (valid == false) {
          list.add(jd);
        }
      } while (cursor.moveToNext());
    }
    if (cursor != null && !cursor.isClosed()) {
      cursor.close();
    }
    return list;
  }