Exemplo n.º 1
0
        public void ZapisTrest(Trest t)
        {
            HraciTable   ht     = new HraciTable();
            TrestyTable  tt     = new TrestyTable();
            List <Hrac>  hraci  = ht.Select();
            List <Trest> tresty = tt.Select();

            for (int i = 0; i < hraci.Count; i++)
            {
                if (t.Hrac.HracId == hraci[i].HracId)
                {
                    hraci[i].TrestneMinuty += t.Delka;
                    ht.Update(t.Hrac.HracId, hraci[i].TrestneMinuty);
                    tt.Insert(t);
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public List <Hrac> TabulkaTrestne()
        {
            HraciTable   ht     = new HraciTable();
            TrestyTable  tt     = new TrestyTable();
            List <Hrac>  hraci  = ht.Select();
            List <Trest> tresty = tt.Select();

            for (int i = 0; i < hraci.Count; i++)
            {
                int minuty = 0;
                for (int j = 0; j < tresty.Count; j++)
                {
                    if (tresty[j].Hrac.HracId == hraci[i].HracId)
                    {
                        minuty += tresty[j].Delka;
                    }
                }
                hraci[i].TrestneMinuty = minuty;
            }

            return(hraci.OrderByDescending(x => x.TrestneMinuty).ToList());
        }