示例#1
0
/*
 *      public void LoadObjectsJson(string filepath, Action< JsonListResponse<T> > onLoaded)
 *      {
 *          string content = File.ReadAllText(filepath);
 *          JsonListResponse<T> vJson = JsonConvert.DeserializeObject< JsonListResponse<T> >(content);
 *
 *          onLoaded(vJson);
 *      }
 */

        public T[] LoadObjectsJson(string filepath)
        {
            string content             = File.ReadAllText(filepath);
            JsonListResponse <T> vJson = JsonConvert.DeserializeObject <JsonListResponse <T> >(content);

            return(vJson.response);
        }
示例#2
0
        protected HttpResponseMessage toListJson <T>(PageList <T> list, OperatingState opstate, string message)
        {
            JsonListResponse response = new JsonListResponse
            {
                Message    = message,
                State      = opstate,
                PageIndex  = list.PageIndex,
                PageSize   = list.PageSize,
                TotalCount = list.TotalCount,
                TotalPages = list.TotalPages,
                DataModel  = list.Data
            };

            return(toJsonbase(response));
        }
示例#3
0
        protected HttpResponseMessage toListJson <T>(PageList <T> list)
        {
            JsonListResponse response = new JsonListResponse
            {
                Message    = "",
                State      = OperatingState.Success,
                PageIndex  = list.PageIndex,
                PageSize   = list.PageSize,
                TotalCount = list.TotalCount,
                TotalPages = list.TotalPages,
                DataModel  = list.Data
            };

            return(toJsonbase(response));
        }