public void Print(SummaryReportData summaryReportData, Week currentWeek) { Application excelApplication = new Application {Visible = true}; Workbook excelWorkbook = excelApplication.Workbooks.Add(1); Worksheet excelWorksheet = (Worksheet) excelWorkbook.Sheets[1]; int rowIndex = 1; excelWorksheet.Cells[rowIndex, 1] = "Strikers Bowling League"; rowIndex += 2; excelWorksheet.Cells[rowIndex, 1] = "Team Standings"; rowIndex++; excelWorksheet.Cells[rowIndex, 1] = "Team Name"; excelWorksheet.Cells[rowIndex, 2] = "Points"; rowIndex++; foreach (Team team in summaryReportData.Teams) { if (team.Name == "Sub") continue; List<WeeklyPoint> pointsPriorToThisWeek = team.WeeklyPoints.Where(p => p.Week.WeekNumber < currentWeek.WeekNumber).ToList(); double totalPoints = pointsPriorToThisWeek.Sum(p => p.Points); excelWorksheet.Cells[rowIndex, 1] = team.Name; excelWorksheet.Cells[rowIndex, 2] = totalPoints; rowIndex++; } rowIndex += 5; excelWorksheet.Cells[rowIndex, 1] = "Last Week"; excelWorksheet.Cells[rowIndex, 4] = "Year to Date"; rowIndex++; WriteIndividualHighGame(excelWorksheet, ref rowIndex, summaryReportData.LastWeekMensHighGames, summaryReportData.OverallMensHighGames, "M"); rowIndex++; WriteIndividualHighGame(excelWorksheet, ref rowIndex, summaryReportData.LastWeekWomensHighGames, summaryReportData.OverallWomensHighGames, "F"); rowIndex++; WriteIndividualHighSeries(excelWorksheet, ref rowIndex, summaryReportData.LastWeekMensHighSeries, summaryReportData.OverallMensHighSeries, "M"); rowIndex++; WriteIndividualHighSeries(excelWorksheet, ref rowIndex, summaryReportData.LastWeekWomensHighSeries, summaryReportData.OverallWomensHighSeries, "F"); }
public void PrintSummary() { PlayerStats playerStats = new PlayerStats(); List<WeeklyScore> lastWeeksScores = _allScores.Where(s => s.Week.WeekNumber == SelectedWeek.WeekNumber - 1).ToList(); List<Point> lastWeekMensHighSeries = playerStats.GetTop3HighSeriesPlayers(lastWeeksScores, "M"); List<Point> overallMensHighSeries = playerStats.GetTop3HighSeriesPlayers(_allScores, "M"); List<Point> lastWeekMensHighGames = playerStats.GetTop3HighGamePlayers(lastWeeksScores, "M"); List<Point> overallMensHighGames = playerStats.GetTop3HighGamePlayers(_allScores, "M"); List<Point> lastWeekWomensHighSeries = playerStats.GetTop3HighSeriesPlayers(lastWeeksScores, "F"); List<Point> overallWomensHighSeries = playerStats.GetTop3HighSeriesPlayers(_allScores, "F"); List<Point> lastWeekWomensHighGames = playerStats.GetTop3HighGamePlayers(lastWeeksScores, "F"); List<Point> overallWomensHighGames = playerStats.GetTop3HighGamePlayers(_allScores, "F"); SummaryReportData summaryReportData = new SummaryReportData(_teams, lastWeekMensHighSeries, overallMensHighSeries, lastWeekMensHighGames, overallMensHighGames, lastWeekWomensHighSeries, overallWomensHighSeries, lastWeekWomensHighGames, overallWomensHighGames); new PrintSummaryReport().Print(summaryReportData, SelectedWeek); }