Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
0
        public ActionResult Index(int id)
        {
            WebService.ProductItem  item          = sv.GetProductDetail(StoreID, TokenKey, id);
            WebService.SearchResult relateProduct = sv.SearchProduct(StoreID, TokenKey, item.CatID.ToString(), "0", "0", 0, int.MaxValue, 1, 5, "", SearchOrder.TimeDesc, 0, string.Empty);
            ViewData["relateProduct"] = relateProduct;
            ViewData["prDetail"]      = item;
            ViewBag.Title             = item.PrName;

            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult Category(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.SearchProduct(StoreID, TokenKey, id.ToString(), "", "", 0, 999999, page, 14, "", SearchOrder.TimeDesc, 0);
            ViewData["productList"] = rs;
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 14, rs.ResultCount, 10, "?page=");

            if (rs != null && rs.Item.Length > 0)
            {
                ViewBag.Title = rs.Item[0].CatName;
            }

            SetupCommonProduct();
            SetUpSeo(2, id);
            return(View("List"));
        }
Ejemplo n.º 6
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.
            WebService.AnperoService sv    = new WebService.AnperoService();
            Anpero.Model.SearchModel model = new Anpero.Model.SearchModel();


            string pageQuery = Request.QueryString["page"];
            int    page      = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }

            //WebService.SearchResult rs = sv.GetProductByGroup(StoreID, TokenKey, id, page, 14, 0);
            WebService.SearchResult rs = sv.SearchProduct(StoreID, TokenKey, model.Category, "", id.ToString(), 0, int.MaxValue, page, 14, model.KeyWord, model.SortBy, 0, String.Empty);
            ViewData["productList"] = rs;
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 16, rs == null ? 0 : rs.ResultCount, 10, "?page=");

            ViewBag.isParent = "1";
            ViewBag.pageName = "Group";
            if (rs != null && rs.Item.Length > 0)
            {
                ViewBag.Title = rs.Item[0].ParentCatName;
            }

            SetUpSeo(1, id);
            return(View("List"));
        }
Ejemplo n.º 7
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());
        }
Ejemplo n.º 8
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.º 9
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.º 10
0
        public ActionResult SearchAjax(Anpero.Model.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
            //{
            rs = sv.SearchProduct(StoreID, TokenKey, model.Category.ToString(), model.ParentCategory, 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.setupAjaxPage(model.Page, model.PageSize, rs.ResultCount, 10, "Search.Products", model.SortBy);
            }
            return(PartialView("SearchAjax"));
        }
Ejemplo n.º 11
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.º 12
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.º 13
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.º 14
0
        public ActionResult Search(string category, string keyword)
        {
            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(category) && category.Contains(@"c-"))
            {
                category = category.Replace(@"c-", string.Empty);
                rs       = sv.SearchProduct(StoreID, TokenKey, "%", category, "", 0, 999999999, page, 14, keyword, SearchOrder.NameDesc, 0, string.Empty);
            }
            else
            {
                rs = sv.SearchProduct(StoreID, TokenKey, category, "", "", 0, 999999999, page, 14, keyword, SearchOrder.NameDesc, 0, string.Empty);
            }

            ViewData["productList"] = rs;
            if (rs != null)
            {
                ViewBag.page = Anpero.Paging.setUpPagedV2(page, 14, rs.ResultCount, 10, "?page=");
            }

            if (rs != null && rs.Item.Length > 0)
            {
                ViewBag.Title = rs.Item[0].CatName;
            }

            SetupCommonProduct();

            return(View("Category"));
        }
Ejemplo n.º 15
0
        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);
                }
            }
        }
Ejemplo n.º 16
0
        private void GetNewestProduct()
        {
            WebService.AnperoService service      = new WebService.AnperoService();
            WebService.SearchResult  searchResult = new WebService.SearchResult();
            int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]);

            Anpero.ICacheService cache = new Anpero.CacheService();

            if (!cache.TryGet(NewestProductCache, out searchResult))
            {
                searchResult = service.SearchProduct(StoreID, TokenKey, "", "", "", 0, int.MaxValue, 1, 7, "", SearchOrder.TimeDesc, 0, string.Empty);
                cache.AddOrUpdate(NewestProductCache, searchResult, DateTime.Now.AddMinutes(shortCacheTime));
            }

            ViewData["newestProduct"] = searchResult;
        }
Ejemplo n.º 17
0
        private void GetNewestProduct()
        {
            WebService.AnperoService service      = new WebService.AnperoService();
            WebService.SearchResult  searchResult = new WebService.SearchResult();
            if (!cacheService.TryGet("topViewProduct", out searchResult))
            {
                searchResult = service.SearchProduct(StoreID, TokenKey, "", "", "", 1, 999999999, 1, 5, "", SearchOrder.ViewTime, 0, string.Empty);
                if (searchResult != null)
                {
                    cacheService.AddOrUpdate("topViewProduct", searchResult, new TimeSpan(0, 10, 0));
                }
            }

            ViewData["topViewProduct"] = searchResult;
            //ViewData["saleProduct"] = saleProduct;
        }
