public object EvaluateFlowInputCondition(Flow fl) { string key = string.Format("Flow_{0}_{1}", fl.From.Id, fl.To.Id); return ExecuteScript(key, delegate() { return fl.InputCondition; }); }
public object EvaluateFlowInputCondition(Flow fl) { throw new NotImplementedException(); }
/// <summary> /// Check flow input condition /// </summary> /// <param name="fl"></param> /// <returns></returns> private bool EvaluateFlowInputCondition(Flow fl) { if (fl.InputCondition == null || fl.InputCondition.Length == 0) return true; //empty condition is true IProcessScript ctx = CreateProcessScriptContext(); object v = ctx.EvaluateFlowInputCondition(fl); return Convert.ToBoolean(v); }
private static int CompareFlowOrder(Flow f1, Flow f2) { if (f1.EvalOrder < 0) return 1; if (f2.EvalOrder < 0) return -1; if (f1.EvalOrder < f2.EvalOrder) return -1; else if (f1.EvalOrder > f2.EvalOrder) return 1; else return 0; }
internal void AddFlowOut(Flow f) { if (f.From != this) throw new Exception("Invalid flow source"); if (f.To == null) throw new Exception("Missing flow target"); Flow tm; if (_flowsOut.TryGetValue(f.To.Id, out tm)) { if (tm != f) throw new Exception("Flow already defined to " + f.To.Id); } else { _flowsOut[f.To.Id] = f; } }
/// <summary> /// Check flow input condition /// </summary> /// <param name="fl"></param> /// <returns></returns> private bool EvaluateFlowInputCondition(Flow fl) { if (fl.InputCondition == null || fl.InputCondition.Length == 0) return true; //empty condition is true IScriptContext ctx = CreateProcessScriptContext(); string expr = fl.InputCondition.Trim(); if (!expr.EndsWith(";")) expr += ";"; log.Debug("Evaluating flow {0} input condition: {1}", fl.ToString(), expr); object res = Script.RunCode(expr, ctx); log.Debug("Result: {0}", res); return Convert.ToBoolean(res); }