Пример #1
0
  /**
   * 回调业务逻辑
   *
   * @param back
   * @return
   */
  protected <T> T callBack(int type, DaoCallBack<T> back) {
    T result = null;
    SQLiteDatabase conn = null;
    try {

      switch (type) {
        case TYPE_READ:
          conn = sqlConnection.getReadableDatabase();
          break;
        case TYPE_WRITE:
          conn = sqlConnection.getWritableDatabase();
          break;
      }
      if (conn == null) throw new NullPointerException("SQLiteDatabase conn  is null");
      result = back.invoke(conn);
      // conn.beginTransaction();
      // conn.setTransactionSuccessful();
    } catch (Exception e) {
      // conn.endTransaction();
      Logger.e(TAG, e);
    } finally {
      DBUtil.Release(conn, cursor);
    }
    return result;
  }
 private void loadViewLayout() {
   setHeadLeftVisibility(View.VISIBLE);
   setHeadBackgroundResource(R.drawable.head_bg);
   selectedBottomTab(Constant.HOME);
   orderId = getIntent().getStringExtra("orderId");
   Logger.d(TAG, orderId);
 }
 @Override
 public UserModel parseJSON(String paramString) throws JSONException {
   if (super.checkResponse(paramString) != null) {
     Logger.d(TAG, "解析Userinfo数据");
     JSONObject json = new JSONObject(paramString);
     String useinfoObj = json.getString("userinfo");
     UserModel userInfoList = JSON.parseObject(useinfoObj, UserModel.class);
     return userInfoList;
   }
   return null;
 }
  // 当异步请求信息从服务器端返回时,回调此方法
  @Override
  public void responseString(String responseText) {
    closeProgressDialog();
    Logger.d(TAG, responseText);
    try {
      // 解析
      serverResponseDataMap = (Map<String, Object>) requestModel.jsonParser.parseJSON(responseText);
      Logger.i(TAG, serverResponseDataMap.size() + "");
    } catch (JSONException e) {
      Logger.e(TAG, e.getLocalizedMessage(), e);
    }
    if (serverResponseDataMap != null) {
      AddressModel address_info = (AddressModel) serverResponseDataMap.get("addressInfo");
      OrderInfoModel orderInfo = (OrderInfoModel) serverResponseDataMap.get("orderInfo");
      PaymentModel paymentInfo = (PaymentModel) serverResponseDataMap.get("paymentInfo");
      DeliveryModel deliveryInfo = (DeliveryModel) serverResponseDataMap.get("deliveryInfo");
      InvoiceInfoModel invoiceInfo = (InvoiceInfoModel) serverResponseDataMap.get("invoiceInfo");
      productlistInfo = (List<CartProductModel>) serverResponseDataMap.get("productlistInfo");
      List<String> checkout = (List<String>) serverResponseDataMap.get("checkout");
      CheckoutAddupModel checkoutAdd =
          (CheckoutAddupModel) serverResponseDataMap.get("checkoutAdd");

      textAdress1.setText(address_info.getId() + "");
      textAdress2.setText(address_info.getName() + "");
      textAdress3.setText(address_info.getAddress_area() + "");
      textAdress4.setText(address_info.getAddress_detail() + "");

      textDetail1.setText(orderInfo.getStatus() + "");
      textDetail2.setText(deliveryInfo.getType() + "");
      textDetail3.setText(paymentInfo.getType() + "");
      textDetail4.setText(orderInfo.getTime() + "");
      textDetail5.setText(deliveryInfo.getType() + "");
      textDetail7.setText(invoiceInfo.getTitle() + "");

      textPrice2.setText(checkoutAdd.getTotal_price() + "");
      textPrice3.setText(checkoutAdd.getProm_cut() + "");
      textPrice4.setText(checkoutAdd.getFreight() + "");
      textPrice6.setText(checkoutAdd.getTotal_point() + "");
      textPrice7.setText(checkoutAdd.getTotal_price() - checkoutAdd.getProm_cut() + "");
    }
  }