Ejemplo n.º 1
0
        public static bool findList <T>(out List <T> list_get, string url) where T : class
        {
            try
            {
                List <T> list      = new List <T>();
                Type     type      = typeof(T);
                string   className = type.Name;

                // string return_tr = HttpWebResponseUtility.GetWebRequest(Config.globalServiceURL + "service/findListByTableName/?tableName=" + className, Encoding.UTF8);
                string return_tr = HttpWebResponseUtility.GetWebRequest(url + "findListByTableName/?tableName=" + className, Encoding.UTF8);
                bool   successFlag;
                string val_first = HttpWebResponseUtility.getValueByKeyName(return_tr, out successFlag);
                if (successFlag == true)
                {
                    list     = (List <T>)JsonConvert.DeserializeObject <List <T> >(val_first);
                    list_get = list;
                    return(true);
                }
            }
            catch (Exception ce)
            {
                LogUtil.WriteLog(null, ce.Message);
            }

            list_get = null;
            return(false);
        }