Ejemplo n.º 18
0
 public ActionResult Index()
 {
     GetNewestProduct();
     SetupCommonProduct();
     SetUpSlideAds();
     WebService.SearchResult  featureleProduct;
     WebService.AnperoService sv    = new WebService.AnperoService();
     Anpero.ICacheService     cache = new Anpero.CacheService();
     if (!cache.TryGet("featureleProduct", out featureleProduct))
     {
         featureleProduct = sv.SearchProduct(StoreID, TokenKey, "", "", "", 0, 1999999990, 1, 8, "", SearchOrder.TimeDesc, 2, string.Empty);
         if (featureleProduct != null)
         {
             cache.AddOrUpdate("featureleProduct", featureleProduct, new TimeSpan(0, 10, 0));
         }
     }
     ViewData["featureleProduct"] = featureleProduct;
     return(View());
 }
Ejemplo n.º 19
0
        private void GetNewestProduct()
        {
            WebService.AnperoService service      = new WebService.AnperoService();
            WebService.SearchResult  searchResult = new WebService.SearchResult();
            int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]);

            if (HttpRuntime.Cache["newestProduct"] != null)
            {
                searchResult = (WebService.SearchResult)HttpRuntime.Cache["newestProduct"];
            }
            else
            {
                WebService.SearchModel saearchFilter = new WebService.SearchModel();
                saearchFilter.CurentPage = 1;
                saearchFilter.PageSize   = 7;
                searchResult             = service.SearchProducts(StoreID, TokenKey, saearchFilter);
                searchResult             = service.SearchProduct(StoreID, TokenKey, "0", "0", "0", 0, int.MaxValue, 1, 7, "", SearchOrder.TimeDesc, 0, "");
                if (searchResult != null)
                {
                    HttpRuntime.Cache.Insert("newestProduct", searchResult, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero);
                }
            }

            ViewData["newestProduct"] = searchResult;

            //WebService.SearchResult searchResult2 = new WebService.SearchResult();

            //if (HttpRuntime.Cache["customProduct"] != null)
            //{
            //    searchResult = (WebService.SearchResult)HttpRuntime.Cache["customProduct"];
            //}
            //else
            //{
            //    searchResult = service.GetProductByParentCategory(StoreID, TokenKey, 178, 1, 8, 0);
            //    if (searchResult != null)
            //    {
            //        HttpRuntime.Cache.Insert("customProduct", searchResult, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero);
            //    }

            //}

            //ViewData["customProduct"] = searchResult;
        }
Ejemplo n.º 20
0
        private void GetNewestProduct()
        {
            WebService.AnperoService service      = new WebService.AnperoService();
            WebService.SearchResult  searchResult = new WebService.SearchResult();
            int shortCacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["shortCacheTime"]);

            if (HttpRuntime.Cache["newestProduct"] != null)
            {
                searchResult = (WebService.SearchResult)HttpRuntime.Cache["newestProduct"];
            }
            else
            {
                searchResult = service.SearchProduct(StoreID, TokenKey, "", "", "", 0, 1999999999, 1, 5, "", SearchOrder.TimeDesc, 0, string.Empty);
                if (searchResult != null)
                {
                    HttpRuntime.Cache.Insert("newestProduct", searchResult, null, DateTime.Now.AddMinutes(shortCacheTime), TimeSpan.Zero);
                }
            }
            ViewData["newestProduct"] = searchResult;
        }
Ejemplo n.º 21
0
        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.SearchProduct(StoreID, TokenKey, id.ToString(), "", "", 0, 999999, page, 14, "", SearchOrder.TimeDesc, 0);
            ViewData["productList"] = rs;
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 14, rs.ResultCount, 10, "?page=");
            if (rs != null && rs.Item.Length > 0)
            {
                ViewBag.Title = rs.Item[0].CatName;
            }

            SetupCommonProduct();

            return(View());
        }
Ejemplo n.º 22
0
        public ActionResult Search(string category, string keyword)
        {
            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.SearchProduct(StoreID, TokenKey, category, "", "", 0, 999999999, page, 15, keyword, SearchOrder.NameDesc, 0, string.Empty);

            ViewData["productList"] = rs;
            ViewBag.pageName        = "Search";
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 15, rs.ResultCount, 10, "?page=");

            if (rs != null && rs.Item.Length > 0)
            {
                ViewBag.Title = rs.Item[0].CatName;
            }

            SetUpSeo(0, 0);
            return(View("List"));
        }
