Commit 032f2dc2 authored by melvinfonda's avatar melvinfonda
Browse files

benerin cancel offer

parent 2d331d21
......@@ -411,8 +411,23 @@ public class MySQLAccess {
//hapus data offer yang akan di cancel
preparedStatement = connect.prepareStatement("DELETE FROM offer WHERE "
+ "id_offer=" + id_offer + ";");
System.out.println(preparedStatement.toString());
preparedStatement.executeUpdate();
//masukkan kembali data offer ke inventory
int offered_item = resultSet.getInt("offered_item");
int N_offered = resultSet.getInt("n1");
preparedStatement = connect.prepareStatement("SELECT item_name FROM items WHERE id_item =" + offered_item + ";");
resultSet = preparedStatement.executeQuery();
if(resultSet.first())
{
preparedStatement = connect.prepareStatement("UPDATE inventory SET "
+ resultSet.getString("item_name").toLowerCase() + "="
+ resultSet.getString("item_name").toLowerCase() + "+" + N_offered
+ " WHERE id_user=" + userID + ";");
preparedStatement.executeUpdate();
}
response.put("status", "ok");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment