Ejemplo n.º 1
0
        public ResponseVM SelectAndCreateResponse(ResponseVM sourceResponse)
        {
            ResponseVM newResponse = null;

            if (sourceResponse.IsTypeChoices)
            {
                StudyUnit.CompleteResponse(sourceResponse);
                CodeSchemeVM sourceCodeScheme = sourceResponse.CodeScheme;

                ObservableCollection <CodeSchemeVM> codeSchemes = new ObservableCollection <CodeSchemeVM>(StudyUnit.CodeSchemes);

                SelectObjectWindowVM <CodeSchemeVM> vm = new SelectObjectWindowVM <CodeSchemeVM>(codeSchemes);
                CodeSchemeVM codeScheme = SelectObjectWindow.Select(Resources.SelectResponse, vm) as CodeSchemeVM; //Select Response Style
                if (codeScheme != null && sourceCodeScheme != codeScheme)
                {
                    Response responseModel = new Response();
                    responseModel.TypeCode = Options.RESPONSE_TYPE_CHOICES_CODE;
                    responseModel.Title    = codeScheme.Title;
                    newResponse            = new ResponseVM(responseModel, codeScheme);
                }
            }
            else
            {
                ObservableCollection <ResponseVM> responses = GetCandidateResponses();
                SelectObjectWindowVM <ResponseVM> vm        = new SelectObjectWindowVM <ResponseVM>(responses);
                ResponseVM selectedResponse = SelectObjectWindow.Select(Resources.SelectResponse, vm) as ResponseVM;
                if (selectedResponse != null && sourceResponse != selectedResponse)
                {
                    newResponse = selectedResponse.Dup();
                }
            }
            return(newResponse);
        }
Ejemplo n.º 2
0
        public static void ExportQuestionnaire(EDOConfig config, StudyUnitVM studyUnit)
        {
            ControlConstructSchemeVM controlConstructScheme = null;

            if (studyUnit.ControlConstructSchemes.Count > 1)
            {
                SelectObjectWindowVM <ControlConstructSchemeVM> vm = new SelectObjectWindowVM <ControlConstructSchemeVM>(studyUnit.ControlConstructSchemes);
                SelectObjectWindow window = new SelectObjectWindow(vm);
                controlConstructScheme = SelectObjectWindow.Select(Resources.SelectOrder, vm) as ControlConstructSchemeVM; //Select Sequence
            }
            else if (studyUnit.ControlConstructSchemes.Count == 1)
            {
                controlConstructScheme = studyUnit.ControlConstructSchemes[0];
            }
            if (controlConstructScheme == null)
            {
                return;
            }
            string path = IOUtils.QuerySavePathName(Resources.ExportQuestionnair + ": " + controlConstructScheme.Title, null, QUESTIONNAIRE_FILTER, true);

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            try
            {
                QuestionnaireWriter writer = new QuestionnaireWriter(config, controlConstructScheme);
                writer.Write(path);
            }
            catch (Exception ex)
            {
                EDOUtils.ShowUnexpectedError(ex);
            }
        }
Ejemplo n.º 3
0
        public static void ExportSetupSyntax(StudyUnitVM studyUnit)
        {
            DataFileVM dataFile = null;

            if (studyUnit.DataFiles.Count > 1)
            {
                SelectObjectWindowVM <DataFileVM> vm = new SelectObjectWindowVM <DataFileVM>(studyUnit.DataFiles);
                SelectObjectWindow window            = new SelectObjectWindow(vm);
                dataFile = SelectObjectWindow.Select(Resources.SelectDataFile, vm) as DataFileVM; //Select Data File
            }
            else if (studyUnit.DataFiles.Count == 1)
            {
                dataFile = studyUnit.DataFiles[0];
            }
            if (dataFile == null)
            {
                return;
            }
            string path = IOUtils.QuerySavePathName(Resources.ExportSetupSyntax, null, SETUPSYNTAX_FILTER, true); //Export Setup Syntax

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            try
            {
                SetupSyntaxWriter writer = new SetupSyntaxWriter(studyUnit, dataFile);
                writer.Write(path);
            }
            catch (Exception ex)
            {
                EDOUtils.ShowUnexpectedError(ex);
            }
        }
