public TFlowFlownodeFlow FlowFristNode(string loginKey, ref ErrorInfo err, int flowId, string status) { using (DBEntities db = new DBEntities()) { var ent = db.YL_FLOW_FLOWNODE_FLOW.SingleOrDefault(x => x.FLOW_ID == flowId && x.FROM_FLOWNODE_ID == 9999); var reEnt = new TFlowFlownodeFlow(); if (ent != null) { List <YL_FLOW_FLOWNODE_FLOW> nextNodeArr = db.YL_FLOW_FLOWNODE_FLOW.Where(x => x.FLOW_ID == flowId && x.FROM_FLOWNODE_ID == ent.TO_FLOWNODE_ID && x.STATUS == status).ToList(); if (string.IsNullOrEmpty(status)) { nextNodeArr = db.YL_FLOW_FLOWNODE_FLOW.Where(x => x.FLOW_ID == flowId && x.FROM_FLOWNODE_ID == ent.TO_FLOWNODE_ID).ToList(); } else { nextNodeArr = db.YL_FLOW_FLOWNODE_FLOW.Where(x => x.FLOW_ID == flowId && x.FROM_FLOWNODE_ID == ent.TO_FLOWNODE_ID && x.STATUS == status).ToList(); } if (nextNodeArr.Count() > 0) { var nextNode = nextNodeArr[0]; reEnt = Fun.ClassToCopy <YL_FLOW_FLOWNODE_FLOW, TFlowFlownodeFlow>(nextNode); var allNextRole = db.YL_ROLE.Where(x => x.YL_FLOW_FLOWNODE_FLOW.Where(y => y.FROM_FLOWNODE_ID == nextNode.TO_FLOWNODE_ID && y.FLOW_ID == flowId).Count() > 0).ToList(); reEnt.AllRoleIDList = allNextRole.Select(x => x.ID).ToList(); reEnt.AllRoleStr = string.Join(",", reEnt.AllRoleIDList); reEnt.HandleUrl = nextNode.YL_FLOW_FLOWNODE.HANDLE_URL; reEnt.ShowUrl = nextNode.YL_FLOW_FLOWNODE.SHOW_URL; return(reEnt); } } return(null); } }
public TFlowFlownodeFlow FlowGetNodeFlow(string loginKey, ref ErrorInfo err, int flowId, int fromFlownodeId, string statusName) { using (DBEntities db = new DBEntities()) { var nextNode = db.YL_FLOW_FLOWNODE_FLOW.Single(x => x.FLOW_ID == flowId && x.FROM_FLOWNODE_ID == fromFlownodeId && x.STATUS == statusName); var reEnt = new TFlowFlownodeFlow(); if (nextNode != null) { reEnt = Fun.ClassToCopy <YL_FLOW_FLOWNODE_FLOW, TFlowFlownodeFlow>(nextNode); reEnt.AllRoleIDList = nextNode.YL_ROLE.Select(x => x.ID).ToList(); reEnt.AllRoleStr = string.Join(",", reEnt.AllRoleIDList); reEnt.HandleUrl = nextNode.YL_FLOW_FLOWNODE.HANDLE_URL; reEnt.ShowUrl = nextNode.YL_FLOW_FLOWNODE.SHOW_URL; return(reEnt); } return(null); } }