public void Make() { var sheetDictionary = new Dictionary <string, DataTable>(); int sheetCounter = 0; foreach (var contest in contests) { DataTable table = new DataTable(); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Organization", typeof(string)); table.Columns.Add("Parent Organization", typeof(string)); table.Columns.Add("Performance Description", typeof(string)); foreach (var contestant in new ReportContestantsProvider().GetReportContestants(contest)) { var performers = ServiceFactory.PerformerService.GetContestantPerformers(contestant.ContestantId); var firstPerformer = performers.FirstOrDefault(); string organizationName = ""; string parentOrganizationName = ""; if (firstPerformer != null) { organizationName = firstPerformer.Affiliation.Name; if (firstPerformer.Affiliation.Parent != null) { parentOrganizationName = firstPerformer.Affiliation.Parent.Name; } } table.Rows.Add( contestant.Name, organizationName, parentOrganizationName, contestant.PerformanceDescription); } sheetCounter++; sheetDictionary.Add(sheetCounter + " - " + contest.Name + " (" + contest.Id + ")", table); } byte[] excelBytes = new ExcelDocumentMaker().MakeNewExcelPackage(sheetDictionary); ExcelHttpResponseUtil.MakeResponse(excelBytes, "ContestantAffiliationReport"); }
public void Make() { DataTable table = new DataTable(); table.Columns.Add("Contest Name", typeof(string)); table.Columns.Add("Contestant ID", typeof(int)); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Performance Description", typeof(string)); table.Columns.Add("Performance Duration", typeof(string)); table.Columns.Add("Total Score", typeof(double)); table.Columns.Add("Penalty Points", typeof(double)); table.Columns.Add("Final Score", typeof(double)); table.Columns.Add("Lowest Score", typeof(double)); table.Columns.Add("Sum of Top Scores", typeof(double)); table.Columns.Add("Number of Score Cards", typeof(double)); table.Columns.Add("Number of Judges", typeof(double)); table.Columns.Add("Scores", typeof(string)); table.Columns.Add("Organization", typeof(string)); table.Columns.Add("Parent Organization", typeof(string)); foreach (var contest in contests) { foreach (var contestant in new ReportContestantsProvider().GetReportContestants(contest)) { table.Rows.Add( contest.Name, contestant.ContestantId, contestant.Name, contestant.PerformanceDescription, contestant.PerformanceDuration.ToHHMMSS(), contestant.TotalScore, contestant.PenaltyPoints, contestant.FinalScore, contestant.LowestScore, contestant.SumOfTopScores, contestant.NumberOfScoreCards, contestant.NumberOfJudges, contestant.Scores, contestant.Organization, contestant.ParentOrganization); } } byte[] excelBytes = new ExcelDocumentMaker().MakeNewExcelPackage(table, "Summary Report"); ExcelHttpResponseUtil.MakeResponse(excelBytes, "ShowSummaryReport"); }