/// <summary> /// 保存xml文件 /// </summary> /// <param name="package"></param> public void SaveProcessFile(package package) { var xmlDoc = Serialize(package); var processGUID = package.process.id; var pm = new ProcessManager(); var entity = pm.GetByGUID(processGUID); if (entity != null) { var serverPath = ConfigHelper.GetAppSettingString("WorkflowFileServer"); var physicalFileName = string.Format("{0}\\{1}", serverPath, entity.XmlFilePath); //判断目录是否存在,否则创建 var pathName = Path.GetDirectoryName(physicalFileName); if (!Directory.Exists(pathName)) Directory.CreateDirectory(pathName); xmlDoc.Save(physicalFileName); } else { throw new ApplicationException(string.Format("无法获取流程定义记录! ProcessGUID: {0}", processGUID)); } }
public object Get() { ProcessManager pm = new ProcessManager(); var process = pm.GetByGUID("072AF8C3-482A-4B1C-890B-685CE2FCC75D"); return process; }
/// <summary> /// 流程定义数据读取 /// </summary> /// <param name="processGUID">流程定义GUID</param> /// <returns></returns> public ProcessEntity GetProcessById(string processGUID) { var pm = new ProcessManager(); var entity = pm.GetByGUID(processGUID); return entity; }
/// <summary> /// 删除流程定义记录 /// </summary> /// <param name="processGUID"></param> public void DeleteProcess(string processGUID) { IDbSession session = SessionFactory.CreateSession(); try { session.BeginTrans(); var processManager = new ProcessManager(); var entity = processManager.GetByGUID(processGUID); processManager.Delete(session.Connection, entity, session.Transaction); //delete the xml file var serverPath = ConfigHelper.GetAppSettingString("WorkflowFileServer"); var physicalFileName = string.Format("{0}\\{1}", serverPath, entity.XmlFilePath); File.Delete(physicalFileName); session.Commit(); } catch (System.Exception ex) { session.Rollback(); } finally { session.Dispose(); } }