/// <summary> /// 判断是否属于当前人审核 /// </summary> /// <param name="flowEngine"></param> /// <param name="userId"></param> /// <returns></returns> public bool CanAudit(FlowEngine flowEngine, int userId) { Step current = flowEngine.GetCurrent(); if (current == null || current.NodeValidCount == 0) { return(false); } IList <Node> nodes = current.Nodes; using (AppBLL bll = new AppBLL()) { IList <FunctionEntity> userFuncs = bll.FillList <FunctionEntity>("Usp_Funcs_ByUser", new { UserId = userId }); foreach (var userFunc in userFuncs) { var auditNodes = from node in nodes where node.Participant.Reference == userFunc.Id || node.Participant.Department == userId select node; if (auditNodes.Any()) { return(true); } } } return(false); }
private void Save(FlowEngine flowEngine) { if (flowEngine.Attachment.Owner == -1) { throw new ArgumentException("Owner is null"); } if (flowEngine.FlowState != FlowState.Finished) { FlowKey flowKey = new FlowKey() { Owner = flowEngine.Attachment.Owner }; if (!this.dicFlow.ContainsKey(flowKey)) { this.dicFlow.Add(flowKey, flowEngine); } else if (flowEngine.GetCurrent() == null) { this.dicFlow.Remove(flowKey); } else if (this.dicFlow.ContainsKey(flowKey)) { this.dicFlow[flowKey] = flowEngine; } } string fileName = FlowManager.GetFlowFile(flowEngine.Attachment.Owner); FlowEngine.Save(fileName, flowEngine); }