Exemple #1
0
        private static void CreateCondGroups(string code, BranchVM branch, ObservableCollection <QuestionConstructVM> questionConstructs)
        {
            CondParser       parser         = new CondParser(code);
            List <CondGroup> condGroupElems = parser.Parse();

            foreach (CondGroup condGroupElem in condGroupElems)
            {
                CondGroupVM condGroup = new CondGroupVM()
                {
                    Parent = branch
                };
                condGroup.SelectedConnectionCode = Option.FindCodeByLabel(Options.Connections, condGroupElem.Connector);
                branch.CondGroups.Add(condGroup);

                foreach (Cond condElem in condGroupElem.Conds)
                {
                    CondVM cond = new CondVM()
                    {
                        Parent = condGroup
                    };
                    condGroup.Conds.Add(cond);
                    cond.SelectedQuestionConstruct = QuestionConstructVM.FindQuestionConstructByNo(questionConstructs, condElem.LeftValue);
                    cond.SelectedOperatorCode      = Option.FindCodeByLabel(Options.Operators, condElem.Operator);
                    cond.CondValue = condElem.RightValue;
                }
            }
        }
Exemple #2
0
        //private QuestionConstructVM selectedQuestionConstruct;
        //public QuestionConstructVM SelectedQuestionConstruct
        //{
        //    get
        //    {
        //        return selectedQuestionConstruct;
        //    }
        //    set
        //    {
        //        if (selectedQuestionConstruct != value)
        //        {
        //            selectedQuestionConstruct = value;
        //            NotifyPropertyChanged("SelectedQuestionConstruct");
        //        }
        //    }
        //}

        private bool IsValidQuestionConstructNo(string no)
        {
            QuestionConstructVM questin = QuestionConstructVM.FindQuestionConstructByNo(QuestionConstructs, no);

            return(questin != null);
        }