private static IEnumerable <IUser> AllElapsedOperators(object callerContext) { List <IUser> result = new List <IUser>(); if (callerContext is WfConditionDescriptor) { WfConditionDescriptor condition = (WfConditionDescriptor)callerContext; if (condition.Owner != null) { foreach (IWfActivity activity in condition.Owner.ProcessInstance.Activities) { if (activity.Status == WfActivityStatus.Completed) { if (OguUser.IsNotNullOrEmpty(activity.Operator)) { if (result.NotExists(u => string.Compare(u.ID, activity.Operator.ID, true) == 0)) { result.Add(activity.Operator); } } } } } } return(result); }
public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { WfConditionDescriptor condition = new WfConditionDescriptor(); condition.Expression = DictionaryHelper.GetValue(dictionary, "Expression", string.Empty); return(condition); }
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer) { WfConditionDescriptor condition = new WfConditionDescriptor(); condition.Expression = DictionaryHelper.GetValue(dictionary, "Expression", string.Empty); return condition; }
public WfConditionDescriptor Clone() { WfConditionDescriptor condition = new WfConditionDescriptor(this.Owner); condition.Expression = this.Expression; return condition; }
public WfConditionDescriptor Clone() { WfConditionDescriptor condition = new WfConditionDescriptor(this.Owner); condition.Expression = this.Expression; return(condition); }
public void ClientToServer(WfClientConditionDescriptor client, ref WfConditionDescriptor server) { client.NullCheck("client"); if (server == null) server = new WfConditionDescriptor(null); server.Expression = client.Expression; }
public void ServerToClient(WfConditionDescriptor server, ref WfClientConditionDescriptor client) { server.NullCheck("server"); if (client == null) client = new WfClientConditionDescriptor(); client.Expression = server.Expression; }
public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { WfConditionDescriptor condition = (WfConditionDescriptor)obj; Dictionary <string, object> dictionary = new Dictionary <string, object>(); DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "Expression", condition.Expression); return(dictionary); }
public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { WfDynamicResourceDescriptor dynResourceDesp = (WfDynamicResourceDescriptor)base.Deserialize(dictionary, type, serializer); dynResourceDesp.Name = DictionaryHelper.GetValue(dictionary, "Name", string.Empty); WfConditionDescriptor condition = JSONSerializerExecute.Deserialize <WfConditionDescriptor>(dictionary["Condition"]); dynResourceDesp.Condition = condition; return(dynResourceDesp); }
public void SyncPropertiesToFields(PropertyValue property) { if (property != null) { this.Expression = string.Empty; if (property.StringValue.IsNotEmpty()) { WfConditionDescriptor condition = JSONSerializerExecute.Deserialize <WfConditionDescriptor>(property.StringValue); this.Expression = condition.Expression; } } }
private static bool AreSameCandidates(object callerContext) { bool result = false; if (callerContext is WfConditionDescriptor) { WfConditionDescriptor condition = (WfConditionDescriptor)callerContext; if (condition.Owner != null && condition.Owner is IWfTransitionDescriptor) { IWfTransitionDescriptor transitionDesp = (IWfTransitionDescriptor)condition.Owner; result = AreSameCandidates(transitionDesp.FromActivity, transitionDesp.ToActivity); } } return(result); }
private static bool AreSameCandidates(string actDesp1, string actDesp2, object callerContext) { bool result = false; if (callerContext is WfConditionDescriptor && actDesp1.IsNotEmpty() && actDesp2.IsNotEmpty()) { WfConditionDescriptor condition = (WfConditionDescriptor)callerContext; if (condition.Owner != null) { IWfProcess process = condition.Owner.ProcessInstance; result = AreSameCandidates(process.Descriptor.Activities[actDesp1], process.Descriptor.Activities[actDesp2]); } } return(result); }
private static string BranchesReturnValue(object callerContext) { string result = BranchProcessReturnType.AllTrue.ToString(); if (callerContext is WfConditionDescriptor) { WfConditionDescriptor condition = (WfConditionDescriptor)callerContext; if (condition.Owner != null) { IWfProcess process = condition.Owner.ProcessInstance; result = condition.Owner.ProcessInstance.CurrentActivity.BranchProcessReturnValue.ToString(); } } return(result); }
private static object GetConditionValueFromAppRuntimeParameters(WfConditionDescriptor condition, string funcName) { WfApplicationParametersContext context = WfApplicationParametersContext.Current; object result = null; //首先从上下文中查找参数 if (context != null) { result = context.ApplicationRuntimeParameters.GetValue(funcName, (object)null); } if (result == null && condition != null && condition.Owner != null) { result = GetProcessAppRuntimeParameters(condition.Owner.ProcessInstance, funcName); } return(result); }
private static SOARoleContext PrepareRoleContext(IRole role, object callerContext) { SOARoleContext result = null; if (callerContext is WfConditionDescriptor) { WfConditionDescriptor condition = (WfConditionDescriptor)callerContext; IWfProcess process = null; if (condition.Owner != null) { process = condition.Owner.ProcessInstance; } result = SOARoleContext.CreateContext(role, process); } return(result); }
public void WfConditionOfProcessDescriptorConverterTest() { WfConverterHelper.RegisterConverters(); WfProcessDescriptor processDesp = (WfProcessDescriptor)WfProcessTestCommon.CreateSimpleProcessDescriptor(); WfConditionDescriptor conditionDesp = new WfConditionDescriptor() { Expression = "A>5" }; ((WfForwardTransitionDescriptor)processDesp.InitialActivity.ToTransitions[0]).Condition = conditionDesp; string result = JSONSerializerExecute.Serialize(processDesp); Console.WriteLine(result); WfProcessDescriptor reProcessDesp = JSONSerializerExecute.Deserialize<WfProcessDescriptor>(result); Assert.AreEqual(conditionDesp.Expression, ((WfForwardTransitionDescriptor)reProcessDesp.InitialActivity.ToTransitions[0]).Condition.Expression); string reSerialized = JSONSerializerExecute.Serialize(reProcessDesp); Assert.AreEqual(result, reSerialized); }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="condition"></param> public WfEvaluationExceptionBase(string message, System.Exception innerException, WfConditionDescriptor condition) : base(message, innerException) { this._Condition = condition; }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="condition"></param> public WfEvaluationExceptionBase(string message, WfConditionDescriptor condition) : base(message) { this._Condition = condition; }
private static object GetConditionValueFromAppRuntimeParameters(WfConditionDescriptor condition, string funcName) { WfApplicationParametersContext context = WfApplicationParametersContext.Current; object result = null; //首先从上下文中查找参数 if (context != null) result = context.ApplicationRuntimeParameters.GetValue(funcName, (object)null); if (result == null && condition != null && condition.Owner != null) result = GetProcessAppRuntimeParameters(condition.Owner.ProcessInstance, funcName); return result; }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="condition"></param> public WfConditionEvaluationException(string message, System.Exception innerException, WfConditionDescriptor condition) : base(message, innerException, condition) { }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="condition"></param> public WfDynamicResourceEvaluationException(string message, WfConditionDescriptor condition) : base(message, condition) { }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="condition"></param> public WfConditionEvaluationException(string message, WfConditionDescriptor condition) : base(message, condition) { }
public static void AreSame(this WfClientConditionDescriptor c, WfConditionDescriptor s) { Assert.IsNotNull(c); Assert.IsNotNull(s); Assert.AreEqual(c.Expression, s.Expression); }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="condition"></param> public WfDynamicResourceEvaluationException(string message, System.Exception innerException, WfConditionDescriptor condition) : base(message, innerException, condition) { }