GetVariation() публичный Метод

public GetVariation ( int team, int leg ) : VariationInfo
team int
leg int
Результат VariationInfo
Пример #1
0
 private void WriteTeams()
 {
     for (int teamNumber = relayVariations.FirstTeamNumber; teamNumber <= relayVariations.LastTeamNumber; ++teamNumber)
     {
         writer.Write(teamNumber.ToString(CultureInfo.InvariantCulture));
         for (int legNumber = 1; legNumber <= relayVariations.NumberOfLegs; ++legNumber)
         {
             writer.Write(",{0}", relayVariations.GetVariation(teamNumber, legNumber).CodeString);
         }
         writer.WriteLine();
     }
 }
Пример #2
0
        private void WriteLeg(int teamNumber, int legNumber)
        {
            xmlWriter.WriteStartElement("TeamMemberCourseAssignment");

            string variationString = relayVariations.GetVariation(teamNumber, legNumber).CodeString;

            xmlWriter.WriteElementString("Leg", XmlConvert.ToString(legNumber));
            xmlWriter.WriteElementString("CourseName", courseName + " " + variationString);
            xmlWriter.WriteElementString("CourseFamily", courseName);

            xmlWriter.WriteEndElement(); // </TeamMemberCourseAssignment>
        }
Пример #3
0
        // 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;
            }
        }