Ejemplo n.º 1
0
        public void GetTopArticle()
        {
            WebService.SearchArticleResults featureArticle = new WebService.SearchArticleResults();
            WebService.SearchArticleResults topArticle     = new WebService.SearchArticleResults();
            WebService.AnperoService        service        = new WebService.AnperoService();


            if (!cache.TryGet("FeatureArticle", out featureArticle))
            {
                featureArticle = service.SearchArticle(StoreID, TokenKey, 0, 1, 4, 2);
                if (featureArticle != null)
                {
                    cache.AddOrUpdate("FeatureArticle", featureArticle, new TimeSpan(0, 10, 0));
                }
            }
            if (!cache.TryGet("topArticle", out topArticle))
            {
                topArticle = service.SearchArticle(StoreID, TokenKey, 0, 1, 8, 3);
                if (topArticle != null)
                {
                    cache.AddOrUpdate("topArticle", topArticle, new TimeSpan(0, 5, 0));
                }
            }
            ViewData["FeatureArticle"] = featureArticle;
            ViewData["topArticle"]     = topArticle;
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        public ActionResult Index()
        {
            GetNewestProduct();
            SetupCommonProduct();
            SetUpSlideAds();
            WebService.SearchResult  featureleProduct;
            WebService.AnperoService sv = new WebService.AnperoService();
            if (HttpRuntime.Cache["featureleProduct"] != null)
            {
                featureleProduct = (WebService.SearchResult)HttpRuntime.Cache["featureleProduct"];
            }
            else
            {
                featureleProduct = sv.SearchProduct(StoreID, TokenKey, "", "", "", 0, 1999999990, 1, 8, "", SearchOrder.TimeDesc, 2);
                if (featureleProduct != null)
                {
                    HttpRuntime.Cache.Insert("featureleProduct", featureleProduct, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero);
                }
            }
            ViewData["featureleProduct"] = featureleProduct;
            ViewData["Customproduct01"]  = GetCustomproduct(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Customproduct01"]));
            ViewData["Customproduct02"]  = GetCustomproduct(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Customproduct02"]));



            return(View());
        }
        private void SetUpCommonArticle()
        {
            List <WebService.BlogCategory> categoryList = null;

            WebService.AnperoService service = new WebService.AnperoService();
            if (HttpRuntime.Cache["categoryMenuList"] != null)
            {
                categoryList = (List <WebService.BlogCategory>)HttpRuntime.Cache["categoryMenuList"];
                ViewData["categoryMenuList"] = categoryList;
            }
            else
            {
                categoryList = service.GetBlogCategory(StoreID, TokenKey).ToList();
                ViewData["categoryMenuList"] = categoryList;
                if (categoryList != null)
                {
                    HttpRuntime.Cache.Insert("categoryMenuList", categoryList, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero);
                }
            }
            string categoryName = "";

            if (categoryList != null)
            {
                for (int i = 0; i < categoryList.Count; i++)
                {
                    categoryName += ", " + categoryList[i].Name;
                }
            }

            ViewBag.Description = "Tin tức |" + categoryName;
            ViewBag.Keywords    = categoryName;
            ViewBag.WebsiteUrl  = Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + "/blog";
            GetTopArticle();
        }
Ejemplo n.º 6
0
        private void GetNewestProduct()
        {
            WebService.AnperoService service = new WebService.AnperoService();
            WebService.SearchResult  BestsaleProduct;
            WebService.SearchResult  productCustom2;
            if (!cacheService.TryGet("BestsaleProduct", out BestsaleProduct))
            {
                //BestsaleProduct = service.SearchProduct(StoreID, TokenKey, "", "", "", 0, int.MaxValue, 1, 99, "", SearchOrder.TimeDesc, 2, "");
                BestsaleProduct = service.SearchProduct(StoreID, TokenKey, "2336", "", "", 0, int.MaxValue, 1, 99, "", SearchOrder.TimeDesc, 0, "");

                if (BestsaleProduct != null)
                {
                    cacheService.AddOrUpdate("BestsaleProduct", BestsaleProduct, new TimeSpan(0, 10, 0));
                }
            }
            if (!cacheService.TryGet("productCustom2", out productCustom2))
            {
                productCustom2 = service.SearchProduct(StoreID, TokenKey, "2333", "", "", 0, int.MaxValue, 1, 99, "", SearchOrder.TimeDesc, 0, "");
                if (productCustom2 != null)
                {
                    cacheService.AddOrUpdate("productCustom2", productCustom2, new TimeSpan(0, 10, 0));
                }
            }
            ViewData["productCustom2"]  = productCustom2;
            ViewData["BestsaleProduct"] = BestsaleProduct;
        }
Ejemplo n.º 7
0
        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);
                }
            }
        }
