public string CreateLegLengthReport(EventDB eventDB)
{
InitReport();
// Header.
WriteH1(string.Format(ReportText.LegLength_Title, QueryEvent.GetEventTitle(eventDB, " ")));
// Enumerate all courses.
Id<Course>[] courseIds = QueryEvent.SortedCourseIds(eventDB);
// Write row for each course.
foreach (Id<Course> courseId in courseIds) {
CourseView courseView = CourseView.CreateViewingCourseView(eventDB, new CourseDesignator(courseId));
// Don't include score courses in the leg length report.
if (courseView.Kind == CourseView.CourseViewKind.Score)
continue;
// Heading string for course
string headerLine;
if (courseView.TotalClimb < 0)
headerLine = string.Format(ReportText.LegLength_CourseInfoNoClimb, courseView.CourseName, Util.RangeIfNeeded(courseView.MinNormalControls, courseView.MaxNormalControls), Util.GetLengthInKm(courseView.MinTotalLength, courseView.MaxTotalLength, 1));
else
headerLine = string.Format(ReportText.LegLength_CourseInfo, courseView.CourseName, Util.RangeIfNeeded(courseView.MinNormalControls, courseView.MaxNormalControls), Util.GetLengthInKm(courseView.MinTotalLength, courseView.MaxTotalLength, 1), Math.Round(courseView.TotalClimb / 5, MidpointRounding.AwayFromZero) * 5.0);
WriteH2(headerLine);
WriteLegLengthTable(eventDB, courseView);
}
return FinishReport();
}