// Get the text for a list of courses. Returns "None" for no courses. Returns "All courses" for all courses. // The list of course names in the canonical order of courses (same as the tab order). private static string CourseListText(EventDB eventDB, Id <Course>[] courseIds) { if (courseIds.Length == 0) { return(SelectionDescriptionText.CourseList_None); } if (courseIds.Length == QueryEvent.CountCourses(eventDB)) { return(SelectionDescriptionText.CourseList_AllCourses); } StringBuilder builder = new StringBuilder(); Id <Course>[] sortedCourseIds = QueryEvent.SortedCourseIds(eventDB); List <string> courseNames = new List <string>(); if (courseIds.Contains(new Id <Course>(0))) { courseNames.Add(MiscText.AllControls); } for (int i = 0; i < sortedCourseIds.Length; ++i) { if (courseIds.Contains(sortedCourseIds[i])) { courseNames.Add(eventDB.GetCourse(sortedCourseIds[i]).name); } } for (int i = 0; i < courseNames.Count; ++i) { if (i != 0) { builder.Append(", "); } builder.Append(courseNames[i]); } return(builder.ToString()); }