public void WriteFullXml(string filename, RelayVariations relayVariations, EventDB eventDB, Id <Course> courseId) { this.relayVariations = relayVariations; this.eventDB = eventDB; this.courseId = courseId; this.modificationDate = DateTimeOffset.Now; this.courseName = eventDB.GetCourse(courseId).name; // Create the XML writer. XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.Encoding = new UTF8Encoding(false); xmlWriter = XmlWriter.Create(filename, settings); WriteStart(); WriteAllTeams(); WriteEnd(); // And done. xmlWriter.Close(); eventDB = null; xmlWriter = null; }
public void WriteXml(string filename, RelayVariations relayVariations, EventDB eventDB, Id<Course> courseId) { this.relayVariations = relayVariations; this.eventDB = eventDB; this.courseId = courseId; this.modificationDate = DateTimeOffset.Now; this.courseName = eventDB.GetCourse(courseId).name; // Create the XML writer. XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.Encoding = new UTF8Encoding(false); xmlWriter = XmlWriter.Create(filename, settings); WriteStart(); for (int teamNumber = 1; teamNumber < relayVariations.NumberOfTeams; ++teamNumber) { WriteTeam(teamNumber); } WriteEnd(); // And done. xmlWriter.Close(); eventDB = null; xmlWriter = null; }
public int totalScore; // Total score for all forks. public TeamAssignment(RelayVariations relayVariations) { outer = relayVariations; legAssignForFork = new Dictionary <Fork, LegAssignmentForOneFork>(); foreach (Fork fork in outer.allForks) { legAssignForFork[fork] = new LegAssignmentForOneFork(); } }
public void WriteTeamsPart(XmlWriter xmlWriter, RelayVariations relayVariations, EventDB eventDB, Id <Course> courseId) { this.xmlWriter = xmlWriter; this.relayVariations = relayVariations; this.eventDB = eventDB; this.courseId = courseId; this.modificationDate = DateTimeOffset.Now; this.courseName = eventDB.GetCourse(courseId).name; WriteAllTeams(); }
public void WriteCsv(string fileName, RelayVariations relayVariations) { this.relayVariations = relayVariations; using (writer = new StreamWriter(fileName, false, Encoding.ASCII)) { WriteHeaderLine(); WriteTeams(); } writer = null; relayVariations = null; }
void WriteTeamAssignments() { foreach (Id <Course> courseId in QueryEvent.SortedCourseIds(eventDB)) { if (QueryEvent.HasVariations(eventDB, courseId)) { Course course = eventDB.GetCourse(courseId); if (course.relaySettings.relayTeams > 0) { RelayVariations relayVariations = new RelayVariations(eventDB, courseId, course.relaySettings); WriteRelayVariations(courseId, relayVariations); } } } }
// Given a VariationChoices, select all the course designators that match. public static IEnumerable<CourseDesignator> GetDesignatorsFromVariationChoices(EventDB eventDB, Id<Course> courseId, VariationChoices variationChoices) { switch (variationChoices.Kind) { case VariationChoices.VariationChoicesKind.Combined: return new[] { new CourseDesignator(courseId) }; case VariationChoices.VariationChoicesKind.AllVariations: return (from vi in GetAllVariations(eventDB, courseId) select new PurplePen.CourseDesignator(courseId, vi)).ToArray(); case VariationChoices.VariationChoicesKind.ChosenVariations: return (from vi in GetAllVariations(eventDB, courseId) where variationChoices.ChosenVariations.Contains(vi.CodeString) select new PurplePen.CourseDesignator(courseId, vi)).ToArray(); case VariationChoices.VariationChoicesKind.ChosenTeams: Course course = eventDB.GetCourse(courseId); RelayVariations relayVariations = new RelayVariations(eventDB, courseId, course.relayTeams, course.relayLegs); List<CourseDesignator> result = new List<CourseDesignator>(); for (int team = variationChoices.FirstTeam; team <= variationChoices.LastTeam; ++team) { for (int leg = 1; leg <= relayVariations.NumberOfLegs; ++leg) { result.Add(new CourseDesignator(courseId, relayVariations.GetVariation(team, leg))); } } return result; default: Debug.Fail("Bad variation choices kind"); return null; } }
public TeamAssignment(RelayVariations relayVariations) { outer = relayVariations; legAssignForFork = new Dictionary<Fork, LegAssignmentForOneFork>(); foreach (Fork fork in outer.allForks) { legAssignForFork[fork] = new LegAssignmentForOneFork(); } }
protected override void WriteRelayVariations(Id <Course> courseId, RelayVariations relayVariations) { // Version 2 does not have ability to write relay variations. Do nothing. }
protected override void WriteRelayVariations(Id <Course> courseId, RelayVariations relayVariations) { ExportRelayVariations3 exportVariations = new ExportRelayVariations3(); exportVariations.WriteTeamsPart(xmlWriter, relayVariations, eventDB, courseId); }
protected abstract void WriteRelayVariations(Id <Course> courseId, RelayVariations relayVariations);