public ContentResult SaveTmp(string jsonString) { AjaxResult res = new AjaxResult(); try { WF_Template role = jsonString.ToObject <WF_Template>(); WF_Template entity = tmpbll.getByID(role.ID); if (entity != null) { role.UpdateTime = DateTime.Now; role.UpdateUserCode = getCurrent().UserCode; role.CreateTime = entity.CreateTime; role.CreateUserCode = entity.CreateUserCode; tmpbll.update(role); } else { role.UpdateTime = DateTime.Now; role.UpdateUserCode = getCurrent().UserCode; role.CreateTime = DateTime.Now; role.CreateUserCode = getCurrent().UserCode; tmpbll.save(role); } res.code = ResultCode.OK; } catch (Exception ex) { res.code = ResultCode.ERROR; res.message = "保存失败"; } return(Content(res.ToJson())); }
public bool update(WF_Template entity) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); return(conn.Update <WF_Template>(entity)); } }
public bool save(WF_Template entity) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); conn.Insert <WF_Template>(entity); return(true); } }
private static Flow GetFlowByTmpKey(string tmpkey) { WF_Template tmp = tmpbll.getByKey(tmpkey); Assembly assembly = Assembly.GetExecutingAssembly(); dynamic obj = assembly.CreateInstance(tmp.ClassName); Flow flo = (Flow)obj; return(flo); }
public bool del(int id) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); WF_Template Role = conn.Get <WF_Template>(id); Role.IsDelete = 1; return(conn.Update <WF_Template>(Role)); } }
public static Flow getFlow(string tmpkey, string currenUserCode) { WF_Template tmp = tmpbll.getByKey(tmpkey); Flow flo = GetFlowByTmpKey(tmpkey); flo.Tmpkey = tmpkey; flo.FormName = tmp.TmpName; flo.CurrenUserCode = currenUserCode; flo.Init(); return(flo); }
public static Flow getFlowByTodo(int todoid, string currenUserCode) { WF_ToDo todo = todobll.getByID(todoid); WF_Instance instance = instancebll.getByID(todo.InstanceID); WF_Template tmp = tmpbll.getByKey(instance.TmpKey); Flow flo = GetFlowByTmpKey(tmp.key); flo.Tmpkey = instance.TmpKey; flo.FormName = tmp.TmpName; flo.CurrenUserCode = currenUserCode; flo.ApplyUserCode = instance.ApplyUserCode; flo.FormID = instance.FormID; flo.InstanceID = instance.ID; flo.InstanceState = instance.State; flo.TodoID = todoid; flo.WriterUserCode = instance.WriterUserCode; flo.Init(); return(flo); }
public ContentResult UpdateTmpState(int id, int state) { AjaxResult res = new AjaxResult(); try { WF_Template entity = tmpbll.getByID(id); if (entity != null) { entity.State = state; tmpbll.update(entity); } res.code = ResultCode.OK; res.message = "更新状态成功"; } catch (Exception ex) { res.code = ResultCode.ERROR; res.message = "更新状态失败"; } return(Content(res.ToJson())); }
public ContentResult getTmpByID(int id) { AjaxResult res = new AjaxResult(); try { WF_Template role = tmpbll.getByID(id); if (role == null) { role = new WF_Template(); role.ID = id; role.State = 1; } res.code = ResultCode.OK; res.data = role; } catch (Exception ex) { res.code = ResultCode.ERROR; res.message = "获取流程模板信息失败"; } return(Content(res.ToJson())); }
public bool update(WF_Template entity) { return(dao.update(entity)); }
public bool save(WF_Template entity) { return(dao.save(entity)); }
/// <summary> /// 流程启动 /// </summary> /// <param name="vallist">流程实例变量</param> /// <param name="applyUserCode">申请人员工编号</param> /// <param name="writerUserCode">填表人员工编号</param> /// <param name="formID">单据编号</param> public void StartFlow(Dictionary <string, string> vallist, string applyUserCode, string writerUserCode, string formID) { //插入流程实例 int instanceID = this.InsertInstance((int)WF.Common.InstanceState.Enable, formID, this.CurrenUserCode, writerUserCode, applyUserCode); WF_Template tmp = tmpbll.getByKey(this.Tmpkey); this.InstanceID = instanceID; this.ApplyUserCode = applyUserCode; this.WriterUserCode = writerUserCode; this.FormID = formID; this.InstanceState = (int)WF.Common.InstanceState.Enable; //触发启动前事件 FlowContent flowcontent = new FlowContent(); flowcontent.CurrenUserCode = this.CurrenUserCode; flowcontent.TmpKey = this.Tmpkey; flowcontent.CurrentInstanceID = instanceID; flowcontent.OperationType = (int)Common.Operation.Start; flowcontent.TaskName = tmp.TmpName; flowcontent.InstanceState = (int)WF.Common.InstanceState.Enable; flowcontent.CurrentNodeKey = ""; flowcontent.FormID = formID; if (this.beforStartFlow != null) { this.beforStartFlow(flowcontent); } //更新流程变量 FlowVar var = new FlowVar(this.Tmpkey, instanceID); //先将流程模板变量copy到流程实例 var.copyVarByTmpKey(this.CurrenUserCode); //更新流程实例的变量 var.UpdateVal(vallist, this.CurrenUserCode); //获取第一个节点 List <FlowNode> firstNode = this.GetFirstNode(); //获取当前待办人的编号 List <string> newtodis = new List <string>(); List <string> newnodekey = new List <string>(); if (firstNode != null && firstNode.Count > 0) { foreach (FlowNode node in firstNode) { NodeReturn noderet = node.Run(flowcontent); if (!noderet.isOver) { newnodekey.Add(node.NodeKey); List <string> userCodeList = noderet.ToDoUserList; //循环遍历插入待办 if (userCodeList != null && userCodeList.Count > 0) { foreach (string item in userCodeList) { int todoid = ToDoHandle.InsertTodo(item.Trim(), instanceID, (int)TodoIsShow.Show, -1, flowcontent.TaskName, (int)TodoType.Normal, node, node.NodeKey, CurrenUserCode); newtodis.Add(todoid.ToString()); } } } } } operationbll.Insert(instanceID, -1, CurrenUserCode, (int)Common.Operation.Start, "启动流程"); flowcontent.CurrentNodeKey = string.Join(", ", newnodekey);; flowcontent.CurrentTodoID = string.Join(", ", newtodis); //触发启动后事件 if (this.afterStartFlow != null) { this.afterStartFlow(flowcontent); } }