コード例 #1
0
        /// <summary>
        /// Fetch the banners displayed on the home page
        /// </summary>
        /// <returns></returns>
        private BannersList FetchAndCacheBanners()
        {
            BannersList bannersList = new BannersList();

            try
            {
                if (Session["BannersList"] == null)
                {
                    //IDAL dal = (new DALFactory()).GetInstance();
                    SharePointDAL dal = new SharePointDAL();
                    bannersList.BannersListdetails = dal.GetBanners();
                    Session["BannersList"]         = bannersList;
                }
                else
                {
                    bannersList = (BannersList)Session["BannersList"];
                }
            }
            catch (Exception ex)
            {
                UserManager user = (UserManager)Session["CurrentUser"];
                LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, user.EmailID.ToString(), AppConstant.ApplicationName, "Home,FetchAndCacheBanners", ex.Message, ex.StackTrace));
            }
            return(bannersList);
        }
コード例 #2
0
        //[OutputCache(Duration = 600, VaryByCustom = "User", VaryByParam = "", Location = OutputCacheLocation.Server, NoStore = false)]
        public ActionResult Home()
        {
            IDAL dal = (new DALFactory()).GetInstance();

            CacheSiteMenu();

            dal.CacheConfig();

            CacheLogo();

            BannersList bannersList  = null;
            string      bannerSource = ConfigurationManager.AppSettings["BannerSource"].ToString();

            if (bannerSource.Equals("SharePoint"))
            {
                bannersList = FetchAndCacheBanners();
            }

            return(View(bannersList));
        }