Пример #1
0
        void Fill(int i, List <UchastChamp> uchs, ref UchastChamp u1, ref UchastChamp u2)
        {
            if (uchs.Count < i + 1)
            {
                return;
            }
            int im          = i + 1;
            int ie          = i + 2;
            int countWinGr1 = GetCountWinGroup(uchs[i]);
            int countWinGr2 = uchs.Count > im?GetCountWinGroup(uchs[im]) : 0;

            int countWinGr3 = uchs.Count > ie?GetCountWinGroup(uchs[ie]) : 0;

            if (countWinGr1 == 0 && countWinGr2 == 0 && countWinGr3 == 0)
            {
                return;
            }
            else
            {
                var cW = new SortedDictionary <int, int>();
                cW.Add(i, countWinGr1); cW.Add(im, countWinGr2); cW.Add(ie, countWinGr3);
                var j = 0;
                foreach (var c in cW)
                {
                    if (j == 2)
                    {
                        break;
                    }
                    else if (j == 0)
                    {
                        u1 = uchs[c.Key];
                    }
                    else if (j == 1)
                    {
                        u2 = uchs[c.Key];
                    }
                    j++;
                }
            }
        }
Пример #2
0
 int GetCountWinGroup(UchastChamp uc) => uc.Sorevnovanie.Where(u => u.Winner == 0 && u.Red == uc.id_uchast || u.Winner == 1 && u.White == uc.id_uchast).Count();
Пример #3
0
 int?GetCountRule(UchastChamp u, string rule, int IDSor) => u?.Pravila.Where(r => r.id_sorevnovanie == IDSor && r.Name == rule).Count();