private static FlowNode GetNodeByNodeType(string tmpkey, string nodeKey) { WF_TemplateNode node = nodebll.getByNodeKey(tmpkey, nodeKey); FlowNode flo = null; if (node.NodeType == (int)WFNodeType.BeginNode) { flo = new BeginNode(); } if (node.NodeType == (int)WFNodeType.EndNode) { flo = new EndNode(); } if (node.NodeType == (int)WFNodeType.Normal) { if (node.ProcessType == (int)WFProcessType.User) { flo = new UserNode(); } if (node.ProcessType == (int)WFProcessType.Role) { flo = new RoleNode(); } if (node.ProcessType == (int)WFProcessType.Custom) { WF_ApplyType apply = applytypebll.getByCode(node.ProcessTypeValue); Assembly assembly = Assembly.GetExecutingAssembly(); dynamic obj = assembly.CreateInstance(apply.ClassName); flo = (FlowNode)obj; } } return(flo); }
/// <summary> /// 获取申请节点后的节点 /// </summary> /// <returns></returns> private List <FlowNode> GetFirstNode() { List <FlowNode> firstNodeList = new List <FlowNode>(); List <WF_TemplateNode> nodelist = nodebll.getAllByTmpKey(this.Tmpkey); List <WF_Rule> rulelist = rulebll.getAllByTmpKey(this.Tmpkey); WF_TemplateNode beginNode = null; if (nodelist != null && nodelist.Count > 0) { foreach (WF_TemplateNode item in nodelist) { if (item.NodeType == (int)WFNodeType.BeginNode) { beginNode = item; break; } } } if (beginNode != null) { FlowNode firstnode = NodeFactory.getFlowNode(beginNode.Tmpkey, beginNode.Nodekey, this.endFlow); FlowContent flowcontent = new FlowContent(); flowcontent.CurrentInstanceID = this.InstanceID; firstNodeList = firstnode.GetNextNode(flowcontent); } return(firstNodeList); }
public static int Reopen(string todoUserCode, int instanceID, int isShow, int prevID, string taskName, int todotype, FlowNode node, string nodeKey, string currenUserCode) { WF_ToDo todo = new WF_ToDo(); WF_Instance instance = instanceBll.getByID(instanceID); WF_TemplateNode tmpNode = nodebll.getByNodeKey(instance.TmpKey, nodeKey); //todo 插入批号 todo.Batch = -1; todo.CreateTime = DateTime.Now; todo.CreateUserCode = currenUserCode; todo.InstanceID = instanceID; todo.IsDelete = 0; todo.IsShow = isShow; todo.Nodekey = nodeKey; todo.PrevID = prevID; todo.ResponseUserCode = todoUserCode; todo.State = (int)TodoState.UnDo; todo.ToDoName = taskName; todo.TodoType = todotype; todo.UpdateTime = DateTime.Now; todo.UpdateUserCode = currenUserCode; todo.URL = tmpNode.URL; int todoid = todobll.save(todo); return(todoid); }
public bool update(WF_TemplateNode entity) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); return(conn.Update <WF_TemplateNode>(entity)); } }
/// <summary> /// 驳回 /// </summary> /// <param name="vallist"></param> /// <param name="todoID"></param> /// <param name="operationUserCode"></param> /// <param name="operationType"></param> /// <param name="common"></param> /// <param name="flowcontent"></param> /// <param name="node"></param> /// <param name="toNodeKey"></param> private void Reject(Dictionary <string, string> vallist, int todoID, string operationUserCode, Operation operationType, string common, FlowContent flowcontent, FlowNode node, string toNodeKey) { ToDoHandle.DealTodo((int)operationType, operationUserCode, todoID); FlowVar var = new FlowVar(flowcontent.TmpKey, flowcontent.CurrentInstanceID); var.UpdateVal(vallist, this.CurrenUserCode); List <WF_ToDo> undolist = todobll.getList(flowcontent.CurrentInstanceID, node.NodeKey, (int)TodoState.UnDo); if (undolist != null && undolist.Count > 0) { foreach (WF_ToDo item in undolist) { ToDoHandle.DeleteTodo((int)operationType, operationUserCode, item.ID); } } WF_TemplateNode tmpnode = nodebll.getByNodeKey(flowcontent.TmpKey, node.NodeKey); if (tmpnode.IsGoBack == 0) { throw new Exception("改节点禁止退回"); } if (tmpnode.GoBackType == "every") { if (string.IsNullOrWhiteSpace(toNodeKey)) { throw new Exception("请选择需要退回到哪一个节点"); } } else { toNodeKey = tmpnode.GoBackType; } FlowNode toNode = NodeFactory.getFlowNode(flowcontent.TmpKey, toNodeKey, this.endFlow); NodeReturn ret = toNode.Run(flowcontent); //获取当前待办人的编号 List <string> newtodis = new List <string>(); List <string> newnodekey = new List <string>(); if (!ret.isOver) { List <string> userCodeList = ret.ToDoUserList; //循环遍历插入待办 if (userCodeList != null && userCodeList.Count > 0) { foreach (string user in userCodeList) { int todoid = ToDoHandle.InsertTodo(user.Trim(), flowcontent.CurrentInstanceID, (int)TodoIsShow.Show, -1, flowcontent.TaskName, (int)TodoType.Normal, toNode, toNode.NodeKey, CurrenUserCode); newtodis.Add(todoid.ToString()); } } flowcontent.CurrentTodoID = string.Join(", ", newtodis); flowcontent.CurrentNodeKey = toNodeKey; } operationbll.Insert(flowcontent.CurrentInstanceID, todoID, CurrenUserCode, (int)operationType, common); }
public bool save(WF_TemplateNode entity) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); conn.Insert <WF_TemplateNode>(entity); return(true); } }
public bool del(int id) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); WF_TemplateNode Role = conn.Get <WF_TemplateNode>(id); Role.IsDelete = 1; return(conn.Update <WF_TemplateNode>(Role)); } }
public List <FlowNode> GetNextNode(FlowContent flowContent) { List <WF_Rule> ruleList = rulebll.getRuleByTmpKeyAndBeginNodeKey(this.TmpKey, this.NodeKey); List <WF_InstanceVariable> varlist = varbll.getbyInstanceID(flowContent.CurrentInstanceID); List <WF_Rule> enableRule = new List <WF_Rule>(); List <Val> val = new List <Val>(); List <WF_TemplateNode> tmpNodeList = new List <WF_TemplateNode>(); List <FlowNode> flowNodeList = new List <FlowNode>(); if (varlist != null && varlist.Count > 0) { foreach (WF_InstanceVariable item in varlist) { Val v = new Val(); v.name = item.VarName; v.type = item.VarType; v.value = item.DefaultValue; val.Add(v); } } if (ruleList != null && ruleList.Count > 0) { foreach (WF_Rule item in ruleList) { if (RuleEngine.IsConformExpress(val, item.Expression)) { enableRule.Add(item); } } } if (enableRule != null && enableRule.Count > 0) { foreach (WF_Rule item in enableRule) { WF_TemplateNode afternode = nodebll.getByNodeKey(this.TmpKey, item.EndNodekey); tmpNodeList.Add(afternode); } } if (tmpNodeList != null && tmpNodeList.Count > 0) { foreach (WF_TemplateNode item in tmpNodeList) { FlowNode fn = NodeFactory.getFlowNode(item.Tmpkey, item.Nodekey, this.endFlow); flowNodeList.Add(fn); } } return(flowNodeList); }
public override NodeReturn Run(FlowContent flowContent) { NodeReturn ret = new NodeReturn(); if (flowContent.CurrentNodeKey.Split(',').Contains(this.NodeKey)) { ret.isOver = true; } else { ret.isOver = false; WF_TemplateNode node = nodebll.getByNodeKey(flowContent.TmpKey, this.NodeKey); string rolecode = node.ProcessTypeValue; List <WF_Role_User> userlist = roleuserbll.getRoleUserByRoleCode(rolecode); List <string> user = new List <string>(); user = userlist.Select(p => p.UserCode).ToList(); ret.ToDoUserList = user; } return(ret); }
public bool update(WF_TemplateNode entity) { return(dao.update(entity)); }
public bool save(WF_TemplateNode entity) { return(dao.save(entity)); }