/// <summary> /// 删除流程记录 /// </summary> /// <param name="processGUID">流程定义GUID</param> /// <param name="version">版本</param> /// <param name="localStorage">本地存储</param> public void DeleteProcess(string processGUID, string version, IXPDLStorage localStorage) { IDbSession session = SessionFactory.CreateSession(); try { session.BeginTrans(); var entity = GetByVersion(processGUID, version); string strSql = @"DELETE FROM WfProcess WHERE ProcessGUID=@processGUID AND Version=@version"; Repository.Execute(session.Connection, strSql, new { processGUID = processGUID, version = version }, session.Transaction); if (localStorage != null) { //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(); throw; } finally { session.Dispose(); } }
/// <summary> /// 读取Xml文档 /// </summary> /// <param name="processGUID">流程GUID</param> /// <param name="version">版本</param> /// <param name="extStorage">存储</param> /// <returns>Xml文档</returns> internal XmlDocument GetProcessXmlDocument(string processGUID, string version, IXPDLStorage extStorage = null) { var processEntity = GetByVersion(processGUID, version); var xmlDoc = new XmlDocument(); if (extStorage != null) { xmlDoc = extStorage.Read(processEntity); } else { xmlDoc.LoadXml(processEntity.XmlContent); } return(xmlDoc); }
/// <summary> /// 读取流程XML文件内容 /// </summary> /// <param name="processGUID">流程GUID</param> /// <param name="version">版本</param> /// <param name="extStorage">存储</param> /// <returns>流程文件实体</returns> internal ProcessFileEntity GetProcessFile(string processGUID, string version, IXPDLStorage extStorage = null) { var processEntity = GetByVersion(processGUID, version); //流程文件实体 var processFileEntity = new ProcessFileEntity(); processFileEntity.ProcessGUID = processEntity.ProcessGUID; processFileEntity.ProcessName = processEntity.ProcessName; processFileEntity.Version = processEntity.Version; processFileEntity.Description = processEntity.Description; if (extStorage != null) { //扩展方式读取xml文件内容 var xmlDoc = extStorage.Read(processEntity); processFileEntity.XmlContent = xmlDoc.OuterXml; } else { processFileEntity.XmlContent = processEntity.XmlContent; } return(processFileEntity); }
/// <summary> /// 读取流程XML文件内容 /// </summary> /// <param name="processGUID">流程GUID</param> /// <param name="version">版本</param> /// <param name="extStorage">存储</param> /// <returns>流程文件实体</returns> internal ProcessFileEntity GetProcessFile(string processGUID, string version, IXPDLStorage extStorage = null) { var processEntity = GetByVersion(processGUID, version); var processFileEntity = FillProcessFileEntity(processEntity); return(processFileEntity); }