Ejemplo n.º 8
0
        //[BunderHtml]
        public ActionResult Category(int id)
        {
            string pageQuery = Request.QueryString["page"];
            int    page      = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }
            WebService.AnperoService sv = new WebService.AnperoService();
            WebService.SearchResult  rs = sv.GetProductByCategory(StoreID, TokenKey, id, page, 14, 0);
            ViewData["productList"] = rs;
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 14, rs.ResultCount, 10, "?page=");
            SetupCommonProduct();
            ProductCategory[] pc = CommontInfo.ProductCategoryList;
            if (pc != null)
            {
                foreach (var item in pc)
                {
                    if (item.ChildCategory.Length > 0)
                    {
                        foreach (var chidItem in item.ChildCategory)
                        {
                            if (chidItem.Id == id)
                            {
                                ViewBag.Title = chidItem.Name;
                                ViewBag.Desc  = chidItem.Description;
                            }
                        }
                    }
                }
            }
            return(View());
        }
Ejemplo n.º 9
0
        public ActionResult SearchAjax(WebService.SearchModel model)
        {
            model.StoreId = StoreID;
            string       pageQuery = Request.QueryString["page"];
            SearchResult rs        = new SearchResult();
            int          page      = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }
            WebService.AnperoService sv = new WebService.AnperoService();
            //if (!string.IsNullOrEmpty(model.ParentCategory) && model.ParentCategory!="0")
            //{
            //    rs = sv.GetProductByParentCategory(StoreID, TokenKey, Convert.ToInt32(model.ParentCategory), model.Page, model.PageSize, 0);
            //}
            //else if (!string.IsNullOrEmpty(model.Category) && model.Category != "0")
            //{
            //    rs = sv.GetProductByCategory(StoreID, TokenKey, Convert.ToInt32(model.Category), model.Page, model.PageSize, 0);
            //}
            //else
            //{
            sv.SearchProducts(StoreID, TokenKey, model);
            //rs = sv.SearchProduct(StoreID, TokenKey, model);
            //}
            ViewData["productList"] = rs;
            if (rs != null)
            {
                ViewBag.page = Anpero.Paging.setupAjaxPage(model.Page, model.PageSize, rs.ResultCount, 10, "Search.Products", model.SortBy);
            }
            return(PartialView("SearchAjax"));
        }
Ejemplo n.º 10
0
        public PartialViewResult GetByCategory(int id, string type = "feature")
        {
            AnperoService sv            = new WebService.AnperoService();
            SearchResult  relateProduct = new SearchResult();

            switch (type)
            {
            case "sale":
                var rs = sv.GetSaleProduct(StoreID, TokenKey);
                if (id > 0)
                {
                    rs = rs.Where(x => x.CatID == id || x.ParentId == id).ToArray();
                }
                relateProduct.Item = rs.Take(6).ToArray();
                break;

            default:
                relateProduct = sv.SearchProduct(StoreID, TokenKey, id.ToString(), "0", "0", 0, int.MaxValue, 1, 6, "", SearchOrder.TimeDesc, 2, "");

                relateProduct.Item = relateProduct.Item.Skip(1).ToArray();
                break;
            }

            if (type == "sale")
            {
                return(PartialView("GetByCategory2", relateProduct));
            }
            return(PartialView(relateProduct));
        }
