Exemple #1
0
        /// <summary>
        /// Read ballot_choice.csv.
        /// </summary>
        private void ReadBallotChoices(string ballotChoiceFile)
        {
            if (!File.Exists(ballotChoiceFile))
            {
                return;
            }

            FileInfo file = new FileInfo(ballotChoiceFile);

            using (TextReader reader = file.OpenText())
            {
                CsvReader csv = new CsvReader(reader);
                while (csv.Read())
                {
                    string ballotKey = csv.CurrentRecord[1];
                    ballotKey = ballotKey.Split('-')[0];
                    Ballot ballot = this.Ballots.First(b => b.Aid == ballotKey);
                    ballot.AddChoice(csv.CurrentRecord);
                }
            }
        }