public static T Get <T>(string url, Object requestModel) { var requestData = requestModel == null ? "" : getUrlParams(requestModel); var uri = m_APIUrl + url + requestData; var json = SDKHttpRequest._GET(uri); if (string.IsNullOrWhiteSpace(json)) { json = "{}"; } return(MyJSONHelper.JsonToObject <T>(json)); }
public static ArrayList getArrayListFromJson(string json) { ArrayList result = null; try { result = MyJSONHelper.JsonToObject <ArrayList>(json); } catch (Exception ex) { result = new ArrayList(); } return(result); }
/// <summary> /// 绑定列表 /// </summary> /// <param name="typeid"></param> /// <param name="PageIndex"></param> /// <param name="PageSize"></param> /// <returns></returns> ///// protected string bindgoods( int companyid, int PageIndex, int PageSize) protected string bindgoods(int PageIndex, int PageSize) { int TotalRows = 0; goodsInfo goodsinfo = new goodsInfo(); //string where = BLL.DataPermissionBLL.getclientsql(companyid, ""); string where = ""; DataTable dt = goodsBLL.GetPager(PageSize, PageIndex, where, "GoodsId desc" , "GoodsId,GoodsName,Img,Price,TotalCount,ExchCount,Status,description" , ref TotalRows); string json = MyJSONHelper.GetJson_Pager(dt, TotalRows); //string json = "[{\"TotalRows\":" + TotalRows + ",\"rows\":["; //if (dt != null && dt.Rows.Count > 0) //{ // decimal price; // string imgurl; // foreach (DataRow dr in dt.Rows) // { // price = (decimal)Common.Utils.ChinaRound(Convert.ToDouble(dr["Price"]), 2); // //market = (decimal)Common.Utils.ChinaRound(Convert.ToDouble(dr["market"]), 2); // imgurl = dr["Img"].ToString(); // json += "{" + // "\"GoodsId\":\"" + dr["GoodsId"].ToString() + "\"" + // ",\"GoodsName\":\"" + Common.Utils.jsonReplace(dr["GoodsName"].ToString()) + "\"" + // ",\"img\":\"" + dr["Img"].ToString() + "\"" + // ",\"TotalCount\":\"" + dr["TotalCount"].ToString() + "\"" + // ",\"ExchCount\":\"" + Common.Utils.jsonReplace(dr["ExchCount"].ToString()) + "\"" + // ",\"Status\":\"" + dr["Status"].ToString() + "\"" + // ",\"Price\":\"" + price + "\"" + // //",\"StartDate\":\"" + dr["StartDate"].ToString() +"\"" + // //",\"EndDate\":\"" + dr["EndDate"].ToString() + "\"" + // ",\"description\":\"" + dr["description"].ToString() + "\"" + // "},"; // } //} //if (json.Trim().Length > 0 && json.Trim().EndsWith(",")) // json = json.Remove(json.Length - 1); //json += "]}]"; return(json); }