Пример #1
0
        public List <SummaryTable> UpdateTable(int?questionnaire_id, int?category_id, int?question_id, double?pValue, int test_id, string demographic, bool condition, int?FO_id, int?compare_id)
        {
            Test test        = new TestsServices().GetById(test_id);
            Test testCompare = new Test();
            Dictionary <string, object> dictionarySCompare  = null;
            Dictionary <string, object> dictionaryAMCompare = null;
            Dictionary <string, object> dictionaryS         = new ChiSquare(test, demographic, questionnaire_id, category_id, question_id, null, FO_id, 0.05, null, null, null).DataSatisfaction;
            Dictionary <string, object> dictionaryAM        = new Dictionary <string, object>();

            if (compare_id.HasValue)
            {
                testCompare         = new TestsServices().GetById(compare_id.Value);
                dictionarySCompare  = new ChiSquare(testCompare, demographic, questionnaire_id, category_id, question_id, null, FO_id, 0.05, null, null, null).DataSatisfaction;
                dictionaryAMCompare = new Dictionary <string, object>();
            }
            if (condition)//número de demográficos mayor a 7
            {
                switch (demographic)
                {
                case "General":
                    dictionaryAM = test.GetGeneralAvgAndMed(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetGeneralAvgAndMed(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "Category":
                    dictionaryAM = test.GetCategoryAvgAndMed(compare_id.HasValue && !condition, questionnaire_id, null, null, null);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetCategoryAvgAndMed(compare_id.HasValue && !condition, questionnaire_id, null, null, null);
                    }
                    break;

                case "Location":
                    dictionaryAM = test.GetAvgAndMedByLocations(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition, null, null, null);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByLocations(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition, null, null, null);
                    }
                    break;

                case "AgeRange":
                    dictionaryAM = test.GetAvgAndMedByAgeRanges(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByAgeRanges(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "Country":
                    dictionaryAM = test.GetAvgAndMedByCountries(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByCountries(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "Region":
                    dictionaryAM = test.GetAvgAndMedByRegions(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByRegions(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "InstructionLevel":
                    dictionaryAM = test.GetAvgAndMedByInstructionLevels(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByInstructionLevels(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "PositionLevel":
                    dictionaryAM = test.GetAvgAndMedByPositionLevels(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByPositionLevels(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "Seniority":
                    dictionaryAM = test.GetAvgAndMedBySeniorities(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedBySeniorities(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "Gender":
                    dictionaryAM = test.GetAvgAndMedByGender(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByGender(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "Performance":
                    dictionaryAM = test.GetAvgAndMedByAgeRanges(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByAgeRanges(questionnaire_id, category_id, question_id, compare_id.HasValue && !condition);
                    }
                    break;

                case "FunctionalOrganizationType":
                    dictionaryAM = test.GetAvgAndMedByFOTypes(questionnaire_id, category_id, question_id, FO_id.Value, compare_id.HasValue && !condition);
                    if (compare_id.HasValue)
                    {
                        dictionaryAMCompare = testCompare.GetAvgAndMedByFOTypes(questionnaire_id, category_id, question_id, FO_id.Value, compare_id.HasValue && !condition);
                    }
                    break;
                }
            }
            if (compare_id.HasValue)
            {
                return(FillSumaryTable(dictionaryAM.ToList(), dictionaryS.ToList(), condition, demographic,
                                       dictionaryAMCompare.ToList(), dictionarySCompare.ToList(),
                                       test.Name, testCompare.Name));
            }
            else
            {
                return(FillSumaryTable(dictionaryAM.ToList(), dictionaryS.ToList(), condition));
            }
        }