public void CreateDataSets(ObservableCollection <VariableVM> variables) { foreach (DataSetVM dataSet in dataSets) { foreach (VariableVM variable in variables) { DataSetVariableVM v = null; bool shouldCreateVariable = (dataSet.Id == StudyUnit.DefaultDataSetId) && !variable.IsCreatedDataSet && !dataSet.IsExistVariable(variable.Id); if (shouldCreateVariable) { v = new DataSetVariableVM(); v.Id = variable.Id; variable.IsCreatedDataSet = true; dataSet.Variables.Add(v); } else { v = dataSet.FindVariable(variable.Id); } if (v != null) { ConceptVM concept = StudyUnit.FindConcept(variable.ConceptId); v.Title = variable.Title; v.Label = variable.Label; v.ConceptTitle = concept == null ? null : concept.Title; } } } }
private void CreateVariableInfos() { variableInfos.Clear(); ObservableCollection <VariableVM> variables = StudyUnit.Variables; foreach (VariableVM variable in variables) { VariableInfoVM variableInfo = new VariableInfoVM(variable.Variable); variableInfos.Add(variableInfo); ConceptVM concept = StudyUnit.FindConcept(variable.ConceptId); if (concept != null) { variableInfo.ConceptTitle = concept.Title; } QuestionVM question = StudyUnit.FindQuestion(variable.QuestionId); if (question != null) { variableInfo.QuestionTitle = question.Content; } UniverseVM universe = StudyUnit.FindUniverse(variable.UniverseId); if (universe != null) { variableInfo.UniverseTitle = universe.Title; } variableInfo.VariableType = Options.FindResponseTypeLabel(variable.ResponseTypeCode); } selectedVariableInfoItem = null; }
private DataSetVariableVM createDataSetVariable(VariableVM variable) { ConceptVM concept = StudyUnit.FindConcept(variable.ConceptId); //if (concept == null) //{ // return null; //} DataSetVariableVM v = new DataSetVariableVM(); v.Id = variable.Variable.Id; v.Title = variable.Title; v.Label = variable.Label; v.ConceptTitle = concept == null ? null : concept.Title; return(v); }