Beispiel #1
0
        private async void Query6()
        {
            int           selectedCountry = -1;
            ChoiceCountry form            = new ChoiceCountry(db.Country.ToArray());

            if (form.ShowDialog() == DialogResult.OK)
            {
                selectedCountry = form.selectedCountry;
            }
            var tmp = db.Results.Where(x => x.Persons.IdCountry == (selectedCountry + 1)).Select(x => new { OlimpiadNumber = x.Olympiads.Number, NamePerson = x.Persons.FullName });

            dataGridView1.DataSource = await tmp.ToListAsync();
        }
Beispiel #2
0
        private async void Query7()
        {
            int           selectedCountry = -1;
            ChoiceCountry form            = new ChoiceCountry(db.Country.ToArray());

            if (form.ShowDialog() == DialogResult.OK)
            {
                selectedCountry = form.selectedCountry;
            }
            var tmp = db.Results.Where(x => x.Persons.IdCountry == (selectedCountry + 1)).Select(x => new
            {
                OlimpiadNumber = x.Olympiads.Number,
                MedalsI        = db.Results.Where(y => y.IdOlympiad == x.IdOlympiad && y.Persons.IdCountry == x.Persons.IdCountry).Where(y => y.Medal == 1).Count(),
                MedalsII       = db.Results.Where(y => y.IdOlympiad == x.IdOlympiad && y.Persons.IdCountry == x.Persons.IdCountry).Where(y => y.Medal == 2).Count(),
                MedalsIII      = db.Results.Where(y => y.IdOlympiad == x.IdOlympiad && y.Persons.IdCountry == x.Persons.IdCountry).Where(y => y.Medal == 3).Count()
            }).Distinct();

            dataGridView1.DataSource = await tmp.ToListAsync();
        }