Ejemplo n.º 1
0
        internal void SaveVotes(Hardware.KeyStatusValues keyStatusValues, int slideId)
        {
            var q = GetQuestionSlideConfiguration(slideId);
            var array = (new string[10] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }).ToList();

            foreach (var vote in keyStatusValues.GetValues())
            {
                int index = array.IndexOf(vote.Value.KeyValue);
                if (index < q.Answers.Count)
                {
                    q.Answers[index].VotesCount++;
                    q.Answers[index].Votes.Add(new Hardware.VotesFlat(vote));
                    if (q.Answers[index].Time < vote.Value.Keytime)
                        q.Answers[index].Time = vote.Value.Keytime;
                }
            }

            q.HasVotes = true;

            UpdateResults(q.SlideId);
        }