예제 #1
0
        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>());
        }
예제 #2
0
        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());
        }
예제 #3
0
        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("");
        }
예제 #4
0
        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>());
        }