예제 #1
0
        /// <summary>
        /// Adds a choice to the ballot from a CSV row.
        /// </summary>
        /// <param name="fields">The fields of the CSV row.</param>
        public void AddChoice(string[] fields)
        {
            BallotChoice choice = BallotChoice.FromFields(fields);

            this.Choices.Add(choice);
            choice.Ballot = this;
        }
예제 #2
0
        /// <summary>
        /// Adds a vote to the ballot from a CSV row.
        /// </summary>
        /// <param name="choice">The choice that was chosen in the vote.</param>
        /// <param name="fields">The fields of the CSV row.</param>
        public void AddVote(BallotChoice choice, string[] fields)
        {
            BallotVote vote = BallotVote.FromFields(fields, this.Backup);

            this.Votes.Add(vote);
            choice.Votes.Add(vote);
            vote.Choice = choice;
            vote.Ballot = this;
        }