Ejemplo n.º 1
0
 public StatisticsInfoVM(StatisticsInfo statisticsInfo)
 {
     this.statisticsInfo = statisticsInfo;
     statisticsInfo.ApplyScale();
     this.rows = new ObservableCollection <StatisticsInfoRowVM>();
     if (statisticsInfo.IsTypeNumber)
     {
         rows = CreateNumberRows(statisticsInfo);
     }
     else if (statisticsInfo.IsTypeChoicesSingleAnswer || statisticsInfo.IsTypeDateTime)
     {
         rows = CreateSingleAnswerOrDateTimeRows(statisticsInfo);
     }
     else if (statisticsInfo.IsTypeChoicesMultipleAnswer)
     {
         rows = CreateMultipleAnswerRows(statisticsInfo);
     }
 }
Ejemplo n.º 2
0
        public static List <CodebookVariable> CreateCodebookVariables(StudyUnitVM studyUnit)
        {
            List <CodebookVariable>           codebookVariables = new List <CodebookVariable>();
            ObservableCollection <QuestionVM> questions         = studyUnit.AllQuestions;

            foreach (VariableVM variable in studyUnit.Variables)
            {
                QuestionVM      question       = EDOUtils.Find <QuestionVM>(questions, variable.QuestionId);
                StatisticsInfo  statisticsInfo = studyUnit.FindStatisticsInfoModel(variable);
                StatisticsTypes statisticsType = StatisticsTypes.Unknown;
                if (statisticsInfo == null)
                {
                    statisticsType = studyUnit.GetStatisticsType(variable);
                }
                else
                {
                    statisticsType = statisticsInfo.StatisticsType;
                    statisticsInfo.ApplyScale();
                }
                CodebookVariable codebookVariable = null;
                if (question != null && StatisticsInfo.IsTypeChoicesMultipleAnswerOf(statisticsType))
                {
                    codebookVariable = CodebookVariable.FindByQuestionId(codebookVariables, question.Id);
                }
                if (codebookVariable == null)
                {
                    codebookVariable = new CodebookVariable();
                    codebookVariables.Add(codebookVariable);
                }
                codebookVariable.Variables.Add(variable);
                codebookVariable.Question       = question;
                codebookVariable.StatisticsInfo = statisticsInfo;
                codebookVariable.StatisticsType = statisticsType;
            }
            return(codebookVariables);
        }