public static bool DeleteProcessInstance(int proinstaceid) { bool result = false; SourceCode.Workflow.Management.WorkflowManagementServer wms = new SourceCode.Workflow.Management.WorkflowManagementServer(); try { wms.Open(ConfigurationManager.AppSettings["K2ConnectionDel"]); //这个false代表是否会删除K2ServerLog中的数据,false代表不删除,true代表删除 wms.DeleteProcessInstances(proinstaceid, false); result = true; } catch (Exception) { result = false; throw; } finally { wms.Connection.Close(); } return(result); }