private MatrixRankingAnswer MatchMatrixRankingAnswer(Question question, IEnumerable <ResponseAnswer> responseAnswers)
        {
            var reply = new MatrixRankingAnswer
            {
                Ranking       = new List <Tuple <int, string> >(),
                NotApplicable = new List <string>()
            };

            foreach (var responseAnswer in responseAnswers)
            {
                if (question.AnswersLookup[responseAnswer.Col].Weight == 0)
                {
                    reply.NotApplicable.Add(question.AnswersLookup[responseAnswer.Row].Text);
                }
                else
                {
                    reply.Ranking.Add(
                        new Tuple <int, string>(
                            question.AnswersLookup[responseAnswer.Col].Weight,
                            question.AnswersLookup[responseAnswer.Row].Text
                            )
                        );
                }
            }

            return(reply);
        }
        private MatrixRankingAnswer MatchMatrixRankingAnswer(Question question, IEnumerable <ResponseAnswer> responseAnswers)
        {
            var reply = new MatrixRankingAnswer
            {
                Ranking       = new Dictionary <int, string>(),
                NotApplicable = new List <string>()
            };

            foreach (var responseAnswer in responseAnswers)
            {
                if (question.Answers.Choices.Any(c => c.IsNa.Value && c.Id.Value == responseAnswer.ChoiceId.Value))
                {
                    reply.NotApplicable.Add(question.Answers.Choices.FirstOrDefault(c => c.IsNa.Value && c.Id.Value == responseAnswer.ChoiceId.Value).Text);
                }
                else
                {
                    if (question.Answers.ItemLookup.ContainsKey(responseAnswer.ChoiceId.Value) && question.Answers.ItemLookup.ContainsKey(responseAnswer.RowId.Value) && !reply.Ranking.ContainsKey(Int32.Parse(question.Answers.ItemLookup[responseAnswer.ChoiceId.Value])))
                    {
                        reply.Ranking.Add(Int32.Parse(question.Answers.ItemLookup[responseAnswer.ChoiceId.Value]), question.Answers.ItemLookup[responseAnswer.RowId.Value]);
                    }
                }
            }

            return(reply);
        }
        private MatrixRankingAnswer MatchMatrixRankingAnswer(Question question, IEnumerable<ResponseAnswer> responseAnswers)
        {
            var reply = new MatrixRankingAnswer
            {
                Ranking = new List<Tuple<int, string>>(),
                NotApplicable = new List<string>()
            };
            
            foreach (var responseAnswer in responseAnswers)
            {
                if (question.AnswersLookup[responseAnswer.Col].Weight == 0)
                {
                    reply.NotApplicable.Add(question.AnswersLookup[responseAnswer.Row].Text);
                }
                else
                {
                    reply.Ranking.Add(
                        new Tuple<int, string>(
                            question.AnswersLookup[responseAnswer.Col].Weight,
                            question.AnswersLookup[responseAnswer.Row].Text
                        )
                    );
                }
            }

            return reply;
        }