package Cloud.Android.ERP;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import Cloud.Android.ERP.Common.BaseActivity;
import Cloud.Framework.Android.HttpClientHelper;
import Cloud.Framework.Android.JsonHelper;
import android.app.Activity;
import android.os.Bundle;
public class test extends BaseActivity {
//2、继承base类,第二重要 记住
JSONObject jsonData = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.newcash);
jsonData=GetJsonData("新签数据","2012-4-1","2012-5-21","1");
}
private JSONObject GetJsonData(String tabId, String sDate, String eDate,
String orgId) {
String html="";
JSONObject data = null;
String type = "0";// 新签0 续费1
String orgID = orgId;
String strBeginDate = sDate;
String strEndDate = eDate;
List<NameValuePair> paramsList = new ArrayList<NameValuePair>();
paramsList.add(new BasicNameValuePair("type", type));
paramsList.add(new BasicNameValuePair("orgID", orgID));
paramsList.add(new BasicNameValuePair("strBeginDate", strBeginDate));
paramsList.add(new BasicNameValuePair("strEndDate", strEndDate));
String urlType = "";
urlType = getString(R.string.GetNewContractTrend);
try { //1、httpClient 在base里声明,很重要,不然会无权限
html = httpClient.getStringByPost(urlType, paramsList, "utf-8");
System.out.println(html);
if (html.equals("{\"errormessage\":\"您没有访问该数据的权限!\"}")) {
return data;
}
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
} catch (IllegalStateException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
if (html != null) {
try {
data = JsonHelper.getJsonObjectFromString(html);
} catch (JSONException e) {
e.printStackTrace();
}
}
return data;
}
}
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import Cloud.Android.ERP.Common.BaseActivity;
import Cloud.Framework.Android.HttpClientHelper;
import Cloud.Framework.Android.JsonHelper;
import android.app.Activity;
import android.os.Bundle;
public class test extends BaseActivity {
//2、继承base类,第二重要 记住
JSONObject jsonData = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.newcash);
jsonData=GetJsonData("新签数据","2012-4-1","2012-5-21","1");
}
private JSONObject GetJsonData(String tabId, String sDate, String eDate,
String orgId) {
String html="";
JSONObject data = null;
String type = "0";// 新签0 续费1
String orgID = orgId;
String strBeginDate = sDate;
String strEndDate = eDate;
List<NameValuePair> paramsList = new ArrayList<NameValuePair>();
paramsList.add(new BasicNameValuePair("type", type));
paramsList.add(new BasicNameValuePair("orgID", orgID));
paramsList.add(new BasicNameValuePair("strBeginDate", strBeginDate));
paramsList.add(new BasicNameValuePair("strEndDate", strEndDate));
String urlType = "";
urlType = getString(R.string.GetNewContractTrend);
try { //1、httpClient 在base里声明,很重要,不然会无权限
html = httpClient.getStringByPost(urlType, paramsList, "utf-8");
System.out.println(html);
if (html.equals("{\"errormessage\":\"您没有访问该数据的权限!\"}")) {
return data;
}
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
} catch (IllegalStateException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
if (html != null) {
try {
data = JsonHelper.getJsonObjectFromString(html);
} catch (JSONException e) {
e.printStackTrace();
}
}
return data;
}
}