Exemplo n.º 1
0
  public boolean insert(String u_id, OrderGoods orderGoods) {
    SQLiteDatabase mDb = service.openWritableDatabase(u_id);
    ContentValues initialValues = new ContentValues();
    initialValues.put(COLUMN_SHOP_ID, orderGoods.getShopId());
    initialValues.put(COLUMN_GOODS_ID, orderGoods.getGoodsId());
    initialValues.put(COLUMN_GOODS_TYPE, orderGoods.getType());
    initialValues.put(COLUMN_GOODS_NAME, orderGoods.getName());
    initialValues.put(COLUMN_GOODS_PRICE, orderGoods.getPrice());
    initialValues.put(COLUMN_GOODS_SALE_PRICE, orderGoods.getSalePrice());
    initialValues.put(COLUMN_GOODS_NUMBER, orderGoods.getGoodsNumber());

    boolean bool = mDb.insert(TABLE_ORDER, null, initialValues) != -1;
    System.out.println("insert state:" + bool);
    mDb.close();
    service.close();
    return bool;
  }
Exemplo n.º 2
0
 public boolean deleteOrderGoodsByGoodsId(String user_id, OrderGoods orderGoods) {
   int row = 0;
   if (service.tableIsExist(user_id, TABLE_ORDER)) {
     SQLiteDatabase mDb = service.openWritableDatabase(user_id);
     String sqlString =
         COLUMN_GOODS_ID
             + "="
             + orderGoods.getGoodsId()
             + " and "
             + COLUMN_SHOP_ID
             + "=\'"
             + orderGoods.getShopId()
             + "\'";
     row = mDb.delete(TABLE_ORDER, sqlString, null);
     System.out.println("delete row:" + row);
     mDb.close();
   }
   service.close();
   return row != 0;
 }