Example #1
0
  public OfferSaveWS() {
    // JSON object to hold the information, which is sent to the server
    jsonObjectSend = new JSONObject();

    // To construct the jsonObject header
    HttpClient.constructHeader(jsonObjectSend);
  }
Example #2
0
  public void saveOfferWithRoutes(
      Offer offer, Route route, Integer idCustomerAccount, Integer isDriver) {
    List<NameValuePair> paramsToPost = new ArrayList<NameValuePair>();

    paramsToPost.add(new BasicNameValuePair("idCustomerAccount", idCustomerAccount.toString()));
    paramsToPost.add(new BasicNameValuePair("isDriver", isDriver.toString()));

    paramsToPost.add(new BasicNameValuePair("description", offer.getDescription()));
    paramsToPost.add(
        new BasicNameValuePair("numberOfPassengers", offer.getNumberOfPlaceInitial().toString()));
    paramsToPost.add(
        new BasicNameValuePair("pricePerPassenger", offer.getPricePerPassenger().toString()));

    paramsToPost.add(new BasicNameValuePair("startingCity", route.getStartingCity().toString()));
    paramsToPost.add(new BasicNameValuePair("finishingCity", route.getFinishingCity().toString()));
    // paramsToPost.add(new BasicNameValuePair("price", route.getPrice().toString()));

    // Send the HTTP request
    HttpClient.SendHttpPost(URL, jsonObjectSend, paramsToPost);
  }