Exemplo n.º 1
0
        public KnockOutPhase readKnockout(string filename, int sheet, ExcelReadSettings settings)
        {
            Initialise(filename, sheet);
            KnockOutPhase ko = new KnockOutPhase();
            int           p  = 0;

            foreach (var phase in settings.phases)
            {
                for (int i = 0; i < phase.size; i++)
                {
                    int row = phase.startrow + (phase.gapsize * i);
                    if (i >= phase.size / 2)
                    {
                        row++;
                    }
                    string team = xlRange.Cells[row, phase.column].value2;
                    if (team == null)
                    {
                        team = "";
                    }
                    ko.Stages.ElementAt(p).Value.teams.Add(team.ToLower());
                }
                p++;
            }
            Clean();
            return(ko);
        }
Exemplo n.º 2
0
        public Player(string name, string town, List <PoolMatchResult> poolmatches, KnockOutPhase KO, BonusQuestions BQ)
        {
            if (name != "Host")
            {
                if (string.IsNullOrEmpty(name))
                {
                    throw new ArgumentNullException();
                }
            }

            if (poolmatches == null || KO == null)
            {
                throw new ArgumentNullException();
            }
            Name      = name;
            Score     = 0;
            Results   = poolmatches;
            KnockOut  = KO;
            Questions = BQ;
        }
Exemplo n.º 3
0
        public int checkKnockoutPhase(KnockOutPhase KO)
        {
            if (KO == null)
            {
                return(-1);
            }

            int Score = 0;

            foreach (var stage in Stages)
            {
                foreach (var team in stage.Value.teams)
                {
                    if (KO.Stages[stage.Key].teams.Contains(team))
                    {
                        Score += stage.Value.award;
                    }
                }
            }

            return(Score);
        }
Exemplo n.º 4
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            manager.LoadPlayers();
            List <PoolMatchResult> matches = new List <PoolMatchResult>();
            KnockOutPhase          KO      = new KnockOutPhase();
            int x = 0;

            while (x < 72)
            {
                matches.Add(new PoolMatchResult(Convert.ToInt32(NUDs[x].Value), Convert.ToInt32(NUDs[x + 1].Value)));
                x += 2;
            }

            foreach (var k in kolocs)
            {
                foreach (var t in k.Value)
                {
                    KO.Stages[k.Key].teams.Add(t.Text);
                }
            }

            Player player = new Player(tbName.Text, tbTown.Text, matches, KO, new BonusQuestions(tbChampion.Text, tbTopscorer.Text, tbDutch.Text));

            try
            {
                manager.removePlayer(tbName.Text);
                manager.AddPlayer(player);
            }

            catch (ArgumentNullException)
            {
                MessageBox.Show("Veld niet ingevuld. Controleer of alle velden zijn ingevuld en probeer opnieuw.");
            }
            manager.SavePlayers();


            this.Hide();
            this.Dispose();
        }