Exemple #1
0
        public static DataTable getVewImageNewMasterDT()
        {
            Logger.Info("START Categories.getVewImageNewMasterDT()");
            try
            {
                if (CommonUtil.isCached(Constant.Table.VIEW_IMAGE_NEW_MASTER))
                {
                    Logger.Info("Fetching DT " + Constant.Table.VIEW_IMAGE_NEW_MASTER + " from Application cache");
                    return(((DataCacheDTO)HttpContext.Current.Application[Constant.Table.VIEW_IMAGE_NEW_MASTER]).Dt);
                }
                else
                {
                    Logger.Info("Fetching DT " + Constant.Table.VIEW_IMAGE_NEW_MASTER + " from DB");
                    DataTable dt = muDAO.getViewImageNewMaster();
                    CommonUtil.DtNullCheck(dt);
                    DataCacheDTO cache = new DataCacheDTO();
                    cache.CacheTime = DateTime.Now;
                    cache.Dt        = dt;
                    HttpContext.Current.Application[Constant.Table.VIEW_IMAGE_NEW_MASTER] = cache;
                    Logger.Info("END Categories.getVewImageNewMasterDT()");
                    return(dt);
                }
            }
            catch (Exception e)
            {
                Logger.Error("Error occuer Categories.getVewImageNewMasterDT() ", e);
            }
            Logger.Info("END Categories.getVewImageNewMasterDT()");

            return(null);
        }
Exemple #2
0
        public static DataTable getBanarDT()
        {
            Logger.Info("START IndexService.getBanarDT()");
            try
            {
                if (CommonUtil.isCached(Constant.Application.INDEX_BANAR_DT))
                {
                    Logger.Info("Fetching DT " + Constant.Application.INDEX_BANAR_DT + " from Application cache");
                    return(((DataCacheDTO)HttpContext.Current.Application[Constant.Application.INDEX_BANAR_DT]).Dt);
                }
                else
                {
                    Logger.Info("Fetching DT " + Constant.Application.INDEX_BANAR_DT + " from DB");
                    DataTable dt = fvDao.getallhomepagebanner();
                    CommonUtil.DtNullCheck(dt);
                    DataCacheDTO cache = new DataCacheDTO();
                    cache.CacheTime = DateTime.Now;
                    cache.Dt        = dt;
                    HttpContext.Current.Application[Constant.Application.INDEX_BANAR_DT] = cache;
                    Logger.Info("END IndexService.getBanarDT()");
                    return(dt);
                }
            }
            catch (Exception e)
            {
                Logger.Error("Error occuer IndexService.getBanarDT() ", e);
            }
            Logger.Info("END IndexService.getBanarDT()");

            return(null);
        }
Exemple #3
0
 public static bool isCached(String name)
 {
     if (!"true".Equals(ConfigUtil.getValue("cacheEnable").ToString().ToLower()))
     {
         Logger.Warning("Caching is disabled");
         return(false);
     }
     else
     {
         int          cacheExpireHour = Int32.Parse(ConfigUtil.getValue("cacheExpireHour").ToString());
         DataCacheDTO cache           = (DataCacheDTO)HttpContext.Current.Application[name];
         if (cache != null && cache.CacheTime.AddHours(cacheExpireHour).CompareTo(DateTime.Now) > 0)
         {
             return(true);
         }
         else
         {
             Logger.Warning("DT " + name + " is not cached or date is expired");
             return(false);
         }
     }
 }