public void GetRoutJsonById(HttpContext context) { string routId = context.Request["routId"]; var actor = RF.Concrete <IWFActorRepository>(); var list = actor.GetByRoutId(Guid.Parse(routId)); List <NodeModle> legend = new List <NodeModle>(); foreach (var item in list) { NodeModle model = new NodeModle(); model.NodeName = item.Name; model.Text = item.Name; model.Visible = true; model.Status = NodeModle.STATUS.W; model.DisplayType = NodeModle.DISPALY_TYPE.TEXT; model.NodeType = NodeModle.NODE_TYPE.FLOWNODE; var actorUsers = actor.GetActorUserByActorId(item.ID); if (actorUsers != null && actorUsers.Count > 0) { model.subNodes = new List <NodeModle>(); foreach (var au in actorUsers) { model.subNodes.Add(new NodeModle { NodeName = au.User.Name, Text = au.User.Name, Visible = true, Status = NodeModle.STATUS.W, DisplayType = NodeModle.DISPALY_TYPE.TEXT, NodeType = NodeModle.NODE_TYPE.TASKNODE }); } } legend.Add(model); } JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); string jsonStr = jsonSerializer.Serialize(legend); context.Response.Write(jsonStr); }
public void GetRoutJsonById(HttpContext context) { string routId = context.Request["routId"]; var actor = RF.Concrete<IWFActorRepository>(); var list = actor.GetByRoutId(Guid.Parse(routId)); List<NodeModle> legend = new List<NodeModle>(); foreach (var item in list) { NodeModle model = new NodeModle(); model.NodeName = item.Name; model.Text = item.Name; model.Visible = true; model.Status = NodeModle.STATUS.W; model.DisplayType = NodeModle.DISPALY_TYPE.TEXT; model.NodeType = NodeModle.NODE_TYPE.FLOWNODE; var actorUsers = actor.GetActorUserByActorId(item.ID); if (actorUsers != null && actorUsers.Count > 0) { model.subNodes = new List<NodeModle>(); foreach (var au in actorUsers) { model.subNodes.Add(new NodeModle { NodeName = au.User.Name, Text = au.User.Name, Visible = true, Status = NodeModle.STATUS.W, DisplayType = NodeModle.DISPALY_TYPE.TEXT, NodeType = NodeModle.NODE_TYPE.TASKNODE }); } } legend.Add(model); } JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); string jsonStr =jsonSerializer.Serialize(legend); context.Response.Write(jsonStr); }