Exemplo n.º 1
0
        public ActionResult SearchAjax(AnperoFrontend.Models.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);
            }

            //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"));
        }
Exemplo 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"));
        }
Exemplo n.º 3
0
        public ActionResult Search(AnperoFrontend.Models.SearchModel model)
        {
            string pageQuery = Request.QueryString["page"];
            int    page      = 1;

            if (!string.IsNullOrEmpty(pageQuery))
            {
                page = Convert.ToInt32(pageQuery);
            }
            ViewBag.property = model.Property;
            ViewBag.brands   = model.Brands;
            ViewBag.category = model.Category;

            WebService.SearchResult rs = sv.SearchProduct(StoreID, TokenKey, model.Category, "", "", 0, int.MaxValue, page, 14, model.KeyWord, model.SortBy, 0, model.Property);
            ViewData["productList"] = rs;
            ViewBag.pageName        = "Search";
            ViewBag.page            = Anpero.Paging.setUpPagedV2(page, 14, rs.ResultCount, 10, "?page=");
            if (rs != null && rs.Item.Length > 0)
            {
                ViewBag.Title = rs.Item[0].CatName;
            }
            SetUpAds();
            SetUpSeo(0, 0);
            return(View("List"));
        }
Exemplo n.º 4
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));
        }