Ejemplo n.º 11
0
        public ActionResult Search(Anpero.Model.SearchModel model)
        {
            string title     = "";
            string pageQuery = Request.QueryString["page"];
            string property  = Request.QueryString["property"];
            int    page      = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }
            WebService.AnperoService sv = new WebService.AnperoService();
            WebService.SearchResult  rs = sv.SearchProduct(StoreID, TokenKey, model.Category, "", model.Brands, 0, int.MaxValue, page, 14, model.KeyWord, model.SortBy, 0, property);
            ViewData["productList"] = rs;

            ViewBag.pageName = "Search";
            ViewBag.page     = Anpero.Paging.setUpPagedV2(page, 16, rs.ResultCount, 10, "?page=");

            if (!string.IsNullOrEmpty(model.KeyWord))
            {
                title += model.KeyWord;
            }
            ViewBag.property = model.Property;
            ViewBag.category = model.Category;



            ViewBag.brands = model.Brands;
            ViewBag.Title  = title;
            SetUpSeo(0, 0);
            return(View("List"));
        }
Ejemplo n.º 12
0
        public void SetupCommonProduct()
        {
            WebService.ProductItem[] saleProduct;
            WebService.SearchResult  BestsaleProduct;
            WebService.AnperoService sv = new WebService.AnperoService();
            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, 5, "", SearchOrder.TimeDesc, 1, string.Empty);
                if (BestsaleProduct != null)
                {
                    HttpRuntime.Cache.Insert("BestsaleProduct", BestsaleProduct, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero);
                }
            }
            ViewData["BestsaleProduct"] = BestsaleProduct;
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        public ActionResult SearchAjax(AnperoFrontend.Models.SearchModel model)
        {
            model.StoreId = StoreID;
            string pageQuery = Request.QueryString["page"];

            WebService.SearchResult rs;
            int page = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }
            WebService.AnperoService sv = new WebService.AnperoService();
            if (!string.IsNullOrEmpty(model.Category) && model.Category.Contains(@"c-"))
            {
                string parentCat = model.Category.Replace(@"c-", string.Empty);
                rs = sv.SearchProduct(StoreID, TokenKey, "0", parentCat, model.GroupId, model.PriceFrom, model.PriceTo, model.Page, model.PageSize, model.KeyWord, model.SortBy, 0, string.Empty);
            }
            else
            {
                rs = sv.SearchProduct(StoreID, TokenKey, model.Category.ToString(), "0", model.GroupId, model.PriceFrom, model.PriceTo, model.Page, model.PageSize, model.KeyWord, model.SortBy, 0, string.Empty);
            }

            ViewData["productList"] = rs;
            if (rs != null)
            {
                ViewBag.page = Anpero.Paging.setUpPagedV2(model.Page, model.PageSize, rs.ResultCount, 10, "?page=");
            }
            return(PartialView("SearchAjax"));
        }
Ejemplo n.º 15
0
        public ActionResult Group(int id)
        {
            Response.AppendHeader("Cache-Control", "max-age=1200,stale-while-revalidate=3600"); // HTTP 1.1.
            Response.AppendHeader("Pragma", "no-cache");                                        // HTTP 1.0.
            string pageQuery = Request.QueryString["page"];
            int    page      = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }
            WebService.AnperoService sv = new WebService.AnperoService();
            WebService.SearchResult  rs = sv.GetProductByGroup(StoreID, TokenKey, id, page, 14, 0);
            ViewData["productList"] = rs;
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 14, rs == null ? 0 : rs.ResultCount, 10, "?page=");

            ViewBag.isParent = "1";
            if (rs != null && rs.Item.Length > 0)
            {
                ViewBag.Title = rs.Item[0].ParentCatName;
            }
            SetupCommonProduct();
            SetUpSeo(1, id);
            return(View("Category"));
        }