Ejemplo n.º 4
0
        private void AddQuestionGroup()
        {
            ObservableCollection <QuestionGroupVM> questionGroups = StudyUnit.QuestionGroups;
            SelectObjectWindowVM <QuestionGroupVM> vm             = new SelectObjectWindowVM <QuestionGroupVM>(questionGroups);
            QuestionGroupVM questionGroup = SelectObjectWindow.Select(Resources.SelectQuestionGroup, vm) as QuestionGroupVM;//Select Question Group

            if (questionGroup != null)
            {
                InsertQuestionGroupConstruct(questionGroup, true);
            }
        }
Ejemplo n.º 5
0
        private void AddQuestion()
        {
            ObservableCollection <QuestionVM> questions = StudyUnit.AllQuestions;
            SelectObjectWindowVM <QuestionVM> vm        = new SelectObjectWindowVM <QuestionVM>(questions, "Content");
            QuestionVM question = SelectObjectWindow.Select(Resources.SelectQuestion, vm) as QuestionVM;//Select Question

            if (question != null)
            {
                InsertQuestionConstruct(question, true);
            }
        }
Ejemplo n.º 6
0
        public void SelectOrganization()
        {
            SelectObjectWindowVM <OrganizationVM> vm = new SelectObjectWindowVM <OrganizationVM>(StudyUnit.Organizations, "OrganizationName");
            SelectObjectWindow window       = new SelectObjectWindow(vm);
            OrganizationVM     organization = SelectObjectWindow.Select(Resources.SelectMember, vm) as OrganizationVM;

            if (organization != null)
            {
                UpdateOrganization(organization);
            }
        }
Ejemplo n.º 7
0
        public void AddQuestion()
        {
            ObservableCollection <QuestionVM> allQuestions = StudyUnit.AllChoicesQuestions;
            SelectObjectWindowVM <QuestionVM> vm           = new SelectObjectWindowVM <QuestionVM>(allQuestions, "Content");
            QuestionVM question = SelectObjectWindow.Select(Resources.SelectQuestion, vm) as QuestionVM;//Select Question

            if (question != null)
            {
                Questions.Add(question);
                UpdateModel();
            }
        }
Ejemplo n.º 8
0
        public void ChangeImage()
        {
            Debug.WriteLine("Change Image");
            ConceptVM  selectedConcept          = SelectedConcept;
            QuestionVM selectedQuestion         = SelectedQuestion;
            SelectObjectWindowVM <ConceptVM> vm = new SelectObjectWindowVM <ConceptVM>(Concepts);
            ConceptVM newConcept = SelectObjectWindow.Select(Resources.SelectImage, vm) as ConceptVM;

            if (newConcept != null && newConcept != selectedConcept)
            {
                SelectedQuestions.Remove(selectedQuestion);
                SelectedQuestionItem = null;

                ObservableCollection <QuestionVM> questions = RelatedQuestions(newConcept.Id);
                questions.Add(selectedQuestion);
                selectedQuestion.Question.ConceptId = newConcept.Id;

                UpdateModel(true);
            }
        }
Ejemplo n.º 9
0
        public BookVM SelectBookExternal(BookRelation relation)
        {
            SelectObjectWindowVM <BookVM> vm     = new SelectObjectWindowVM <BookVM>(books);
            SelectObjectWindow            window = new SelectObjectWindow(vm);
            BookVM book = SelectObjectWindow.Select(Resources.SelectBook, vm) as BookVM; //Select

            if (book != null)
            {
                using (UndoTransaction tx = new UndoTransaction(UndoManager))
                {
                    if (book.Book.FindRelation(relation) == null)
                    {
                        //Need not be generated here since ViewModel Since is re-generated every time EditBookWindow is displayed.
                        book.Book.BookRelations.Add(relation);
                    }
                    StudyUnit.OnRemoveBooks();
                    tx.Commit();
                }
            }
            return(book);
        }