public override int GetHashCode() { return(Id.GetHashCode() ^ Name.GetHashCode() ^ NumJobs.GetHashCode() ^ SquareLogo.GetHashCode() ^ Rating.GetHashCode() ^ NumberOfReviews.GetHashCode() ^ StarImageSrc.GetHashCode() ^ ReviewsUrl.GetHashCode()); }
private Restaurant processRestaurant(HtmlNode current) { string PrimaryKey = current.CssSelect(".image.cell > a").Single().GetAttributeValue("href").Substring(@"/restaurant/".Length).Trim(); string Name = current.CssSelect(".restaurant-name").Single().InnerText.Trim(); string Score; string NumberOfReviews; HtmlNode scoreNode = current.CssSelect("dl.details.score > dd").Single(); HtmlNode scoreNodeTotal = scoreNode.CssSelect(".score-total").FirstOrDefault(); if (scoreNodeTotal != default(HtmlNode)) { Score = scoreNodeTotal.InnerText.Trim(); Score = Score.Substring(1); Score = Score.Substring(0, Score.Length - 1); NumberOfReviews = scoreNode.CssSelect(".score-description > a").Single().InnerText.Trim(); NumberOfReviews = NumberOfReviews.Remove(NumberOfReviews.Length - " reviews".Length); } else { Score = "NULL"; NumberOfReviews = "0"; } string Cuisine = current.CssSelect(".details.cuisine > dd").Single().InnerText.Trim(); if (Cuisine.ToUpper() == "BREAKFAST" || Cuisine.ToUpper() == "CAFE") { return(null); } string BestFor = current.CssSelect(".details.best-for > dd").Single().InnerText.Trim(); if (BestFor.ToUpper() == "NOT AVAILABLE") { BestFor = "NULL"; } string AvgSpend = current.CssSelect(".details.spend > dd").Single().InnerText.Trim(); if (AvgSpend.ToUpper() != "N/A") { AvgSpend = AvgSpend.Substring(1); AvgSpend = AvgSpend.Remove(AvgSpend.Length - " per person".Length).Trim(); } else { AvgSpend = "NULL"; } return(new Restaurant(PrimaryKey, Name, Score, NumberOfReviews, Cuisine, BestFor, AvgSpend)); }