Beispiel #1
0
        public SurveySummary ConvertSurvey(Survey survey)
        {
            SurveySummary ss = new SurveySummary();

            ss.Survey = survey;
            ss.EntryCount = _repository.GetEntryCount(survey.ID);
            ss.AdminComments = _repository.GetApprovals(survey.ID);

            return ss;
        }
Beispiel #2
0
        public SurveySummary ConvertFullSurvey(Survey survey)
        {
            SurveySummary ss = new SurveySummary();

            ss.Survey = survey;
            ss.Questions = new List<QuestionSummary>();
            ss.EntryCount = _repository.GetEntryCount(survey.ID);
            ss.AdminComments = _repository.GetApprovals(survey.ID);

            List<Question> questions = _repository.GetQuestions(survey.ID);

            foreach (Question question in questions)
            {
                QuestionSummary qs = new QuestionSummary();
                qs.Question = question;
                qs.Answers = new List<AnswerSummary>();

                List<Answer> answers = _repository.GetAnswers(question.ID);

                foreach (var answer in answers)
                {
                    AnswerSummary ans = new AnswerSummary();
                    ans.Answer = answer;

                    ans.ResponseCount = _repository.GetResponseCount(answer.ID);
                    int totalcount = ss.EntryCount;
                    ans.ResponsePercentage = 0;
                    if (ans.ResponseCount > 0)
                    {
                        ans.ResponsePercentage = Convert.ToInt32(ans.ResponseCount * 100 / totalcount);
                    }

                    qs.Answers.Add(ans);
                }

                ss.Questions.Add(qs);
            }

            return ss;
        }
Beispiel #3
0
 public NewQuestion()
 {
     Summary = new SurveySummary();
 }
Beispiel #4
0
        public SurveySummary ConvertFullSurvey(Survey survey)
        {
            SurveySummary ss = new SurveySummary();

            ss.Survey = survey;
            ss.Questions = new List<QuestionSummary>();
            ss.EntryCount = _repository.GetEntryCount(survey.ID);
            ss.AdminComments = _repository.GetApprovals(survey.ID);

            List<Question> questions = _repository.GetQuestions(survey.ID);

            foreach (Question question in questions)
            {
                QuestionSummary qs = new QuestionSummary();
                qs.Question = question;
                qs.Answers = new List<AnswerSummary>();

                List<Answer> answers = _repository.GetAnswers(question.ID);

                foreach (var answer in answers)
                {
                    AnswerSummary ans = new AnswerSummary();
                    ans.Answer = answer;
                    qs.Answers.Add(ans);
                }

                ss.Questions.Add(qs);
            }

            return ss;
        }