示例#1
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"));
        }
        public ActionResult SearchAjax(Anpero.Model.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"));
        }
        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"));
        }
        public ActionResult Search(Anpero.Model.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));
        }