public int ParseForNetProductCountUnderCategory(HtmlDocument document, FoxeCategory category)
        {
            var pager = document.DocumentNode.SelectNodes("//ul[@class='pagination']");
            int firstPageProductCount = ParseForPageProductCountForCategory(document);
            int lastPageProductCount  = 0;
            int productCount          = 0;
            int pageCount             = 0;

            if (pager == null)
            {
                productCount = firstPageProductCount;
                pageCount    = 1;
            }
            else
            {
                var    pagerLastAnchor = document.DocumentNode.SelectNodes("//ul[@class='pagination']//li//a[@title='Last']");
                string pagerLastHref   = "";
                if (pagerLastAnchor != null)
                {
                    pagerLastHref = pagerLastAnchor[0].Attributes["href"].Value;
                }
                else
                {
                    var totalAnchors    = document.DocumentNode.SelectNodes("//ul[@class='pagination']//li//a").Count;
                    var pagerNextAnchor = document.DocumentNode.SelectNodes("//ul[@class='pagination']//li//a").Last();
                    pagerLastHref = pagerNextAnchor.Attributes["href"].Value;
                }

                string pattern = @"/page/(?<pageNo>\d+)/";
                Match  m       = Regex.Match(pagerLastHref, pattern);
                if (m.Success)
                {
                    pageCount = Int32.Parse(m.Groups["pageNo"].Value);
                }

                string       lastPageUrl      = CrawlerHelper.GetSchemeDomainUrl() + pagerLastHref;
                HtmlDocument lastPageDocument = new WebClientManager().DownloadHtmlDocument(lastPageUrl);
                lastPageProductCount = ParseForPageProductCountForCategory(lastPageDocument);
                productCount         = (firstPageProductCount * (pageCount - 1)) + lastPageProductCount;
            }

            category.PageCount             = pageCount;
            category.ProductCount          = productCount;
            category.FirstPageProductCount = firstPageProductCount;
            category.LastPageProductCount  = lastPageProductCount;
            return(productCount);
        }
        public IList <FoxeProduct> ParseForProductsUnderCategory(HtmlDocument document, FoxeCategory category)
        {
            IList <FoxeProduct> products = new List <FoxeProduct>();

            HtmlNodeCollection productNodes = document.DocumentNode.SelectNodes("//div[@class='row book-top']");

            foreach (var productnode in productNodes)
            {
                FoxeProduct product = new FoxeProduct();
                product.CoverPageUrl = productnode.ChildNodes["div"].ChildNodes["img"].Attributes["src"].Value;
                var          productDetailsPageUrl     = CrawlerHelper.GetSchemeDomainUrl() + productnode.Descendants("a").Last().Attributes["href"].Value;
                HtmlDocument productDetailPageDocument = new WebClientManager().DownloadHtmlDocument(productDetailsPageUrl);
                ParseProductDetailPageUpdateProduct(productDetailPageDocument, product);
                product.Category = category;
                products.Add(product);
            }
            return(products);
        }
        public int ParseForNetProductCount(HtmlDocument document)
        {
            int    lastPageNo      = 0;
            var    pagerLastAnchor = document.DocumentNode.SelectNodes("//ul[@class='pagination']//li//a[@title='Last']");
            string pagerLastHref   = pagerLastAnchor[0].Attributes["href"].Value;
            string pattern         = @"/page/(?<pageNo>\d+)/";
            Match  m = Regex.Match(pagerLastHref, pattern);

            if (m.Success)
            {
                lastPageNo = Int32.Parse(m.Groups["pageNo"].Value);
            }

            var          firstPageProductCount = ParseForPageProductCount(document);
            string       lastPageUrl           = CrawlerHelper.GetSchemeDomainUrl() + pagerLastHref;
            HtmlDocument lastPageDocument      = new WebClientManager().DownloadHtmlDocument(lastPageUrl);
            var          lastPageProductCount  = ParseForPageProductCount(lastPageDocument);
            var          netProducts           = (firstPageProductCount * (lastPageNo - 1)) + lastPageProductCount;

            return(netProducts);
        }