Ejemplo n.º 16
0
        public void ProcessRequest(HttpContext context)
        {
            WebService.Location[] LocationList = null;
            string LocationListHtml            = "";

            WebService.AnperoService sv = new WebService.AnperoService();
            try
            {
                int ParentLocationId = Convert.ToInt32(context.Request["ParentLocationId"]);
                LocationList = sv.GetLocation(ParentLocationId);
                if (ParentLocationId == 0)
                {
                    LocationListHtml += "<option value='0'>Thành phố/Tỉnh</option>";
                }
                else
                {
                    LocationListHtml += "<option value='0'>Quận/Huyện</option>";
                }
            }
            catch (Exception)
            {
                LocationList = sv.GetLocation(0);
                throw;
            }
            if (LocationList != null && LocationList.Length > 0)
            {
                foreach (WebService.Location item in LocationList)
                {
                    LocationListHtml += "<option value='" + item.Id + "'>" + item.Name + "</option>";
                }
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(LocationListHtml);
        }
Ejemplo n.º 17
0
        public ActionResult Search(AnperoFrontend.Models.SearchModel model)
        {
            model.StoreId  = StoreID;
            model.PageSize = 14;
            string pageQuery = Request.QueryString["page"];

            WebService.SearchResult rs;
            int page = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }
            WebService.AnperoService sv = new WebService.AnperoService();
            if (!string.IsNullOrEmpty(model.Category) && model.Category.Contains(@"c-"))
            {
                model.Category = model.Category.Replace(@"c-", string.Empty);
                rs             = sv.SearchProduct(StoreID, TokenKey, "%", model.Category.ToString(), model.GroupId, model.PriceFrom, model.PriceTo, model.Page, model.PageSize, model.KeyWord, model.SortBy, 0, string.Empty);
            }
            else
            {
                rs = sv.SearchProduct(StoreID, TokenKey, model.Category.ToString(), "", model.GroupId, model.PriceFrom, model.PriceTo, model.Page, model.PageSize, model.KeyWord, model.SortBy, 0, string.Empty);
            }
            ViewData["productList"] = rs;
            if (rs != null)
            {
                ViewBag.page = Anpero.Paging.setUpPagedV2(page, 14, rs.ResultCount, 10, "?page=");
            }
            ViewBag.Title = "Tìm kiếm sản phẩm";
            SetupCommonProduct();

            return(View("Category", model));
        }
Ejemplo n.º 18
0
 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();
 }
Ejemplo n.º 19
0
        public void SetupCommonData(ActionExecutedContext filterContext)
        {
            int    shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]);
            int    StoreID        = CommonConfig.StoreID;
            string TokenKey       = CommonConfig.TokenKey;

            WebService.ProductItem[] saleProduct;
            WebService.SearchResult  BestsaleProduct;
            WebService.AnperoService sv = new WebService.AnperoService();


            if (!cacheService.TryGet("BestsaleProduct", out BestsaleProduct))
            {
                //BestsaleProduct = sv.SearchProductFullData(StoreID, TokenKey, "0", "0", "0", 0, 99999999, 1, 7, "", SearchOrder.TimeDesc,2, true);
                BestsaleProduct = sv.SearchProduct(StoreID, TokenKey, "", "", "", 0, int.MaxValue, 1, 99, "", SearchOrder.TimeDesc, 2, "");
                if (BestsaleProduct != null)
                {
                    cacheService.AddOrUpdate("BestsaleProduct", BestsaleProduct, new TimeSpan(0, 10, 0));
                }
            }
            if (!cacheService.TryGet("SaleProduct", out saleProduct))
            {
                saleProduct = sv.GetSaleProduct(StoreID, TokenKey).Take(6).ToArray();

                if (saleProduct != null)
                {
                    cacheService.AddOrUpdate("SaleProduct", saleProduct, new TimeSpan(0, 99, 0));
                }
            }
            filterContext.Controller.ViewData["saleProduct"]     = saleProduct;
            filterContext.Controller.ViewData["BestsaleProduct"] = BestsaleProduct;
            GetTopArticle(filterContext, shortCacheTime);
            //slide of list product page
        }
Ejemplo n.º 20
0
 public ActionResult Faq()
 {
     WebService.AnperoService sv = new WebService.AnperoService();
     WebService.SearchResult  rs = sv.GetProductByCategory(StoreID, TokenKey, 2332, 1, 100, 0);
     SetUpSeo(2, 2332);
     return(View(rs));
 }
