Ejemplo n.º 1
0
        public void Checkweek(Player host, BonusQuestions questions, Dictionary <string, Topscorer> topscorers)
        {
            Week hostweek = host.Weeks[Weeknr - 1];

            WeekScore = 0;
            for (int counter = 0; counter < Matches.Length; counter++)
            {
                WeekScore += CheckMatch(hostweek, counter);
            }

            questions.CheckBonus(host.Questions, Weeknr, topscorers);
            WeekScore += questions.WeekScore;
        }
Ejemplo n.º 2
0
 public Player(string name, string age, string woonplaats, Week[] weeks, BonusQuestions questions)
 {
     Weeks             = weeks;
     Name              = name;
     Age               = age;
     Woonplaats        = woonplaats;
     TotalScore        = 0;
     WeekScore         = 0;
     Questions         = questions;
     PreviousScore     = 0;
     RankingDifference = 0;
     PreviousRanking   = 0;
     Ranking           = 0;
 }
Ejemplo n.º 3
0
        public BonusQuestions ReadBonus()
        {
            int column     = 7;
            int weekcolumn = 10;

            InitialiseWorkbook(Settings.AdminFileName, Settings.Hostsheet);
            try
            {
                int[] weeks =
                {
                    Convert.ToInt32(xlRange.Cells[366, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[367, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[368, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[369, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[370, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[371, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[372, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[373, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[375, weekcolumn].value2),
                    Convert.ToInt32(xlRange.Cells[377, weekcolumn].value2),
                };

                string[]       degradanten = { Convert.ToString(xlRange.Cells[375, column].value2), Convert.ToString(xlRange.Cells[376, column].value2) };
                string[]       promovendi  = { Convert.ToString(xlRange.Cells[377, column].value2), Convert.ToString(xlRange.Cells[378, column].value2) };
                string[]       finalists   = { Convert.ToString(xlRange.Cells[373, column].value2), Convert.ToString(xlRange.Cells[374, column].value2) };
                BonusQuestions bonus       = new BonusQuestions
                                             (
                    Convert.ToString(xlRange.Cells[366, column].value2),
                    Convert.ToString(xlRange.Cells[367, column].value2),
                    Convert.ToString(xlRange.Cells[368, column].value2),
                    Convert.ToString(xlRange.Cells[369, column].value2),
                    Convert.ToString(xlRange.Cells[370, column].value2),
                    Convert.ToString(xlRange.Cells[371, column].value2),
                    Convert.ToString(xlRange.Cells[372, column].value2),
                    finalists, degradanten, promovendi,
                    weeks
                                             );
                CleanWorkbook();
                return(bonus);
            }
            catch { CleanWorkbook(); return(null); };
        }
Ejemplo n.º 4
0
        public void CheckBonus(BonusQuestions HostQuestions, int currentweek, Dictionary <string, Topscorer> topscorers)
        {
            if (HostQuestions == null)
            {
                throw new ArgumentNullException("hostquestions");
            }
            WeekScore = 0;

            foreach (var a in Answers)
            {
                var ans = HostQuestions.Answers[a.Key];
                if (ans.WeekAnswered > 0)
                {
                    if (a.Value.IsArray)
                    {
                        foreach (var e in a.Value.AnswerArray)
                        {
                            if (ans.AnswerArray.Contains(e) && ans.WeekAnswered == currentweek)
                            {
                                WeekScore += a.Value.Points;
                            }
                        }
                    }

                    else
                    {
                        if (a.Value.Answer == ans.Answer && ans.WeekAnswered == currentweek)
                        {
                            WeekScore += a.Value.Points;
                        }
                    }
                }
            }

            checkTopscorer(currentweek, topscorers);
        }
Ejemplo n.º 5
0
        private void SavePlayer()
        {
            try
            {
                string[]       finalists   = { tbFin1.Text, tbFin2.Text };
                string[]       degradanten = { tbDegradant1.Text, tbDegradant2.Text };
                string[]       promovendi  = { tbPromovendi1.Text, tbPromovendi2.Text };
                BonusQuestions questions   = new BonusQuestions(tbKampioen.Text, tbProdeg.Text, tbTopscorer.Text, tbTrainer.Text
                                                                , tbWinterkampioen.Text, tbRonde.Text, tbMostRed.Text, finalists, degradanten, promovendi
                                                                , new int[10] {
                    99, 99, 99, 99, 99, 99, 99, 99, 99, 99
                });


                Player newplayer = new Player(tbName.Text, tbAge.Text, tbWoonplaats.Text, weeks, questions);
                if (cbSecondHalf.Checked)
                {
                    Player.Weeks = weeks;
                    newplayer    = Player;
                }

                if (Player != null)
                {
                    manager.RemovePlayer(Player.Name);
                }

                manager.AddPlayer(newplayer);
                this.Dispose();
                this.Close();
            }

            catch
            {
                MessageBox.Show("veld niet ingevuld");
            }
        }