Exemplo n.º 1
0
        public static List <Business.CountryName> Load(string langCode)
        {
            QuickCacheHandler cacheHandler = new QuickCacheHandler("CountryNames" + langCode);

            cacheHandler.AlternateCacheMinutes = 60;
            cacheHandler.ItemPriority          = System.Web.Caching.CacheItemPriority.BelowNormal;

            List <Business.CountryName> list = cacheHandler.Get() as List <Business.CountryName>;

            if (list != null)
            {
                return(list);
            }

            list = new List <Business.CountryName>();
            SqlDataReader sqlReader = null;

            try
            {
                sqlReader = GetReader(langCode);
                if (sqlReader != null)
                {
                    while (sqlReader.Read())
                    {
                        Business.CountryName item = new Business.CountryName();
                        FillObject(item, sqlReader);
                        list.Add(item);
                    }
                }
            }
            finally
            {
                if (sqlReader != null)
                {
                    sqlReader.Close();
                }
                sqlReader = null;
            }

            cacheHandler.Insert(list);
            return(list);
        }
Exemplo n.º 2
0
 private static void FillObject(Business.CountryName item, SqlDataReader sqlReader)
 {
     item.Name        = sqlReader["CountryName"].ToString();
     item.LangCode    = sqlReader["LangCode"].ToString();
     item.CountryCode = sqlReader["CountryCode"].ToString();
 }