コード例 #1
0
ファイル: CourseReader.cs プロジェクト: stepanpicek/oroutes
 //Determining the splits
 private void setSplits()
 {
     foreach (var course in Courses)
     {
         var courseControls = CourseControls.FindAll(cc => cc.Course == course).OrderBy(cc => cc.Order).ToList();
         for (int i = 0; i < courseControls.Count() - 1; i++)
         {
             Control c1    = courseControls[i].Control;
             Control c2    = courseControls[i + 1].Control;
             var     split = Splits.FirstOrDefault(s => s.FirstControl == c1 && s.SecondControl == c2);
             if (split == null)
             {
                 split = new Split
                 {
                     FirstControl  = c1,
                     SecondControl = c2
                 };
                 Splits.Add(split);
             }
             CourseSplit courseSplit = new CourseSplit
             {
                 Course = course,
                 Split  = split,
                 Order  = i
             };
             CourseSplits.Add(courseSplit);
         }
     }
 }