1.
holder.Confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { if (DashBoard.socketIoClass.client.connected()) { try { JSONObject object = new JSONObject(); object.put("type", "accept_takeaway_order"); JSONObject messgae = new JSONObject(); messgae.put("SocketId", DashBoard.socketIoClass.mySocketId); messgae.put("restaurant_id", DashBoard.restaurant_id); messgae.put("order_no", Integer.parseInt(tempHolder.orderat.getTag().toString())); messgae.put("user_id", DashBoard.user_id); object.put("message", messgae); DashBoard.socketIoClass.sendMessage(object); } catch (Exception ex) { } } } catch (Exception ex) { } } });
2.
if (DashBoard.socketIoClass.client.connected()) { try { int order_no = 0; OrderQuantityDialog.dismiss(); JSONObject object = new JSONObject(); object.put("type", "confirm_delivery"); JSONObject messgae = new JSONObject(); messgae.put("SocketId", DashBoard.socketIoClass.mySocketId); messgae.put("user_id", DashBoard.user_id); messgae.put("restaurant_id", DashBoard.restaurant_id); TakeAwayAdapter.MyViewHolder tempHolder = null; messgae.put("order_no", orderNo); object.put("message", messgae); DashBoard.socketIoClass.sendMessage(object); Toast.makeText(getActivity(), "Confirm Order", Toast.LENGTH_LONG).show(); } catch (Exception ex) { } }3.if (DashBoard.socketIoClass.client.connected()) {try { JSONObject object = new JSONObject(); object.put("type", "cancel_order"); JSONObject messgae = new JSONObject(); messgae.put("SocketId", DashBoard.socketIoClass.mySocketId); messgae.put("restaurant_id", DashBoard.restaurant_id); messgae.put("order_no", orderNumber); messgae.put("user_id", DashBoard.user_id); messgae.put("message", CancelMessage); object.put("message", messgae); DashBoard.socketIoClass.sendMessage(object); Toast.makeText(getActivity(), "Decline Order", Toast.LENGTH_LONG).show(); OrderQuantityDialog.dismiss(); } catch (Exception ex) { } }
No comments:
Post a Comment