Exemplo n.º 1
0
 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;
             }
         }
     }
 }
Exemplo n.º 2
0
        public void RemoveVariable(string variableId)
        {
            DataSetVariableVM variable = FindVariable(variableId);

            if (variable != null)
            {
                Variables.Remove(variable);
            }
        }
Exemplo n.º 3
0
        public void DownVariable()
        {
            DataSetVariableVM variable = SelectedVariable;
            int index = SelectedVariableIndex;

            SelectedDataSet.Variables.Move(index, index + 1);
            RenumberPosition();
            ((DataSetFormView)View).FocusCell();
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 public DataSetFormVM(StudyUnitVM studyUnit) : base(studyUnit)
 {
     dataSets = new ObservableCollection <DataSetVM>();
     foreach (DataSet dataSetModel in studyUnit.DataSetModels)
     {
         ObservableCollection <DataSetVariableVM> variables = new ObservableCollection <DataSetVariableVM>();
         foreach (string guid in dataSetModel.VariableGuids)
         {
             DataSetVariableVM v = createDataSetVariable(guid);
             if (v != null)
             {
                 variables.Add(v);
             }
         }
         DataSetVM dataSet = new DataSetVM(dataSetModel, variables)
         {
             Parent = this
         };
         dataSets.Add(dataSet);
     }
     modelSyncher = new ModelSyncher <DataSetVM, DataSet>(this, dataSets, studyUnit.DataSetModels);
 }
Exemplo n.º 6
0
        public void AddVariable()
        {
            if (this.SelectedDataSet == null)
            {
                return;
            }
            SelectVariableWindow dlg = new SelectVariableWindow(this.StudyUnit);

            dlg.Owner = Application.Current.MainWindow;
            dlg.ShowDialog();
            if (dlg.DialogResult == true)
            {
                ObservableCollection <VariableVM> variables = dlg.SelectedVariables;
                foreach (VariableVM variable in variables)
                {
                    DataSetVariableVM v = createDataSetVariable(variable);
                    if (v != null)
                    {
                        this.SelectedDataSet.Variables.Add(v);
                    }
                }
                Memorize();
            }
        }
Exemplo n.º 7
0
 public DataSetVariableVM FindVariable(string variableId)
 {
     return(DataSetVariableVM.Find(Variables, variableId));
 }
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
 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;
             }
         }
     }
 }