进程清除后仍会触发升级

时间:2018-06-07 11:24:39

标签: c# k2

我有一个工作流程,其中有一个升级。

将在设定日期触发升级。我正在清理K2中的流程,但是,我的升级仍然被触发,任何想法为什么?

public void ClearInstancesFromK2(int accountApplicationID)
{
    var arrProcessInstances = new System.Collections.ArrayList();

    using (var k2Manager = new K2Manager())
    {
        var alphaProcessFolder = GetAlphaProcessFolder(k2Manager.GetK2Manager());

        if (alphaProcessFolder != null)
        {
            var processSets = alphaProcessFolder.ProcessSets;

            foreach (ProcessSet processSet in processSets)
            {
                var processInstances = k2Manager.GetK2Manager().GetProcessInstancesProcSet((long)processSet.ProcSetID, accountApplicationID.ToString(), "", null, null);
                foreach (SourceCode.K2Mng.ProcessInstance item in processInstances)
                {
                    if (item.Folio == accountApplicationID.ToString())
                    {
                        item.ProcSetFullName = processSet.Name;    //Just assign the process set's name for read in the delete method
                        arrProcessInstances.Add(item);       //Add the item to the arraylist..
                    }
                }
            }

            foreach (SourceCode.K2Mng.ProcessInstance instance in arrProcessInstances)
            {
                if (instance.Folio == accountApplicationID.ToString())
                {
                    k2Manager.GetK2Manager().DeleteProcessInstances(instance.ID, true);
                    // log the user who deleted the process
                    //JournalLogger.LogJournalEntry(System.Convert.ToInt32(accountApplicationID.ToString()), "Processes instance deleted from K2: " + instance.ProcSetFullName + " ");
                }
            }
        }
    }
}

0 个答案:

没有答案