Пример #1
0
        public void initialiseScoresForDisplay(List <hole> holes, dailyScores scores)
        {
            playerScoreForDisplay ps;

            ps            = new playerScoreForDisplay();
            ps.playerName = "par";
            foreach (hole ctHole in holes)
            {
                ps.GetType().GetProperty(String.Format("_{0}", ctHole.nr)).SetValue(ps, ctHole.par.ToString());
            }
            playerScoresForDisplay.Add(ps);

            ps            = new playerScoreForDisplay();
            ps.playerName = "hcp";
            foreach (hole ctHole in holes)
            {
                ps.GetType().GetProperty(String.Format("_{0}", ctHole.nr)).SetValue(ps, ctHole.hcp.ToString());
            }
            playerScoresForDisplay.Add(ps);

            foreach (String ctPlayer in scores.holeResults.Keys)
            {
                ps            = new playerScoreForDisplay();
                ps.playerName = ctPlayer;
                foreach (hole ctHole in holes)
                {
                    ps.GetType().GetProperty(String.Format("_{0}", ctHole.nr)).SetValue(ps, scores.getScore(ctPlayer, ctHole.nr).ToString().Replace("0", "X"));
                }
                playerScoresForDisplay.Add(ps);
            }
        }