/// <summary> /// Read ballot_vote.csv. /// </summary> private void ReadBallotVotes(string ballotVoteFile) { if (!File.Exists(ballotVoteFile)) { return; } FileInfo file = new FileInfo(ballotVoteFile); using (TextReader reader = file.OpenText()) { CsvReader csv = new CsvReader(reader); while (csv.Read()) { if (csv.CurrentRecord[4] == "0") { // "choice" column is 0, so this choice was not made. continue; } string ballotKey = csv.CurrentRecord[1]; ballotKey = ballotKey.Split('-')[0]; Ballot ballot = this.Ballots.First(b => b.Aid == ballotKey); BallotChoice choice = ballot.Choices.First(c => c.ChoiceId == long.Parse(csv.CurrentRecord[2])); ballot.AddVote(choice, csv.CurrentRecord); } } }