예제 #1
0
        public List <SummaryTable> UpdateTable(int?questionnaire_id, int?category_id, int?question_id, int test_id, string demographic, int?FO_id, int?compare_id)
        {
            Test test        = new TestsServices().GetById(test_id);
            Test testCompare = new Test();
            Dictionary <string, List <string> > textAnswers        = new Dictionary <string, List <string> >();
            Dictionary <string, List <string> > textAnswersCompare = new Dictionary <string, List <string> >();

            if (compare_id.HasValue)
            {
                testCompare = new TestsServices().GetById(compare_id.Value);
            }
            switch (demographic)
            {
            case "General":
                textAnswers = test.GetGeneralTextAnswers(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetGeneralTextAnswers(questionnaire_id, category_id, question_id);
                }
                break;

            case "Location":
                textAnswers = test.GetTextAnswersByLocations(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByLocations(questionnaire_id, category_id, question_id);
                }
                break;

            case "AgeRange":
                textAnswers = test.GetTextAnswersByAgeRanges(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByAgeRanges(questionnaire_id, category_id, question_id);
                }
                break;

            case "Country":
                textAnswers = test.GetTextAnswersByCountries(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByCountries(questionnaire_id, category_id, question_id);
                }
                break;

            case "Region":
                textAnswers = test.GetTextAnswersByRegions(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByRegions(questionnaire_id, category_id, question_id);
                }
                break;

            case "InstructionLevel":
                textAnswers = test.GetTextAnswersByInstructionLevels(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByInstructionLevels(questionnaire_id, category_id, question_id);
                }
                break;

            case "PositionLevel":
                textAnswers = test.GetTextAnswersByPositionLevels(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByPositionLevels(questionnaire_id, category_id, question_id);
                }
                break;

            case "Seniority":
                textAnswers = test.GetTextAnswersBySeniorities(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersBySeniorities(questionnaire_id, category_id, question_id);
                }
                break;

            case "Gender":
                textAnswers = test.GetTextAnswersByGenders(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByGenders(questionnaire_id, category_id, question_id);
                }
                break;

            case "Performance":
                textAnswers = test.GetTextAnswersByPerformanceEvaluations(questionnaire_id, category_id, question_id);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByPerformanceEvaluations(questionnaire_id, category_id, question_id);
                }
                break;

            case "FunctionalOrganizationType":
                textAnswers = test.GetTextAnswersByFOs(questionnaire_id, category_id, question_id, FO_id.Value);
                if (compare_id.HasValue)
                {
                    textAnswersCompare = testCompare.GetTextAnswersByFOs(questionnaire_id, category_id, question_id, FO_id.Value);
                }
                break;
            }
            return(FillSumaryTable(textAnswers, textAnswersCompare, test, testCompare));
        }