public BuyTicketsController(IBoxOffice boxOffice, IQuery<int, Order> ordersQuery, IQuery<int, Event> eventsQuery, IQuery<int,Ticket> ticketsQuery) { this.boxOffice = boxOffice; this.ordersQuery = ordersQuery; this.eventsQuery = eventsQuery; this.ticketsQuery = ticketsQuery; }
public BoxOffice(IBoxOffice toCopy) { if (toCopy != null) { Earnings = toCopy.Earnings; Rank = toCopy.Rank; TheaterCount = toCopy.TheaterCount; WeekendEnding = toCopy.WeekendEnding; } }
public override List <IMovie> Mine() { var result = new List <IMovie>(); var boxOfficeHistory = new List <IBoxOffice>(); string url = $"{Url}{Identifier.Replace("?ref", "weekend/?ref")}"; // Wan't only the weekend values. Daily might be handy later. var web = new HtmlWeb(); ContainsEstimates = false; var doc = web.Load(url); UrlSource = url; // Get table rows (skipping the first row - header) var tableRows = doc.DocumentNode?.SelectNodes("//table//tr[position()>1]"); if (tableRows != null) { foreach (var row in tableRows) { IBoxOffice boxOffice = null; var rowColumns = row.SelectNodes("td"); if (rowColumns != null) { int columnCount = 0; foreach (var column in rowColumns) { if (columnCount == 0) { boxOffice = new BoxOffice { WeekendEnding = ParseEndDate(HttpUtility.HtmlDecode(column.InnerText)) }; } else if (columnCount == 1) { boxOffice.Rank = Convert.ToInt32(column.InnerText); } else if (columnCount == 2) { boxOffice.Earnings = ParseEarnings(column.InnerText); } else if (columnCount == 4) { boxOffice.TheaterCount = ParseInt(column.InnerText); break; } columnCount++; } } if (boxOffice != null) { boxOfficeHistory.Add(boxOffice); } } var movie = new Movie { Identifier = Identifier }; movie.SetBoxOfficeHistory(boxOfficeHistory); result.Add(movie); // A list of one (just to conform to the miner interface) } return(result); }