/// <summary> /// 添加 流程线 /// </summary> /// <param name="doc"></param> /// <param name="dto"></param> /// <param name="flow"></param> private void AddLines(XmlDocument doc, FlowDesignerDto dto, ref WorkFlowDesign flow) { XmlNodeList lines = doc.DocumentElement.GetElementsByTagName("WorkFlowLine"); flow.Lines.Clear(); for (int i = 0; i < lines.Count; i++) { XmlElement line = (XmlElement)lines.Item(i); WorkFlowLine flowLine = new WorkFlowLine(); var id = line.GetAttribute("Id"); if (string.IsNullOrWhiteSpace(id)) { line.SetAttribute("Id", Guid.NewGuid().ToString()); } flowLine.Id = Guid.Parse(line.GetAttribute("Id")); flowLine.FlowDesignId = dto.Id; XmlNodeList listCell = line.GetElementsByTagName("mxCell"); if (listCell.Count == 1) { flowLine.FromStepId = Int16.Parse(((XmlElement)listCell.Item(0)).GetAttribute("source")); var fid = flow.Id; flowLine.FromStepName = flow.Steps.ToList().Find(c => c.FlowDesignId == fid && c.StepId == flowLine.FromStepId).StepName; flowLine.ToStepId = Int16.Parse(((XmlElement)listCell.Item(0)).GetAttribute("target")); flowLine.ToStepName = flow.Steps.ToList().Find(c => c.FlowDesignId == fid && c.StepId == flowLine.ToStepId).StepName; } flowLine.CustomMethod = line.GetAttribute("CustomMethod"); flowLine.Sql = line.GetAttribute("Sql"); flowLine.HandlerIds = line.GetAttribute("HandlerIds"); flowLine.HandlerNames = line.GetAttribute("HandlerNames"); flow.Lines.Add(flowLine); } }
/// <summary> /// 添加 流程线 /// </summary> /// <param name="doc"></param> /// <param name="dto"></param> /// <param name="flow"></param> private void AddLines(XmlDocument doc, FlowDesignerDto dto, ref WorkFlowDesign flow) { XmlNodeList lines = doc.DocumentElement.GetElementsByTagName("WorkFlowLine"); flow.Lines.Clear(); for (int i = 0; i < lines.Count; i++) { XmlElement line = (XmlElement)lines.Item(i); WorkFlowLine flowLine = new WorkFlowLine(); var id= line.GetAttribute("Id"); if (string.IsNullOrWhiteSpace(id)) line.SetAttribute("Id", Guid.NewGuid().ToString()); flowLine.Id = Guid.Parse(line.GetAttribute("Id")); flowLine.FlowDesignId = dto.Id; XmlNodeList listCell = line.GetElementsByTagName("mxCell"); if (listCell.Count == 1) { flowLine.FromStepId = Int16.Parse(((XmlElement)listCell.Item(0)).GetAttribute("source")); var fid = flow.Id; flowLine.FromStepName = flow.Steps.ToList().Find(c => c.FlowDesignId == fid && c.StepId == flowLine.FromStepId).StepName; flowLine.ToStepId = Int16.Parse(((XmlElement)listCell.Item(0)).GetAttribute("target")); flowLine.ToStepName = flow.Steps.ToList().Find(c => c.FlowDesignId == fid && c.StepId == flowLine.ToStepId).StepName; } flowLine.CustomMethod = line.GetAttribute("CustomMethod"); flowLine.Sql = line.GetAttribute("Sql"); flowLine.HandlerIds = line.GetAttribute("HandlerIds"); flowLine.HandlerNames = line.GetAttribute("HandlerNames"); flow.Lines.Add(flowLine); } }