public PostData <L, E> GetPostData(string url, HttpTools tools) { HttpWebResponse res = Response(url, tools); if (res != null) { string json = DataSwitch.GetResponseString(res); PostData <L, E> postData = DataSwitch.JsonToObj <PostData <L, E> >(json); if (postData == null) { return(new PostData <L, E>()); } return(postData); } return(new PostData <L, E>()); }
public string GetMsg(string url, HttpTools tools) { HttpWebResponse res = Response(url, tools); if (res != null) { string json = DataSwitch.GetResponseString(res); PostData <DBNull, DBNull> postData = DataSwitch.JsonToObj <PostData <DBNull, DBNull> >(json); if (postData == null) { return(""); } return(postData.Msg); } return(""); }
public E GetEntity(string url, HttpTools tools) { HttpWebResponse res = Response(url, tools); if (res != null) { string json = DataSwitch.GetResponseString(res); PostData <DBNull, E> postData = DataSwitch.JsonToObj <PostData <DBNull, E> >(json); if (postData == null) { return(new E()); } return(postData.Entity); } return(new E()); }
public List <L> GetList(string url, HttpTools tools) { HttpWebResponse res = Response(url, tools); if (res != null) { string json = DataSwitch.GetResponseString(res); PostData <L, DBNull> postData = DataSwitch.JsonToObj <PostData <L, DBNull> >(json); if (postData == null) { return(new List <L>()); } return(postData.DList); } return(new List <L>()); }
private Stream ResponeStream(string url, HttpTools tools) { Stream s = HttpHelper.ResponseStream(url, tools.dic); return(s); }
private HttpWebResponse Response(string url, HttpTools tools) { return(HttpHelper.CreatePostHttpResponse(url, tools.dic, 3000, null)); }