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

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

            Conds.Move(index, index + 1);
            OnCondsOrderChanged();
        }
示例#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);
        }
示例#6
0
        public bool CanUpCond(CondVM cond)
        {
            int index = Conds.IndexOf(cond);

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

            if (index == Conds.Count - 1)
            {
                return(false);
            }
            return(true);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
 }
示例#12
0
文件: BranchVM.cs 项目: ssjda-ddi/EDO
        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);
        }
示例#13
0
 public void AddCond(CondVM cond)
 {
     CondVM newCond = CondVM.CreateDefault(this);
     Conds.Add(newCond);
     OnCondsOrderChanged();
 }
示例#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;
 }
示例#15
0
 public bool CanRemoveCond(CondVM cond)
 {
     return Conds.Count > 1;
 }
示例#16
0
 public bool IsLastCond(CondVM cond)
 {
     return Conds.Last() == cond;
 }
示例#17
0
 public bool CanAddCond(CondVM cond)
 {
     return(cond.IsLast);
 }
示例#18
0
 public bool IsLastCond(CondVM cond)
 {
     return(Conds.Last() == cond);
 }
示例#19
0
 public bool CanAddCond(CondVM cond)
 {
     return cond.IsLast;
 }
示例#20
0
 public bool CanDownCond(CondVM cond)
 {
     int index = Conds.IndexOf(cond);
     if (index == Conds.Count - 1)
     {
         return false;
     }
     return true;
 }
示例#21
0
 public void UpCond(CondVM cond)
 {
     int index = Conds.IndexOf(cond);
     Conds.Move(index, index - 1);
     OnCondsOrderChanged();
 }
示例#22
0
 public bool CanUpCond(CondVM cond)
 {
     int index = Conds.IndexOf(cond);
     if (index == 0)
     {
         return false;
     }
     return true;
 }
示例#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;
 }
示例#24
0
 public void RemoveCond(CondVM cond)
 {
     Conds.Remove(cond);
     OnCondsOrderChanged();
 }
示例#25
0
 public bool CanRemoveCond(CondVM cond)
 {
     return(Conds.Count > 1);
 }
示例#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;
 }
示例#27
0
 public void RemoveCond(CondVM cond)
 {
     Conds.Remove(cond);
     OnCondsOrderChanged();
 }