private void SetUpSlideAds() { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); WebService.Ads[] Slide = null; WebService.Ads[] Ads3 = null; //slide home back-ground if (!base.cache.TryGet(PageContent.Slide, out Slide)) { Slide = service.GetAdsSlide(StoreID, TokenKey, PageContent.Slide); cache.AddOrUpdate(PageContent.Slide, Slide, new TimeSpan(0, shortCacheTime, 0)); } if (!base.cache.TryGet(PageContent.Ads3, out Ads3)) { Ads3 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads3); cache.AddOrUpdate(PageContent.Ads3, Ads3, new TimeSpan(0, shortCacheTime, 0)); } ViewData["slide"] = Slide; ViewData["Ads3"] = Ads3; Response.Cache.SetCacheability(HttpCacheability.Public); }
private void SetUpSlideAds() { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); WebService.Ads[] Slide = null; WebService.Ads[] Ads2 = null; WebService.Ads[] Ads3 = null; WebService.Ads[] Ads4 = null; if (!base.cacheService.TryGet("Slide", out Slide)) { Slide = service.GetAdsSlide(StoreID, TokenKey, PageContent.Slide); cacheService.AddOrUpdate("Slide", Slide, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } if (!base.cacheService.TryGet("Ads2", out Ads2)) { Ads2 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads2); cacheService.AddOrUpdate("Ads2", Ads2, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } if (!base.cacheService.TryGet("Ads3", out Ads3)) { Ads3 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads3); cacheService.AddOrUpdate("Ads3", Ads3, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } if (!base.cacheService.TryGet("Ads4", out Ads4)) { Ads4 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads4); cacheService.AddOrUpdate("Ads4", Ads4, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } //WebService.Ads[] ads3 = null; //if (HttpRuntime.Cache["ads3"] != null) //{ // ViewData["ads3"] = (WebService.Ads[])HttpRuntime.Cache["ads3"]; //} //else //{ // ads3 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads3); // ViewData["ads3"] = ads3; // if (Slide != null) // { // HttpRuntime.Cache.Insert("Ads2", ads3, null, DateTime.Now.AddMinutes(shortCacheTime + 3), TimeSpan.Zero); // } //} ViewData["slide"] = Slide; ViewData["ads2"] = Ads2; ViewData["ads3"] = Ads3; ViewData["ads4"] = Ads4; Response.Cache.SetCacheability(HttpCacheability.Public); }
public ActionResult Index() { WebService.AnperoService service = new WebService.AnperoService(); ViewData["slide"] = service.GetAdsSlide(StoreID, TokenKey, PageContent.Slide); ViewData["AdsSlide"] = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads1); GetNewestProduct(); SetupCommonProduct(); GetTopArticle(); return(View()); }
private void SetUpSlideAds() { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); WebService.Ads[] Slide = null; if (HttpRuntime.Cache["Slide"] != null) { ViewData["slide"] = (WebService.Ads[])HttpRuntime.Cache["Slide"]; } else { Slide = service.GetAdsSlide(StoreID, TokenKey, PageContent.Slide); ViewData["slide"] = Slide; if (Slide != null) { HttpRuntime.Cache.Insert("Slide", Slide, null, DateTime.Now.AddMinutes(shortCacheTime + 3), TimeSpan.Zero); } } WebService.Ads[] Ads1 = null; if (HttpRuntime.Cache["AdsSlide"] != null) { ViewData["AdsSlide"] = (WebService.Ads[])HttpRuntime.Cache["AdsSlide"]; } else { Ads1 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads1); ViewData["AdsSlide"] = Ads1; if (Ads1 != null) { HttpRuntime.Cache.Insert("AdsSlide", Ads1, null, DateTime.Now.AddMinutes(shortCacheTime + 2), TimeSpan.Zero); } } WebService.Ads[] Ads2 = null; if (HttpRuntime.Cache["Ads2"] != null) { ViewData["AdsSlide2"] = (WebService.Ads[])HttpRuntime.Cache["Ads2"]; } else { Ads2 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads2); ViewData["AdsSlide2"] = Ads2; if (Ads2 != null) { HttpRuntime.Cache.Insert("Ads2", Ads2, null, DateTime.Now.AddMinutes(shortCacheTime + 1), TimeSpan.Zero); } } //Response.Cache.SetExpires(DateTime.Now.AddMinutes(60)); Response.Cache.SetCacheability(HttpCacheability.Public); }
public override void OnActionExecuted(ActionExecutedContext filterContext) { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); SetupCommonData(filterContext); if (HttpRuntime.Cache["commonInfo"] != null) { filterContext.Controller.ViewData["commonInfo"] = HttpRuntime.Cache["commonInfo"]; } else { var rs = service.GetCommonConfig(CommonConfig.StoreID, CommonConfig.TokenKey); filterContext.Controller.ViewData["commonInfo"] = rs; if (rs != null) { HttpRuntime.Cache.Insert("commonInfo", rs, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero); } } //WebService.Ads[] Ads5 = null; //if (!cacheService.TryGet("Ads5", out Ads5)) //{ // Ads5 = service.GetAdsSlide(CommonConfig.StoreID, CommonConfig.TokenKey, PageContent.Ads5); // cacheService.AddOrUpdate("Ads5", Ads5, new TimeSpan(0, 0, 10, 0, 0)); //} //filterContext.Controller.ViewData["ads5"] = Ads5; WebService.Ads[] ads1 = null; if (!cacheService.TryGet("ads1", out ads1)) { ads1 = service.GetAdsSlide(CommonConfig.StoreID, CommonConfig.TokenKey, PageContent.Ads1); cacheService.AddOrUpdate("ads1", ads1, new TimeSpan(0, 0, 10, 0, 0)); } filterContext.Controller.ViewData["ads1"] = ads1; WebService.Ads[] ads4 = null; if (!cacheService.TryGet("ads4", out ads4)) { ads1 = service.GetAdsSlide(CommonConfig.StoreID, CommonConfig.TokenKey, PageContent.Ads4); cacheService.AddOrUpdate("ads4", ads1, new TimeSpan(0, 0, 10, 0, 0)); } filterContext.Controller.ViewData["ads4"] = ads4; WebService.Ads[] Ads2 = null; if (!cacheService.TryGet("Ads2", out Ads2)) { Ads2 = service.GetAdsSlide(CommonConfig.StoreID, CommonConfig.TokenKey, PageContent.Ads2); cacheService.AddOrUpdate("Ads2", Ads2, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } filterContext.Controller.ViewData["ads2"] = Ads2; }
private void SetUpCommonArticle() { WebService.AnperoService service = new WebService.AnperoService(); WebService.Ads[] Slide = null; if (HttpRuntime.Cache["categoryMenuList"] != null) { ViewData["categoryMenuList"] = (List <WebService.BlogCategory>)HttpRuntime.Cache["categoryMenuList"]; } else { List <WebService.BlogCategory> categoryList = service.GetBlogCategory(StoreID, TokenKey).ToList(); ViewData["categoryMenuList"] = categoryList; if (categoryList != null) { HttpRuntime.Cache.Insert("categoryMenuList", categoryList, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero); } } if (HttpRuntime.Cache["slide3"] != null) { ViewData["slide3"] = (WebService.Ads[])HttpRuntime.Cache["slide3"]; } else { Slide = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads3); ViewData["slide3"] = Slide; if (Slide != null) { HttpRuntime.Cache.Insert("slide3", Slide, null, DateTime.Now.AddMinutes(shortCacheTime + 6), TimeSpan.Zero); } } GetTopArticle(); }
private void SetUpSlideAds(string adsList) { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); string[] ads = adsList.Split(','); foreach (var item in ads) { WebService.Ads[] Slide = null; if (HttpRuntime.Cache[item] != null) { ViewData[item] = (WebService.Ads[])HttpRuntime.Cache[item]; } else { Slide = service.GetAdsSlide(StoreID, TokenKey, item); ViewData[item] = Slide; if (Slide != null) { HttpRuntime.Cache.Insert(item, Slide, null, DateTime.Now.AddMinutes(shortCacheTime + 3), TimeSpan.Zero); } } } //Response.Cache.SetExpires(DateTime.Now.AddMinutes(60)); Response.Cache.SetCacheability(HttpCacheability.Public); }
public override void OnActionExecuted(ActionExecutedContext filterContext) { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); if (HttpRuntime.Cache["commonInfo"] != null) { Webconfig rs = (Webconfig)HttpRuntime.Cache["commonInfo"]; filterContext.Controller.ViewData["commonInfo"] = rs; } else { Webconfig rs = service.GetCommonConfig(CommonConfig.StoreID, CommonConfig.TokenKey); filterContext.Controller.ViewData["commonInfo"] = rs; if (rs != null) { HttpRuntime.Cache.Insert("commonInfo", rs, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero); } } WebService.Ads[] AdsSlide3 = null; if (HttpRuntime.Cache["AdsSlide3"] != null) { filterContext.Controller.ViewData["AdsSlide3"] = (WebService.Ads[])HttpRuntime.Cache["AdsSlide3"]; } else { AdsSlide3 = service.GetAdsSlide(CommonConfig.StoreID, CommonConfig.TokenKey, PageContent.Ads3); filterContext.Controller.ViewData["AdsSlide3"] = AdsSlide3; if (AdsSlide3 != null) { HttpRuntime.Cache.Insert("AdsSlide3", AdsSlide3, null, DateTime.Now.AddMinutes(shortCacheTime + 1), TimeSpan.Zero); } } }
private void SetUpSlideAds() { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); WebService.Ads[] Slide = null; WebService.Ads[] Ads1 = null; WebService.Ads[] Ads2 = null; WebService.Ads[] Ads3 = null; WebService.Ads[] Ads4 = null; if (!base.cacheService.TryGet("Slide", out Slide)) { Slide = service.GetAdsSlide(StoreID, TokenKey, PageContent.Slide); cacheService.AddOrUpdate("Slide", Slide, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } if (!base.cacheService.TryGet("Ads1", out Ads1)) { Ads1 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads1); cacheService.AddOrUpdate("Ads1", Ads1, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } if (!base.cacheService.TryGet("Ads2", out Ads2)) { Ads2 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads2); cacheService.AddOrUpdate("Ads2", Ads2, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } if (!base.cacheService.TryGet("Ads3", out Ads3)) { Ads3 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads3); cacheService.AddOrUpdate("Ads3", Ads3, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } if (!base.cacheService.TryGet("Ads4", out Ads4)) { Ads4 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads4); cacheService.AddOrUpdate("Ads4", Ads4, new TimeSpan(0, 0, shortCacheTime, 0, 0)); } ViewData["slide"] = Slide; ViewData["ads1"] = Ads1; ViewData["ads2"] = Ads2; ViewData["ads3"] = Ads3; ViewData["ads4"] = Ads4; Response.Cache.SetCacheability(HttpCacheability.Public); }
private void SetUpSlideAds() { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); WebService.Ads[] Slide; WebService.Ads[] ads1; WebService.Ads[] ads2; //WebService.Ads[] ads3; Anpero.ICacheService cache = new Anpero.CacheService(); if (!cache.TryGet(SlideCache, out Slide)) { Slide = service.GetAdsSlide(StoreID, TokenKey, PageContent.Slide); cache.AddOrUpdate(SlideCache, Slide, DateTime.Now.AddMinutes(shortCacheTime)); } if (!cache.TryGet(Ads1Cache, out ads1)) { ads1 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads1); cache.AddOrUpdate(Ads1Cache, ads1, DateTime.Now.AddMinutes(shortCacheTime)); } if (!cache.TryGet(Ads2Cache, out ads2)) { ads2 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads2); cache.AddOrUpdate(Ads2Cache, ads2, DateTime.Now.AddMinutes(shortCacheTime)); } //if (!cache.TryGet(Ads3Cache, out ads3)) //{ // ads3 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads3); // cache.AddOrUpdate(Ads3Cache, ads3, DateTime.Now.AddMinutes(shortCacheTime)); //} ViewBag.Slide = Slide; ViewBag.Ads1 = ads1; ViewBag.Ads2 = ads2; // ViewBag.Ads3 = ads3; Response.Cache.SetCacheability(HttpCacheability.Public); }
public void SetupCommonProduct() { WebService.ProductItem[] saleProduct; WebService.SearchResult BestsaleProduct; WebService.AnperoService sv = new WebService.AnperoService(); WebService.Ads[] Slide = null; if (HttpRuntime.Cache["saleProduct"] != null) { saleProduct = (WebService.ProductItem[])HttpRuntime.Cache["saleProduct"]; } else { saleProduct = sv.GetSaleProduct(StoreID, TokenKey); if (saleProduct != null) { HttpRuntime.Cache.Insert("saleProduct", saleProduct, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero); } } ViewData["saleProduct"] = saleProduct; if (HttpRuntime.Cache["BestsaleProduct"] != null) { BestsaleProduct = (WebService.SearchResult)HttpRuntime.Cache["BestsaleProduct"]; } else { BestsaleProduct = sv.SearchProduct(StoreID, TokenKey, "", "", "", 0, 99999999, 1, 7, "", SearchOrder.TimeDesc, 1); if (BestsaleProduct != null) { HttpRuntime.Cache.Insert("BestsaleProduct", BestsaleProduct, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero); } } ViewData["BestsaleProduct"] = BestsaleProduct; //slide of list product page if (HttpRuntime.Cache["slide3"] != null) { ViewData["slide3"] = (WebService.Ads[])HttpRuntime.Cache["slide3"]; } else { Slide = sv.GetAdsSlide(StoreID, TokenKey, PageContent.Ads3); ViewData["slide3"] = Slide; if (Slide != null) { HttpRuntime.Cache.Insert("slide3", Slide, null, DateTime.Now.AddMinutes(shortCacheTime + 6), TimeSpan.Zero); } } }
private void SetUpAds() { WebService.Ads[] ads4 = null; if (HttpRuntime.Cache["ads4"] != null) { ViewData["ads4"] = (WebService.Ads[])HttpRuntime.Cache["ads4"]; } else { ads4 = sv.GetAdsSlide(StoreID, TokenKey, PageContent.Ads4); ViewData["ads4"] = ads4; if (ads4 != null) { HttpRuntime.Cache.Insert("ads4", ads4, null, DateTime.Now.AddMinutes(shortCacheTime + 3), TimeSpan.Zero); } } }
public override void OnActionExecuted(ActionExecutedContext filterContext) { WebService.AnperoService service = new WebService.AnperoService(); Anpero.ICacheService cacheService = new Anpero.CacheService(); Webconfig config = new Webconfig(); WebService.Ads[] Slide = null; WebService.Ads[] AdsSlide = null; WebService.SearchArticleResults FeatureArticle = new WebService.SearchArticleResults(); int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); if (!cacheService.TryGet("commonInfo", out config)) { config = service.GetCommonConfig(CommonConfig.StoreID, CommonConfig.TokenKey); cacheService.AddOrUpdate("commonInfo", config, new TimeSpan(0, 6, 0)); } if (!cacheService.TryGet("Slide", out Slide)) { Slide = service.GetRandomAdsSlide(CommonConfig.StoreID, CommonConfig.TokenKey, PageContent.Slide, 1); cacheService.AddOrUpdate("Slide", Slide, new TimeSpan(0, 6, 0)); } if (!cacheService.TryGet("AdsSlide", out AdsSlide)) { AdsSlide = service.GetAdsSlide(CommonConfig.StoreID, CommonConfig.TokenKey, PageContent.Ads1); cacheService.AddOrUpdate("AdsSlide", AdsSlide, new TimeSpan(0, 6, 0)); } if (!cacheService.TryGet("FeatureArticle", out FeatureArticle)) { FeatureArticle = service.SearchArticle(CommonConfig.StoreID, CommonConfig.TokenKey, 0, 1, 5, 1); cacheService.AddOrUpdate("FeatureArticle", FeatureArticle, new TimeSpan(0, 6, 0)); } filterContext.Controller.ViewData["slide"] = Slide; filterContext.Controller.ViewData["FeatureArticle"] = FeatureArticle; filterContext.Controller.ViewData["AdsSlide"] = AdsSlide; filterContext.Controller.ViewData["commonInfo"] = config; }
private void SetUpSlideAds() { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); WebService.Ads[] Slide = null; //slide home back-ground if (HttpRuntime.Cache["Slide"] != null) { ViewData["slide"] = (WebService.Ads[])HttpRuntime.Cache["Slide"]; } else { Slide = service.GetAdsSlide(StoreID, TokenKey, PageContent.Slide); ViewData["slide"] = Slide; if (Slide != null) { HttpRuntime.Cache.Insert("Slide", Slide, null, DateTime.Now.AddMinutes(shortCacheTime + 3), TimeSpan.Zero); } } Response.Cache.SetCacheability(HttpCacheability.Public); }
private void SetUpSlideAds() { int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]); WebService.AnperoService service = new WebService.AnperoService(); WebService.Ads[] Slide = null; //slide home back-ground if (HttpRuntime.Cache["Slide"] != null) { ViewData["slide"] = (WebService.Ads[])HttpRuntime.Cache["Slide"]; } else { Slide = service.GetAdsSlide(StoreID, TokenKey, PageContent.Slide); ViewData["slide"] = Slide; if (Slide != null) { HttpRuntime.Cache.Insert("Slide", Slide, null, DateTime.Now.AddMinutes(shortCacheTime + 3), TimeSpan.Zero); } } //Slide home six img WebService.Ads[] Ads1 = null; if (HttpRuntime.Cache["AdsSlide"] != null) { ViewData["AdsSlide"] = (WebService.Ads[])HttpRuntime.Cache["AdsSlide"]; } else { Ads1 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads1); ViewData["AdsSlide"] = Ads1; if (Ads1 != null) { HttpRuntime.Cache.Insert("AdsSlide", Ads1, null, DateTime.Now.AddMinutes(shortCacheTime + 2), TimeSpan.Zero); } } //img best-pro get one slide WebService.Ads[] Ads2 = null; if (HttpRuntime.Cache["AdsSlide2"] != null) { ViewData["AdsSlide2"] = (WebService.Ads[])HttpRuntime.Cache["Ads2"]; } else { Ads2 = service.GetRandomAdsSlide(StoreID, TokenKey, PageContent.Ads2, 1); ViewData["AdsSlide2"] = Ads2; if (Ads2 != null) { HttpRuntime.Cache.Insert("Ads2", Ads2, null, DateTime.Now.AddMinutes(shortCacheTime + 1), TimeSpan.Zero); } } //branch home WebService.Ads[] Ads5 = null; if (HttpRuntime.Cache["slide5"] != null) { ViewData["slide5"] = (WebService.Ads[])HttpRuntime.Cache["slide5"]; } else { Ads5 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads5); ViewData["slide5"] = Ads5; if (Ads5 != null) { HttpRuntime.Cache.Insert("slide5", Ads5, null, DateTime.Now.AddMinutes(shortCacheTime + 1), TimeSpan.Zero); } } //customer comment home WebService.Ads[] Ads6 = null; if (HttpRuntime.Cache["slide6"] != null) { ViewData["slide6"] = (WebService.Ads[])HttpRuntime.Cache["slide6"]; } else { Ads6 = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads6); ViewData["slide6"] = Ads6; if (Ads6 != null) { HttpRuntime.Cache.Insert("slide6", Ads6, null, DateTime.Now.AddMinutes(shortCacheTime + 1), TimeSpan.Zero); } } Response.Cache.SetCacheability(HttpCacheability.Public); }