Example #1
0
        public List <SummaryTable> FillSumaryTable(Dictionary <string, List <string> > textAnswers,
                                                   Dictionary <string, List <string> > textAnswersCompare,
                                                   Test test, Test testCompare)
        {
            List <SummaryTable> list = new List <SummaryTable>();

            foreach (KeyValuePair <string, List <string> > answer in textAnswers)
            {
                SummaryTable summary = new SummaryTable(answer.Key, answer.Value,
                                                        textAnswersCompare.Keys.Contains(answer.Key) ?
                                                        textAnswersCompare[answer.Key] : new List <string>(),
                                                        test.Name, testCompare.Name == "" ? " " : testCompare.Name);
                list.Add(summary);
            }
            return(list);
        }
Example #2
0
        public List <SummaryTable> FillSumaryTable(List <KeyValuePair <string, object> > averageMedian,
                                                   List <KeyValuePair <string, object> > satisfiedNotSatisfied,
                                                   bool condition)
        {
            List <SummaryTable> list = new List <SummaryTable>();

            if (condition)                                                                                 //si voy a mostrar media y mediana
            {
                Dictionary <string, double> listAvg = (Dictionary <string, double>)averageMedian[0].Value; //devuelve el diccionario
                Dictionary <string, double> listMed = (Dictionary <string, double>)averageMedian[1].Value;
                Dictionary <string, double> listSat = (Dictionary <string, double>)satisfiedNotSatisfied[0].Value;
                Dictionary <string, double> listNSa = (Dictionary <string, double>)satisfiedNotSatisfied[1].Value;
                int size = listAvg.Count();

                foreach (var valor in listAvg)
                {                                                                                                       //listAvg.ContainsKey(valor) ? listAvg[valor] : 0
                    SummaryTable summary = new SummaryTable(valor.Key, valor.Value,
                                                            listMed.Keys.Contains(valor.Key) ? listMed[valor.Key] : 0,  //listMed[valor.Key],
                                                            listSat.Keys.Contains(valor.Key) ? listSat[valor.Key] : 0,  //listSat[valor.Key],
                                                            listNSa.Keys.Contains(valor.Key) ? listNSa[valor.Key] : 0); //listNSa[valor.Key]);

                    list.Add(summary);
                }
            }
            else
            {
                Dictionary <string, double> listSat = (Dictionary <string, double>)satisfiedNotSatisfied[0].Value;
                Dictionary <string, double> listNSa = (Dictionary <string, double>)satisfiedNotSatisfied[1].Value;
                int size = listSat.Count();

                foreach (var valor in listSat)//SummaryTable tiene valor (ejemplo menor a 18 aƱos), media,mediana,satisfechos,no satisfechos
                {
                    SummaryTable summary = new SummaryTable(valor.Key, 0, 0,
                                                            listSat.Keys.Contains(valor.Key) ? listSat[valor.Key] : 0,//si la lista de satisfechos contiene el valor actual coloque lo que tenga la lista en la posicion del valor actual
                                                            listNSa.Keys.Contains(valor.Key) ? listNSa[valor.Key] : 0);

                    list.Add(summary);
                }
            }

            return(list);
        }