Ejemplo n.º 21
0
        public IReadOnlyCollection <SitemapNode> GetSitemapNodes(string baseUrl)
        {
            List <SitemapNode> nodes = new List <SitemapNode>();

            if (HttpRuntime.Cache["commonInfo"] != null)
            {
                AnperoFrontend.WebService.Webconfig commontData = (AnperoFrontend.WebService.Webconfig)HttpRuntime.Cache["commonInfo"];
            }
            else
            {
                WebService.AnperoService service = new WebService.AnperoService();
                var rs = service.GetCommonConfig(CommonConfig.StoreID, CommonConfig.TokenKey);
                if (rs != null)
                {
                    HttpRuntime.Cache.Insert("commonInfo", rs, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero);
                }
            }
            nodes.Add(
                new SitemapNode()
            {
                Url      = baseUrl,
                Priority = 1
            });
            //nodes.Add(
            //   new SitemapNode()
            //   {
            //       Url = urlHelper.AbsoluteRouteUrl("HomeGetAbout"),
            //       Priority = 0.9
            //   });

            return(nodes);
        }
Ejemplo n.º 22
0
 public ContentResult Css()
 {
     Response.AppendHeader("Cache-Control", "max-age=1200,stale-while-revalidate=3600"); // HTTP 1.1.
     Response.AppendHeader("Pragma", "no-cache");                                        // HTTP 1.0.
     Response.AppendHeader("Cache-Control", "public");
     Response.AppendHeader("Content-Type", "text/css");
     WebService.AnperoService service = new WebService.AnperoService();
     return(Content(service.GetWebContent(StoreID, TokenKey, 7), "text/css"));
 }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
        public ActionResult Index()
        {
            WebService.AnperoService service = new WebService.AnperoService();

            GetNewestProduct();
            SetupCommonProduct();
            GetTopArticle();
            SetUpSlideAds();
            return(View());
        }
Ejemplo n.º 25
0
 public ActionResult Index(int id)
 {
     WebService.AnperoService sv            = new WebService.AnperoService();
     WebService.ProductItem   item          = sv.GetProductDetail(StoreID, TokenKey, id);
     WebService.SearchResult  relateProduct = sv.SearchProduct(StoreID, TokenKey, item.CatID.ToString(), "", "", 0, 999999, 1, 5, "", SearchOrder.TimeDesc, 0, string.Empty);
     ViewData["relateProduct"] = relateProduct;
     ViewBag.Title             = item.PrName;
     SetupCommonProduct();
     return(View(item));
 }
Ejemplo n.º 26
0
        public ActionResult Index()
        {
            Response.AppendHeader("Cache-Control", "max-age=1200,stale-while-revalidate=3600"); // HTTP 1.1.
            Response.AppendHeader("Pragma", "no-cache");                                        // HTTP 1.0.

            WebService.AnperoService service = new WebService.AnperoService();
            GetNewestProduct();
            SetUpSlideAds();
            return(View());
        }
Ejemplo n.º 27
0
 public ActionResult Index()
 {
     WebService.AnperoService service = new WebService.AnperoService();
     GetNewestProduct();
     SetupCommonProduct();
     GetTopArticle();
     SetUpSlideAds();
     ViewBag.storeId  = StoreID;
     ViewBag.TokenKey = TokenKey;
     return(View());
 }
Ejemplo n.º 28
0
 public string PolicyAjax(int type)
 {
     try
     {
         WebService.AnperoService service = new WebService.AnperoService();
         return(service.GetWebContent(StoreID, TokenKey, type));
     }
     catch (Exception)
     {
         return("Nội dung đang được cập nhật");
     }
 }
Ejemplo n.º 29
0
        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());
        }
Ejemplo n.º 30
0
 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);
     //ViewData["AdsSlide2"] = service.GetAdsSlide(StoreID, TokenKey, PageContent.Ads2);
     ViewBag.pageName = "home";
     //GetNewestProduct();
     //SetupCommonProduct();
     GetTopArticle();
     SetUpSlideAds(PageContent.Slide + "," + PageContent.Ads1 + "," + PageContent.Ads2 + "," + PageContent.Ads3);
     return(View());
 }