示例#1
0
  protected void modifyJiage() {

    String PriceHour, PriceMonth;

    if (MyTextUtils.isEmpty(etPriceHour.getText().toString())) {
      ToastUtils.showSuperToastComment(getApplicationContext(), "时租价格不能为空");
      return;
    } else {
      PriceHour = etPriceHour.getText().toString();
    }

    if (MyTextUtils.isEmpty(etPriceMonth.getText().toString())) {
      ToastUtils.showSuperToastComment(getApplicationContext(), "月租价格不能为空");
      return;
    } else {
      PriceMonth = etPriceMonth.getText().toString();
    }

    String url;

    url = PathConfig.ADDRESS + "/base/breleasepark/setPrice";
    url = MyTextUtils.urlPlusFoot(url);

    Map<String, String> params = new HashMap<String, String>();
    params.put("Code", detailMap.get("CODE"));
    params.put("PriceHour", PriceHour);
    params.put("PriceMonth", PriceMonth);

    Request<JSONObject> request =
        new VolleyCommonPost(
            url,
            new Response.Listener<JSONObject>() {
              @Override
              public void onResponse(JSONObject response) {
                String jsondata = response.toString();
                Map<String, String> message =
                    JSON.parseObject(jsondata, new TypeReference<Map<String, String>>() {});

                if (message.get("status").equals("true")) {
                  dismissDialog();
                  finish();
                  ToastUtils.showSuperToastAlertGreen(ModifyParkJiaGe.this, message.get("info"));
                } else {
                  ToastUtils.showSuperToastAlert(ModifyParkJiaGe.this, message.get("info"));
                  finish();
                }
              }
            },
            new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                dismissDialog();
                ToastUtils.showSuperToastAlert(ModifyParkJiaGe.this, "连接服务器失败,请稍后重试!");
              }
            },
            params);
    request.setRetryPolicy(new DefaultRetryPolicy(200 * 1000, 1, 1.0f));
    ApplicationController.getInstance().addToRequestQueue(request);
  }
示例#2
0
  private void getParkInfo() {

    String url = PathConfig.ADDRESS + "/base/breleasepark/info?code=" + code;
    url = MyTextUtils.urlPlusAndFoot(url);
    StringRequest stringRequest =
        new StringRequest(
            url,
            new Response.Listener<String>() {
              @Override
              public void onResponse(String response) {
                String jsondata = response.toString();
                detailMap =
                    JSON.parseObject(jsondata, new TypeReference<HashMap<String, String>>() {});

                etPriceHour.setText(detailMap.get("PRICE_HOUR"));
                etPriceMonth.setText(detailMap.get("PRICE_MONTH"));
              }
            },
            new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {}
            });
    ApplicationController.getInstance().addToRequestQueue(stringRequest);
  }