Example #3
0
        public List <SummaryTable> FillSumaryTable(List <KeyValuePair <string, object> > averageMedian,
                                                   List <KeyValuePair <string, object> > satisfiedNotSatisfied,
                                                   bool condition, string demographic,
                                                   List <KeyValuePair <string, object> > averageMedianCompare,
                                                   List <KeyValuePair <string, object> > satisfiedNotSatisfiedCompare,
                                                   string testName, string testCompareName)
        {
            List <SummaryTable> list = new List <SummaryTable>();

            if (condition)
            {
                Dictionary <string, double> listAvg        = (Dictionary <string, double>)averageMedian[0].Value;
                Dictionary <string, double> listMed        = (Dictionary <string, double>)averageMedian[1].Value;
                Dictionary <string, double> listSat        = (Dictionary <string, double>)satisfiedNotSatisfied[0].Value;
                Dictionary <string, double> listNSa        = (Dictionary <string, double>)satisfiedNotSatisfied[1].Value;
                Dictionary <string, double> listAvgCompare = (Dictionary <string, double>)averageMedianCompare[0].Value;
                Dictionary <string, double> listMedCompare = (Dictionary <string, double>)averageMedianCompare[1].Value;
                Dictionary <string, double> listSatCompare = (Dictionary <string, double>)satisfiedNotSatisfiedCompare[0].Value;
                Dictionary <string, double> listNSaCompare = (Dictionary <string, double>)satisfiedNotSatisfiedCompare[1].Value;
                int           size = listAvg.Count();
                List <string> keys = GetKeys(listSat, listSatCompare);
                if (demographic == "General")
                {
                    SummaryTable summary = new SummaryTable("General", listAvg.FirstOrDefault().Value,
                                                            listMed.FirstOrDefault().Value,
                                                            listSat.FirstOrDefault().Value,
                                                            listNSa.FirstOrDefault().Value,
                                                            listAvgCompare.FirstOrDefault().Value,
                                                            listMedCompare.FirstOrDefault().Value,
                                                            listSatCompare.FirstOrDefault().Value,
                                                            listNSaCompare.FirstOrDefault().Value,
                                                            testName, testCompareName);

                    list.Add(summary);
                }
                else
                {
                    foreach (var valor in keys)
                    {
                        SummaryTable summary = new SummaryTable(valor, listAvg.ContainsKey(valor) ? listAvg[valor] : 0,
                                                                listMed.ContainsKey(valor) ? listMed[valor] : 0,
                                                                listSat.ContainsKey(valor) ? listSat[valor] : 0,
                                                                listNSa.ContainsKey(valor) ? listNSa[valor] : 0,
                                                                listAvgCompare.ContainsKey(valor) ? listAvgCompare[valor] : 0,
                                                                listMedCompare.ContainsKey(valor) ? listMedCompare[valor] : 0,
                                                                listSatCompare.ContainsKey(valor) ? listSatCompare[valor] : 0,
                                                                listNSaCompare.ContainsKey(valor) ? listNSaCompare[valor] : 0,
                                                                testName, testCompareName);

                        list.Add(summary);
                    }
                }
            }
            else
            {
                Dictionary <string, double> listSat        = (Dictionary <string, double>)satisfiedNotSatisfied[0].Value;
                Dictionary <string, double> listNSa        = (Dictionary <string, double>)satisfiedNotSatisfied[1].Value;
                Dictionary <string, double> listSatCompare = (Dictionary <string, double>)satisfiedNotSatisfiedCompare[0].Value;
                Dictionary <string, double> listNSaCompare = (Dictionary <string, double>)satisfiedNotSatisfiedCompare[1].Value;
                int           size = listSat.Count();
                List <string> keys = GetKeys(listSat, listSatCompare);
                if (demographic == "General")
                {
                    SummaryTable summary = new SummaryTable("General", 0, 0,
                                                            listSat.FirstOrDefault().Value,
                                                            listNSa.FirstOrDefault().Value,
                                                            0, 0,
                                                            listSatCompare.FirstOrDefault().Value,
                                                            listNSaCompare.FirstOrDefault().Value,
                                                            testName, testCompareName);

                    list.Add(summary);
                }
                else
                {
                    foreach (var valor in keys)
                    {
                        SummaryTable summary = new SummaryTable(valor, 0, 0,
                                                                listSat.ContainsKey(valor) ? listSat[valor] : 0,
                                                                listNSa.ContainsKey(valor) ? listNSa[valor] : 0,
                                                                0, 0,
                                                                listSatCompare.ContainsKey(valor) ? listSatCompare[valor] : 0,
                                                                listNSaCompare.ContainsKey(valor) ? listNSaCompare[valor] : 0,
                                                                testName, testCompareName);

                        list.Add(summary);
                    }
                }
            }

            return(list);
        }