Example #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;
                }
            }
        }
Example #2
0
        public void AddCond(CondVM cond)
        {
            CondVM newCond = CondVM.CreateDefault(this);

            Conds.Add(newCond);
            OnCondsOrderChanged();
        }
Example #3
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;
                }
            }
        }
Example #4
0
        public void DownCond(CondVM cond)
        {
            int index = Conds.IndexOf(cond);

            Conds.Move(index, index + 1);
            OnCondsOrderChanged();
        }
Example #5
0
        public CondVM DeepCopy(BaseVM parent)
        {
            CondVM newCond = new CondVM();

            newCond.Parent = parent;
            newCond.SelectedQuestionConstruct = SelectedQuestionConstruct;
            newCond.selectedOperatorCode      = SelectedOperatorCode;
            newCond.CondValue = CondValue;
            return(newCond);
        }
Example #6
0
        public bool CanUpCond(CondVM cond)
        {
            int index = Conds.IndexOf(cond);

            if (index == 0)
            {
                return(false);
            }
            return(true);
        }
Example #7
0
        public bool CanDownCond(CondVM cond)
        {
            int index = Conds.IndexOf(cond);

            if (index == Conds.Count - 1)
            {
                return(false);
            }
            return(true);
        }
Example #8
0
        public static CondGroupVM CreateDefault(BranchVM parent)
        {
            CondGroupVM condGroup = new CondGroupVM()
            {
                Parent = parent
            };
            CondVM cond = CondVM.CreateDefault(condGroup);

            condGroup.Conds.Add(cond);
            return(condGroup);
        }
Example #9
0
        public static CondVM CreateDefault(CondGroupVM parent)
        {
            CondVM cond = new CondVM()
            {
                Parent = parent
            };
            CreateBranchWindowVM window = parent.Window;

            cond.SelectedQuestionConstruct = window.TargetQuestionConstruct;
            cond.SelectedOperatorCode      = Options.OPERATOR_EQUALS_CODE;
            return(cond);
        }
Example #10
0
        public CondGroupVM DeepCopy(BaseVM parent)
        {
            CondGroupVM newCondGroup = new CondGroupVM();

            newCondGroup.Parent = parent;
            foreach (CondVM cond in Conds)
            {
                CondVM newCond = cond.DeepCopy(newCondGroup);
                newCondGroup.Conds.Add(newCond);
            }
            return(newCondGroup);
        }
Example #11
0
 private static bool UpdateQuestionNumberOfCond(CondVM cond, ICollection <QuestionNumberVM> questionNumbers)
 {
     foreach (QuestionNumberVM questionNumber in questionNumbers)
     {
         if (cond.SelectedQuestionConstructNo == questionNumber.BeforeValue)
         {
             cond.ForceUpdateSelectedQuestionConstructNo(questionNumber.AfterValue);
             return(true);
         }
     }
     return(false);
 }
Example #12
0
        private CondGroupVM CreateDefaultCondGroup()
        {
            CondGroupVM condGroup = new CondGroupVM()
            {
                Parent = this
            };
            CondVM cond = new CondVM()
            {
                Parent = condGroup
            };
            CreateBranchWindowVM parent = (CreateBranchWindowVM)Parent;

            cond.SelectedQuestionConstruct = parent.TargetQuestionConstruct;
            cond.SelectedOperatorCode      = Options.OPERATOR_EQUALS_CODE;
            condGroup.Conds.Add(cond);
            return(condGroup);
        }
Example #13
0
 public void AddCond(CondVM cond)
 {
     CondVM newCond = CondVM.CreateDefault(this);
     Conds.Add(newCond);
     OnCondsOrderChanged();
 }
Example #14
0
 public CondVM DeepCopy(BaseVM parent)
 {
     CondVM newCond = new CondVM();
     newCond.Parent = parent;
     newCond.SelectedQuestionConstruct = SelectedQuestionConstruct;
     newCond.selectedOperatorCode = SelectedOperatorCode;
     newCond.CondValue = CondValue;
     return newCond;
 }
Example #15
0
 public bool CanRemoveCond(CondVM cond)
 {
     return Conds.Count > 1;
 }
Example #16
0
 public bool IsLastCond(CondVM cond)
 {
     return Conds.Last() == cond;
 }
Example #17
0
 public bool CanAddCond(CondVM cond)
 {
     return(cond.IsLast);
 }
Example #18
0
 public bool IsLastCond(CondVM cond)
 {
     return(Conds.Last() == cond);
 }
Example #19
0
 public bool CanAddCond(CondVM cond)
 {
     return cond.IsLast;
 }
Example #20
0
 public bool CanDownCond(CondVM cond)
 {
     int index = Conds.IndexOf(cond);
     if (index == Conds.Count - 1)
     {
         return false;
     }
     return true;
 }
Example #21
0
 public void UpCond(CondVM cond)
 {
     int index = Conds.IndexOf(cond);
     Conds.Move(index, index - 1);
     OnCondsOrderChanged();
 }
Example #22
0
 public bool CanUpCond(CondVM cond)
 {
     int index = Conds.IndexOf(cond);
     if (index == 0)
     {
         return false;
     }
     return true;
 }
Example #23
0
 public static CondVM CreateDefault(CondGroupVM parent)
 {
     CondVM cond = new CondVM() { Parent = parent };
     CreateBranchWindowVM window = parent.Window;
     cond.SelectedQuestionConstruct = window.TargetQuestionConstruct;
     cond.SelectedOperatorCode = Options.OPERATOR_EQUALS_CODE;
     return cond;
 }
Example #24
0
 public void RemoveCond(CondVM cond)
 {
     Conds.Remove(cond);
     OnCondsOrderChanged();
 }
Example #25
0
 public bool CanRemoveCond(CondVM cond)
 {
     return(Conds.Count > 1);
 }
Example #26
0
 private CondGroupVM CreateDefaultCondGroup()
 {
     CondGroupVM condGroup = new CondGroupVM() { Parent = this };
     CondVM cond = new CondVM() { Parent = condGroup };
     CreateBranchWindowVM parent = (CreateBranchWindowVM)Parent;
     cond.SelectedQuestionConstruct = parent.TargetQuestionConstruct;
     cond.SelectedOperatorCode = Options.OPERATOR_EQUALS_CODE;
     condGroup.Conds.Add(cond);
     return condGroup;
 }
Example #27
0
 public void RemoveCond(CondVM cond)
 {
     Conds.Remove(cond);
     OnCondsOrderChanged();
 }