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; } } }
public void AddCond(CondVM cond) { CondVM newCond = CondVM.CreateDefault(this); Conds.Add(newCond); OnCondsOrderChanged(); }
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; } } }
public void DownCond(CondVM cond) { int index = Conds.IndexOf(cond); Conds.Move(index, index + 1); OnCondsOrderChanged(); }
public CondVM DeepCopy(BaseVM parent) { CondVM newCond = new CondVM(); newCond.Parent = parent; newCond.SelectedQuestionConstruct = SelectedQuestionConstruct; newCond.selectedOperatorCode = SelectedOperatorCode; newCond.CondValue = CondValue; return(newCond); }
public bool CanUpCond(CondVM cond) { int index = Conds.IndexOf(cond); if (index == 0) { return(false); } return(true); }
public bool CanDownCond(CondVM cond) { int index = Conds.IndexOf(cond); if (index == Conds.Count - 1) { return(false); } return(true); }
public static CondGroupVM CreateDefault(BranchVM parent) { CondGroupVM condGroup = new CondGroupVM() { Parent = parent }; CondVM cond = CondVM.CreateDefault(condGroup); condGroup.Conds.Add(cond); return(condGroup); }
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); }
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); }
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); }
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); }
public CondVM DeepCopy(BaseVM parent) { CondVM newCond = new CondVM(); newCond.Parent = parent; newCond.SelectedQuestionConstruct = SelectedQuestionConstruct; newCond.selectedOperatorCode = SelectedOperatorCode; newCond.CondValue = CondValue; return newCond; }
public bool CanRemoveCond(CondVM cond) { return Conds.Count > 1; }
public bool IsLastCond(CondVM cond) { return Conds.Last() == cond; }
public bool CanAddCond(CondVM cond) { return(cond.IsLast); }
public bool IsLastCond(CondVM cond) { return(Conds.Last() == cond); }
public bool CanAddCond(CondVM cond) { return cond.IsLast; }
public bool CanDownCond(CondVM cond) { int index = Conds.IndexOf(cond); if (index == Conds.Count - 1) { return false; } return true; }
public void UpCond(CondVM cond) { int index = Conds.IndexOf(cond); Conds.Move(index, index - 1); OnCondsOrderChanged(); }
public bool CanUpCond(CondVM cond) { int index = Conds.IndexOf(cond); if (index == 0) { return false; } return true; }
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; }
public void RemoveCond(CondVM cond) { Conds.Remove(cond); OnCondsOrderChanged(); }
public bool CanRemoveCond(CondVM cond) { return(Conds.Count > 1); }
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; }