private IQuestionnaireOutputItem GetRootOutput(DomainId <IQuestionnaireRootNode> questionnaireRootNode) { var name = questionnaireRootNode .ToDomainItem(m_domainItemLocator) .QuestionnaireName; return(m_domainItemLocator .GetAll <IQuestionnaireOutputItem>() .FirstOrDefault(x => x.DisplayName == name)); }
private void Visit(DomainId <IConditionalStatementNode> ifElseNode) { var node = ifElseNode.ToDomainItem(m_domainItemLocator); var predicateResult = Evaluate(node.Predicate); m_questionsCurrentlyVisible.Push(predicateResult); HandleStatements(node.Consequent); m_questionsCurrentlyVisible.Pop(); m_questionsCurrentlyVisible.Push(!predicateResult); HandleStatements(node.Alternative); m_questionsCurrentlyVisible.Pop(); }
private SectionModel CreateSectionModel(DomainId <ISectionOutputItem> sectionId) { var sectionItem = sectionId.ToDomainItem(DomainItemLocator); var sectionModel = new SectionModel(sectionItem.Id, sectionItem.DisplayName); foreach (var questionId in sectionItem.Questions) { var questionModel = CreateQuestionModel(questionId); sectionModel.Questions.Add(questionModel); } return(sectionModel); }
private PageModel CreatePageModel(DomainId <IPagesOutputItem> pageId) { var pageItem = pageId.ToDomainItem(DomainItemLocator); var pageModel = new PageModel(pageItem.Id, pageItem.DisplayName); foreach (var sectionId in pageItem.Sections) { var sectionModel = CreateSectionModel(sectionId); pageModel.Sections.Add(sectionModel); } return(pageModel); }
private void Visit(DomainId <IStyleSheetRootNode> styleSheetNodeId) { var styleSheetNode = styleSheetNodeId .ToDomainItem(m_domainItemLocator); UpdateDefaults(styleSheetNode); var pages = styleSheetNode .Pages .Select(Visit) .ToList(); m_styledOutputItemFactory.CreateRoot(styleSheetNode.Name, pages); PopDefaults(); }
private DomainId <ISectionOutputItem> Visit(DomainId <ISectionNode> sectionId) { var sectionNode = sectionId .ToDomainItem(m_domainItemLocator); UpdateDefaults(sectionNode); var questions = sectionNode .Questions .Select(Visit) .ToList(); var section = m_styledOutputItemFactory.CreateSection(sectionNode.Name, questions); PopDefaults(); return(section); }
private DomainId <IPagesOutputItem> Visit(DomainId <IPageNode> pageNodeId) { var pageNode = pageNodeId .ToDomainItem(m_domainItemLocator); UpdateDefaults(pageNode); var sections = pageNode .Sections .Select(Visit) .ToList(); var page = m_styledOutputItemFactory.CreatePage(pageNode.Name, sections); PopDefaults(); return(page); }
public void Visit(DomainId <IQuestionnaireRootNode> questionnaireNode) { var astNode = questionnaireNode .ToDomainItem(m_domainItemLocator); HandleStatements(astNode.Statements); var existingOutput = m_domainItemLocator .GetAll <IQuestionnaireOutputItem>() .FirstOrDefault(x => x.Variable.Id == astNode.Id); if (existingOutput == null) { m_outputItemFactory.CreateQuestionnaireOutputItem( questionnaireNode, astNode.QuestionnaireName, m_questions); } }
private DomainId <IStyledQuestionOutputItem> Visit( DomainId <IQlsQuestionNode> questionId) { var questionNode = questionId .ToDomainItem(m_domainItemLocator); var questionStyle = questionNode .Style ?.ToDomainItem(m_domainItemLocator); var question = m_domainItemLocator .GetAll <IQuestionOutputItem>() .FirstOrDefault(x => x.QuestionName == questionNode.Name); var defaultStyle = GetStyleDefaultForType(question.QuestionType); var style = m_styleFactory.CreateMergedStyle(defaultStyle, questionStyle); var section = m_styledOutputItemFactory.CreateQuestion(question, style); return(section); }
private StyledQuestionModel CreateQuestionModel( DomainId <IStyledQuestionOutputItem> questionId) { var styledQuestion = questionId.ToDomainItem(DomainItemLocator); var questionModel = new QuestionModel( styledQuestion.Id, styledQuestion.Variable.Id, styledQuestion.QuestionText, styledQuestion.Visible, styledQuestion.ReadOnly, styledQuestion.QuestionType); var styleModel = new StyleModel( styledQuestion.Widget, styledQuestion.Width, styledQuestion.Font, styledQuestion.FontSize, styledQuestion.Color); return(new StyledQuestionModel(questionModel, styleModel)); }
private void Visit(DomainId <IUserInputQuestionNode> questionNode) { var astNode = questionNode.ToDomainItem(m_domainItemLocator); var existingOutput = m_domainItemLocator .GetAll <IQuestionOutputItem>() .FirstOrDefault(x => x.Variable.Id == astNode.Id); if (existingOutput == null) { var question = m_outputItemFactory.CreateQuestionOutputItem( new DomainId <IQuestionNode>(questionNode.Id), GetValue(astNode), m_questionsCurrentlyVisible.Peek(), false); m_questions.Add(question); } else { existingOutput.Visible = m_questionsCurrentlyVisible.Peek(); } }