Example #1
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        string currentPage = GetCurrentPage();

        if (FacetSearch.IsFacetedVisible())
        {
            uxCategoryNavList.Visible     = false;
            uxDepartmentNavList.Visible   = false;
            uxManufacturerNavList.Visible = false;
        }
        else if (currentPage.Contains("department.aspx"))
        {
            uxCategoryNavList.Visible     = false;
            uxDepartmentNavList.Visible   = true;
            uxManufacturerNavList.Visible = false;
        }
        else if (currentPage.Contains("manufacturer.aspx"))
        {
            uxCategoryNavList.Visible     = false;
            uxDepartmentNavList.Visible   = false;
            uxManufacturerNavList.Visible = true;
        }
        else
        {
            uxCategoryNavList.Visible     = true;
            uxDepartmentNavList.Visible   = false;
            uxManufacturerNavList.Visible = false;
        }
    }
Example #2
0
        private async void OnSearch()
        {
            if (!_internetService.IsInternet())
            {
                await _dialogService.ShowMessage(Resource.NoInternet, Resource.Error);

                return;
            }

            var paramters = new FacetSearch {
                Gender = SelectedGender, Facet = null, Search = FilterText
            };

            _navigationService.Navigate(Models.Enum.PageType.ArticlesSearchResult, paramters);
        }
Example #3
0
        private async void OnFacetSelected(object parameter)
        {
            if (!_internetService.IsInternet())
            {
                await _dialogService.ShowMessage(Resource.NoInternet, Resource.Error);

                return;
            }

            if (parameter is Facet)
            {
                var facet     = parameter as Facet;
                var paramters = new FacetSearch {
                    Gender = SelectedGender, Facet = facet, Search = null
                };
                _navigationService.Navigate(Models.Enum.PageType.ArticlesSearchResult, paramters);
            }
        }
Example #4
0
        public async Task Should_Return_Products_When_Search_With_Keyword()
        {
            IArticleService service = ServiceLocator.Current.GetInstance <IArticleService>();
            FacetSearch     search  = new FacetSearch
            {
                Gender = new Gender()
                {
                    Id = "male", Name = "Male"
                },
                Search = "Jeans",
                Facet  = null
            };
            var results = await service.GetFilterdArticleAsync(search, 1, 20);

            int count = results.Count;

            Assert.AreNotEqual(0, count);
        }
Example #5
0
 void LoadSearchWords(FacetSearch facetSearch)
 {
     SearchWords = new ObservableCollection <SearchWord>();
     SearchWords.Add(new SearchWord {
         Id = 1, Name = facetSearch.Gender.Name, Image = "/Assets/Icons/BothGender.png"
     });
     if (facetSearch.Facet != null)
     {
         SearchWords.Add(new SearchWord {
             Id = 2, Name = facetSearch.Facet.Name, Image = "/Assets/Icons/Filter.png"
         });
     }
     if (facetSearch.Search != null)
     {
         SearchWords.Add(new SearchWord {
             Id = 3, Name = facetSearch.Search, Image = "/Assets/Icons/Filter.png"
         });
     }
 }
Example #6
0
        public async Task Should_Not_Return_Products_When_Search_With_Invalid_Gender()
        {
            IArticleService service = ServiceLocator.Current.GetInstance <IArticleService>(); //new ArticleService(new NetworkService());
            FacetSearch     search  = new FacetSearch
            {
                Gender = new Gender()
                {
                    Id = "malee", Name = "Male"
                },
                Search = "",
                Facet  = new Facet {
                    Filter = "brand", Key = "AD1"
                }
            };
            var results = await service.GetFilterdArticleAsync(search, 1, 20);

            int count = results.Count;

            Assert.AreEqual(0, count);
        }
Example #7
0
        private async void OnIntialize(FacetSearch search)
        {
            try
            {
                if (!_internetService.IsInternet())
                {
                    await _dialogService.ShowMessage(Resource.NoInternet, Resource.Error);

                    return;
                }
                NoArticles    = false;
                Articles      = new ObservableCollection <Article>();
                FacetSearch   = search;
                IsLoading     = true;
                IsPageEnabled = false;

                LoadSearchWords(search);

                var articles = await _articleService.GetFilterdArticleAsync(FacetSearch, pageNo, pageSize);

                if (articles != null)
                {
                    NoArticles = (articles.Count == 0);
                    Articles   = new ObservableCollection <Article>(articles);
                }
                else
                {
                    NoArticles = true;
                    Articles   = new ObservableCollection <Article>();
                }
            }
            catch (System.Exception ex)
            {
                await _dialogService.ShowMessage(ex.Message, Resource.Error);
            }
            finally
            {
                IsLoading     = false;
                IsPageEnabled = true;
            }
        }
        public async Task <List <Models.Model.Article> > GetFilterdArticleAsync(FacetSearch facetSearch,
                                                                                int page, int pageSize)
        {
            string resource = "";

            if (facetSearch.Facet != null)
            {
                resource = Constant.ServiceURL.BaseUrl +
                           string.Format(Constant.ServiceURL.API_ArticlesFacet, facetSearch.Facet.Filter, facetSearch.Facet.Key, facetSearch.Gender.Id, page, pageSize);
            }
            else
            {
                resource = Constant.ServiceURL.BaseUrl +
                           string.Format(Constant.ServiceURL.API_ArticlesSearch, facetSearch.Search, facetSearch.Gender.Id, page, pageSize);
            }
            var result = await _networkService.HttpGetAsync <ArticlesResponse>(resource);

            if (result != null && result.Result != null && result.HttpResponseMessage != null && result.HttpResponseMessage.IsSuccessStatusCode)
            {
                var articles = ArticleTranslator.Translate(result.Result);
                return(articles);
            }
            return(new List <Models.Model.Article>());
        }