public int RunWriteSQL(string apiUrl, RunSQL SQL, bool isDataEncoding = true) { string PostData = myHttp.ConvertObjToJson(SQL); if (isDataEncoding) { byte[] bytes = Encoding.UTF8.GetBytes(PostData); PostData = Convert.ToBase64String(bytes); } string jsonResult = myHttp.Post(this.UrlRoot + apiUrl + ParmEx + (isDataEncoding ? "&encoding=true" : ""), PostData); WebApiResponse <ActionResult> response = myHttp.ConvertJsonToObj <ActionResult>(jsonResult); if (response != null && response.DataList != null && response.DataList.Count > 0) { return(response.DataList[0].DoneCount); } return(0); }
public List <T> RunReadSQL <T>(string apiUrl, RunSQL SQL, bool isDataEncoding = true) { string PostData = myHttp.ConvertObjToJson(SQL); if (isDataEncoding) { byte[] bytes = Encoding.UTF8.GetBytes(PostData); PostData = Convert.ToBase64String(bytes); } string jsonResult = myHttp.Post(this.UrlRoot + apiUrl + ParmEx + (isDataEncoding?"&encoding=true":""), PostData, false); WebApiResponse <T> response = myHttp.ConvertJsonToObj <T>(jsonResult); if (response != null && response.DataList != null && response.DataList.Count > 0) { return(response.DataList); } return(new List <T>()); }