Ejemplo n.º 1
0
        public void DownCondGroup(CondGroupVM condGroup)
        {
            int index = CondGroups.IndexOf(condGroup);

            CondGroups.Move(index, index + 1);
            OnCondGroupsOrderChanged();
        }
Ejemplo n.º 2
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;
                }
            }
        }
Ejemplo n.º 3
0
        public void AddCondGroup(CondGroupVM condGroup)
        {
            CondGroupVM newCondGroup = CreateDefaultCondGroup();

            condGroups.Add(newCondGroup);
            OnCondGroupsOrderChanged();
        }
Ejemplo n.º 4
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;
                }
            }
        }
Ejemplo n.º 5
0
        public bool CanUpCondGroup(CondGroupVM condGroup)
        {
            int index = CondGroups.IndexOf(condGroup);

            if (index == 0)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 6
0
        public bool CanDownCondGroup(CondGroupVM condGroup)
        {
            int index = CondGroups.IndexOf(condGroup);

            if (index == CondGroups.Count - 1)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 7
0
        public static CondGroupVM CreateDefault(BranchVM parent)
        {
            CondGroupVM condGroup = new CondGroupVM()
            {
                Parent = parent
            };
            CondVM cond = CondVM.CreateDefault(condGroup);

            condGroup.Conds.Add(cond);
            return(condGroup);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        private void ResetType()
        {
            if (IsTypeElse)
            {
                CondGroups.Clear();
            }
            else
            {
                CondGroupVM condGroup = CreateDefaultCondGroup();
                condGroups.Add(condGroup);

                CreateBranchWindowVM parent = (CreateBranchWindowVM)Parent;
                ThenConstruct = parent.NextConstruct;
            }
        }
Ejemplo n.º 11
0
        public BranchVM DeepCopy()
        {
            BranchVM newBranch = new BranchVM(TypeCode);

            newBranch.Parent = Parent;
            newBranch.Init();
            newBranch.IsNew         = IsNew;
            newBranch.ThenConstruct = ThenConstruct;
            newBranch.CondGroups.Clear();
            foreach (CondGroupVM condGroup in condGroups)
            {
                CondGroupVM newGroup = condGroup.DeepCopy(newBranch);
                newBranch.CondGroups.Add(newGroup);
            }
            return(newBranch);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 13
0
 public void RemoveCondGroup(CondGroupVM condGroup)
 {
     condGroups.Remove(condGroup);
     OnCondGroupsOrderChanged();
 }
Ejemplo n.º 14
0
 public bool IsFirst(CondGroupVM condGroup)
 {
     return condGroups.First() == condGroup;
 }
Ejemplo n.º 15
0
 public bool IsLast(CondGroupVM condGroup)
 {
     return condGroups.Last() == condGroup;
 }
Ejemplo n.º 16
0
 public bool CanRemoveCondGroup(CondGroupVM condGroup)
 {
     return CondGroups.Count > 1;
 }
Ejemplo n.º 17
0
 public bool CanUpCondGroup(CondGroupVM condGroup)
 {
     int index = CondGroups.IndexOf(condGroup);
     if (index == 0)
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 18
0
 public void AddCondGroup(CondGroupVM condGroup)
 {
     CondGroupVM newCondGroup = CreateDefaultCondGroup();
     condGroups.Add(newCondGroup);
     OnCondGroupsOrderChanged();
 }
Ejemplo n.º 19
0
 public bool CanDownCondGroup(CondGroupVM condGroup)
 {
     int index = CondGroups.IndexOf(condGroup);
     if (index == CondGroups.Count - 1)
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 20
0
 public static CondGroupVM CreateDefault(BranchVM parent)
 {
     CondGroupVM condGroup = new CondGroupVM() { Parent = parent };
     CondVM cond = CondVM.CreateDefault(condGroup);
     condGroup.Conds.Add(cond);
     return condGroup;
 }
Ejemplo n.º 21
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;
 }
Ejemplo n.º 22
0
 public bool IsFirst(CondGroupVM condGroup)
 {
     return(condGroups.First() == condGroup);
 }
Ejemplo n.º 23
0
 public bool IsLast(CondGroupVM condGroup)
 {
     return(condGroups.Last() == condGroup);
 }
Ejemplo n.º 24
0
 public void UpCondGroup(CondGroupVM condGroup)
 {
     int index = CondGroups.IndexOf(condGroup);
     CondGroups.Move(index, index - 1);
     OnCondGroupsOrderChanged();
 }
Ejemplo n.º 25
0
 public bool CanRemoveCondGroup(CondGroupVM condGroup)
 {
     return(CondGroups.Count > 1);
 }
Ejemplo n.º 26
0
 public void RemoveCondGroup(CondGroupVM condGroup)
 {
     condGroups.Remove(condGroup);
     OnCondGroupsOrderChanged();
 }
Ejemplo n.º 27
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;
 }
Ejemplo n.º 28
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;
 }