/// <summary> /// 保存流程定义的xml文件 /// </summary> /// <param name="diagram"></param> public void SaveProcessFile(ProcessFileEntity entity) { var pm = new ProcessManager(); pm.SaveProcessFile(entity); }
public ResponseResult SaveProcessFile(ProcessFileEntity entity) { var result = ResponseResult.Default(); try { var wfService = new WorkflowService(); wfService.SaveProcessFile(entity); result = ResponseResult.Success(); } catch (System.Exception ex) { result = ResponseResult<ProcessFileEntity>.Error( string.Format("保存流程XML文件失败!{0}", ex.Message) ); } return result; }
/// <summary> /// 读取流程XML文件内容 /// </summary> /// <returns></returns> internal ProcessFileEntity GetProcessFile() { var xmlDoc = GetProcessXmlDocument(); var entity = new ProcessFileEntity(); entity.ProcessGUID = ProcessEntity.ProcessGUID; entity.ProcessName = ProcessEntity.ProcessName; entity.Description = ProcessEntity.Description; entity.XmlContent = xmlDoc.OuterXml; return entity; }
/// <summary> /// 保存XML文件 /// </summary> /// <param name="entity"></param> internal void SaveProcessFile(ProcessFileEntity entity) { try { var filePath = ProcessEntity.XmlFilePath; var serverPath = ConfigHelper.GetAppSettingString("WorkflowFileServer"); var physicalFileName = serverPath + "\\" + filePath; var path = Path.GetDirectoryName(physicalFileName); if (!Directory.Exists(path)) Directory.CreateDirectory(path); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(entity.XmlContent); xmlDoc.Save(physicalFileName); } catch (System.Exception ex) { throw new ApplicationException(string.Format("保存流程定义XML文件失败,错误: {0}", ex.Message)); } }
/// <summary> /// 保存流程定义的xml文件 /// </summary> /// <param name="diagram"></param> public void SaveProcessFile(ProcessFileEntity entity) { var processModel = new ProcessModel(entity.ProcessGUID); processModel.SaveProcessFile(entity); }
/// <summary> /// 读取流程XML文件内容 /// </summary> /// <returns></returns> internal ProcessFileEntity GetProcessFile(string processGUID, string version) { var processEntity = GetByVersion(processGUID, version); XmlDocument xmlDoc = null; if (XPDLReader != null && XPDLReader.IsReadable() == true) { xmlDoc = XPDLReader.Read(processEntity); } else { xmlDoc = GetProcessXmlDocument(processEntity.XmlFilePath); } var processFileEntity = new ProcessFileEntity(); processFileEntity.ProcessGUID = processEntity.ProcessGUID; processFileEntity.ProcessName = processEntity.ProcessName; processFileEntity.Version = processEntity.Version; processFileEntity.Description = processEntity.Description; processFileEntity.XmlContent = xmlDoc.OuterXml; return processFileEntity; }