private QuestionAnwer GetInsatnciatedAnswerForQuestion(
            IEnumerable <Model.Questionnaire.QuestionAnwer> answers, Question qc, Func <int> questionIdSelector)
        {
            Model.Questionnaire.QuestionAnwer givenAnswer =
                answers.FirstOrDefault(a => a.QuestionId == questionIdSelector());
            PossibleAnswer templateAnswer =
                qc.PossivbleAnswers.FirstOrDefault(
                    pa => givenAnswer != null && Math.Abs((pa.Value + 1) - (givenAnswer.Answer + 1)) < 0.01);

            QuestionAnwer instanciatedAnswer;

            if (templateAnswer != null)
            {
                Debug.Assert(givenAnswer != null, "givenAnswer != null");
                instanciatedAnswer = new QuestionAnwer
                {
                    Description = templateAnswer.Description,
                    Color       = GetSingleCategoryScoreColor(givenAnswer.Answer)
                };
            }
            else
            {
                instanciatedAnswer = new QuestionAnwer {
                    Description = "-"
                };
            }
            return(instanciatedAnswer);
        }
        private void LocalizeServiceQuestion(string locale, Questions questionsRes, Model.Questionnaire.Question q)
        {
            var posibleAnswersRes = new PossibleAnswers();

            q.PossivbleAnswers.ForEach(pa => LocalizePosibleAnswer(locale, posibleAnswersRes, pa));

            ServiceModel.Questionnaire.Question serviceQuestion = questionsRes.AddItem(locale, q.Description, q.Help, q.QuestionId);

            serviceQuestion.PossivbleAnswers = posibleAnswersRes.PossivbleAnswersList;
        }
        protected virtual QuestionAnwer GetSpesificQuestionAnswer(Question qc)
        {
            PossibleAnswer res = qc.PossivbleAnswers.FirstOrDefault(c => Math.Abs(c.Value - qc.QuestionAnwer.Answer) < 0.01);

            return(new QuestionAnwer
            {
                Answer = qc.QuestionAnwer.Answer,
                Description = res == null ? "-" : res.Description,
                //  Color = QuestionnaireCalculationAlgorithm.GetSingleCategoryScoreColor(qc.QuestionAnwer.Answer)
            });
        }
        private QuestionAnwer GetSpesificQuestionAnswer(Question qc)
        {
            PossibleAnswer res =
                qc.PossivbleAnswers.FirstOrDefault(c => Math.Abs(c.Value - qc.QuestionAnwer.Answer) < 0.01);

            return(new QuestionAnwer
            {
                Answer = qc.QuestionAnwer.Answer,
                Description = res == null ? "-" : res.Description,
                Color = GetSingleCategoryScoreColor(qc.QuestionAnwer.Answer)
            });
        }
        private ServiceModel.Questionnaire.Question LocalizeServiceCategoryQuestion(string locale, QuestionCategory c)
        {
            var questionsRes      = new Questions();
            var posibleAnswersRes = new PossibleAnswers();

            ServiceModel.Questionnaire.Question question = questionsRes.GetLocalizedQuestion(locale, c.CategoryQuestion.Description,
                                                                                             c.CategoryQuestion.Help, c.CategoryQuestion.QuestionId);
            c.CategoryQuestion.PossivbleAnswers.ForEach(pa => LocalizePosibleAnswer(locale, posibleAnswersRes, pa));

            question.PossivbleAnswers = posibleAnswersRes.PossivbleAnswersList;

            return(question);
        }