Ejemplo n.º 23
0
        public void ProcessRequest(HttpContext context)
        {
            string  rs      = "";
            string  op      = context.Request["op"];
            string  captcha = context.Request["captcha"];
            Boolean valid   = true;

            if (String.IsNullOrEmpty(captcha))
            {
                valid = false;
                rs    = "Vui lòng click vào ô kiểm tra";
            }
            if (valid)
            {
                int    st       = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["storeID"]);
                string TokenKey = System.Configuration.ConfigurationManager.AppSettings["storeTokenKey"];
                switch (op)
                {
                case "searchProduct":
                {
                    WebService.AnperoService sv = new WebService.AnperoService();
                    string order          = context.Request["order"];
                    string category       = context.Request["cat"];
                    string parentCategory = context.Request["ParentCat"];
                    WebService.SearchResult relateProduct = sv.SearchProduct(st, TokenKey, "", parentCategory, "", 0, 9999999, 1, 15, "", order, 0, string.Empty);
                    if (relateProduct.Item.Length > 0)
                    {
                        foreach (var item in relateProduct.Item)
                        {
                            rs += "<li class=\"item col-lg-4 col-md-4 col-sm-4 col-xs-6\">";
                            rs += "<div class=\"product-image\">";
                            rs += "<a href=\"" + Anpero.StringHelpper.GetProductLink(item.PrName, item.Id) + "\">";
                            rs += "<img class=\"small-image\" src=\"" + item.Images + "\">";
                            rs += "</a>";
                            rs += "</div>";
                            rs += "<div class=\"product-shop\">";
                            rs += "<h2 class=\"product-name\">";
                            rs += "<a href=\"" + Anpero.StringHelpper.GetProductLink(item.PrName, item.Id) + "\">" + item.PrName + "</a>";
                            rs += "</h2>";
                            rs += "<div class=\"desc std\">";
                            rs += "<p>" + item.ShortDesc + "</p>";
                            rs += " <p><a class=\"link-learn\"  href=\"" + Anpero.StringHelpper.GetProductLink(item.PrName, item.Id) + "\">Chi tiết</a></p>";
                            rs += "</div>";
                            rs += "<div class=\"price-box\"><p class=\"old-price\"> <span class=\"price-label\"></span><span class=\"price\">" + Anpero.StringHelpper.ConVertToMoneyFormatInt(item.Price) + "</span></p></div>";
                            rs += "<div class=\"actions\">";
                            rs += "<button class=\"button btn-cart ajx-cart\" type=\"button\"><span>Mua ngay</span></button>";
                            rs += "<span class=\"add-to-links\"><a class=\"button link-wishlist\" href=\"#\"><span>Thêm vào giỏ hàng</span></a></span>";
                            rs += "</div></div>";
                            rs += "</li>";
                        }
                    }
                    break;
                }

                case "CreateOrder":
                {
                    string name        = context.Request["name"];
                    string email       = context.Request["email"];
                    string phone       = context.Request["phone"];
                    string address     = context.Request["address"];
                    string ProductList = context.Request["ProductList"];

                    int shipingFee = 0;
                    try
                    {
                        shipingFee = Convert.ToInt32(context.Request["shipingFee"]);
                    }
                    catch (Exception)
                    {
                    }
                    string detail         = context.Request["detail"];
                    int    paymentMethod  = 0;
                    int    shippingMethod = 0;
                    try
                    {
                        paymentMethod = Convert.ToInt32(context.Request["PayMentType"]);
                    }
                    catch (Exception)
                    {
                        paymentMethod = 4;
                    }
                    try
                    {
                        shippingMethod = Convert.ToInt32(context.Request["shippingMethod"]);
                    }
                    catch (Exception)
                    {
                        shippingMethod = 1;
                    }
                    WebService.AnperoService sv = new WebService.AnperoService();
                    int rs2 = sv.AddOrder(st, TokenKey, captcha, name, email, phone, address, ProductList, shipingFee, shippingMethod, paymentMethod, detail);
                    if (rs2 > 0)
                    {
                        rs = rs2.ToString();
                    }
                    if (rs2 == -1)
                    {
                        rs = "Số điện thoại không đúng định dạng";
                    }
                    if (rs2 == -2)
                    {
                        rs = "Vui lòng kick vào ô kiểm tra";
                    }
                    break;
                }

                case "sendContact":
                {
                    string name    = context.Request["name"];
                    string email   = context.Request["email"];
                    string phone   = context.Request["phone"];
                    string address = context.Request["address"];
                    string detail  = context.Request["message"];

                    WebService.AnperoService sv = new WebService.AnperoService();
                    rs = sv.addContact(st, TokenKey, name, email, phone, address, detail, HttpContext.Current.Request.UserHostAddress, captcha).ToString();
                    break;
                }

                default:
                    break;
                }
            }

            context.Response.ContentType = "text/plain";
            context.Response.Write(rs);
        }