예제 #1
0
  public ArrayList<itemDTO> selectByGroup(String partnerid, String itemgrop) {
    ArrayList<itemDTO> list = new ArrayList<itemDTO>();
    Cursor cursor =
        this.db.query(
            TABLE_NAME,
            new String[] {
              "user_id, date,iccid,mdn,item_name,item_code,item_group,price,maping_id,partner_id,sold"
            },
            "partner_id=? AND item_group=?  AND sold='0'",
            new String[] {String.valueOf(partnerid), String.valueOf(itemgrop)},
            null,
            null,
            "item_name asc");

    if (cursor.moveToFirst()) {
      do {
        itemDTO itm = new itemDTO();
        itm.setUser_id(cursor.getString(0));
        itm.setIccid(cursor.getString(2));
        itm.setMdn(cursor.getString(3));
        itm.setItem_name(cursor.getString(4));
        itm.setItem_code(cursor.getString(5));
        itm.setItem_group(cursor.getString(6));
        itm.setPrice(cursor.getString(7));
        itm.setItem_maping_id(cursor.getString(8));
        itm.setPartner_id(cursor.getString(9));

        list.add(itm);
      } while (cursor.moveToNext());
    }
    if (cursor != null && !cursor.isClosed()) {
      cursor.close();
    }
    return list;
  }
예제 #2
0
  public itemDTO selectByIccid(String iccid) {
    itemDTO itm = null;
    Cursor cursor =
        this.db.query(
            TABLE_NAME,
            new String[] {
              "user_id, date,iccid,mdn,item_name,item_code,item_group,price,maping_id,partner_id,sold"
            },
            "iccid=? AND sold=?",
            new String[] {String.valueOf(iccid), "0"},
            null,
            null,
            "item_name asc");

    if (cursor.moveToFirst()) {
      do {
        itm = new itemDTO();
        itm.setUser_id(cursor.getString(0));
        itm.setIccid(cursor.getString(2));
        itm.setMdn(cursor.getString(3));
        itm.setItem_name(cursor.getString(4));
        itm.setItem_code(cursor.getString(5));
        itm.setItem_group(cursor.getString(6));
        itm.setPrice(cursor.getString(7));
        itm.setItem_maping_id(cursor.getString(8));
        itm.setPartner_id(cursor.getString(9));
        if (cursor.getString(10).equalsIgnoreCase("1")) itm.setSold();
      } while (cursor.moveToNext());
    }
    if (cursor != null && !cursor.isClosed()) {
      cursor.close();
    }
    return itm;
  }
예제 #3
0
  public itemDTO getitem(String userid) {
    final Calendar dd = Calendar.getInstance();
    SimpleDateFormat da = new SimpleDateFormat("yyyy-MM-dd");
    boolean mustchange = false;
    boolean use_top = false;
    itemDTO itm = new itemDTO();
    Cursor cursor =
        this.db.query(
            TABLE_NAME,
            new String[] {
              "user_id, date,iccid,mdn,item_name,item_code,item_group,price,maping_id,partner_id"
            },
            "user_id=?",
            new String[] {String.valueOf(userid)},
            null,
            null,
            "user_id desc");
    if (cursor.moveToFirst()) {
      do {

        itm.setUser_id(cursor.getString(0));
        itm.setIccid(cursor.getString(2));
        itm.setMdn(cursor.getString(3));
        itm.setItem_name(cursor.getString(4));
        itm.setItem_code(cursor.getString(5));
        itm.setItem_group(cursor.getString(6));
        itm.setPrice(cursor.getString(7));
        itm.setItem_maping_id(cursor.getString(8));
        itm.setPartner_id(cursor.getString(9));

      } while (cursor.moveToNext());
    }
    if (cursor != null && !cursor.isClosed()) {
      cursor.close();
    }
    return itm;
  }