示例#1
0
    public void UpdateDataFields(int procInstID, Dictionary <string, string> dict)
    {
        Connection k2Conn = new Connection();

        try
        {
            k2Conn.Open(K2ServerName, WorkflowHelper.GetConnString());

            SourceCode.Workflow.Client.ProcessInstance inst = k2Conn.OpenProcessInstance(procInstID);
            if (inst != null)
            {
                foreach (string s in dict.Keys)
                {
                    inst.DataFields[s].Value = dict[s];
                }
            }
            else
            {
                Response.Redirect("ProcessesManage_List.aspx", false);
            }
            inst.Update();

            k2Conn.Close();
        }
        catch
        {
            k2Conn.Close();
        }
    }
示例#2
0
    /// <summary>
    /// 绑定默认DataFields
    /// </summary>
    /// <param name="procInstID"></param>
    private void LoadDataFields(int procInstID)
    {
        List <BPMListItem> items  = new List <BPMListItem>();
        Connection         k2Conn = new Connection();

        try
        {
            k2Conn.Open(K2ServerName, WorkflowHelper.GetConnString());
            SourceCode.Workflow.Client.ProcessInstance inst = k2Conn.OpenProcessInstance(procInstID);
            if (inst != null)
            {
                foreach (DataField df in inst.DataFields)
                {
                    items.Add(new BPMListItem {
                        Name = df.Name, Value = df.Value.ToString()
                    });
                }
                rptList.DataSource = items;
                rptList.DataBind();

                k2Conn.Close();
            }
            else
            {
                k2Conn.Close();
            }
        }
        catch (Exception ex)
        {
            k2Conn.Close();
            lblException.Text    = "异常信息:" + ex.Message;
            lblException.Visible = true;
        }
    }
示例#3
0
    /// <summary>
    /// 是否DataField
    /// </summary>
    /// <param name="procInstID"></param>
    /// <returns></returns>
    bool ExistDataField(int procInstID)
    {
        bool       flag   = false;
        Connection k2Conn = new Connection();

        try
        {
            k2Conn.Open(K2ServerName, WorkflowHelper.GetConnString());
            SourceCode.Workflow.Client.ProcessInstance inst = k2Conn.OpenProcessInstance(procInstID);
            if (inst != null)
            {
                foreach (DataField item in inst.DataFields)
                {
                    if (item.Name == "IsPass")
                    {
                        flag = true;
                        break;
                    }
                }
            }
            k2Conn.Close();
        }
        catch
        {
            k2Conn.Close();
        }
        return(flag);
    }
示例#4
0
    public static bool ModifyDataField(string sn, NameValueCollection dataFields)
    {
        Connection k2Conn = new Connection();

        try
        {
            k2Conn.Open(K2ServerName, WorkflowHelper.GetConnString());

            SourceCode.Workflow.Client.ProcessInstance inst = k2Conn.OpenProcessInstance(Convert.ToInt32(sn.Split('_')[0]));
            if (inst != null)
            {
                foreach (string s in dataFields)
                {
                    inst.DataFields[s].Value = dataFields[s];
                }

                inst.Update();
            }
            return(true);
        }
        catch (Exception ex)
        {
            return(false);
        }
        finally
        {
            k2Conn.Close();
        }
    }
示例#5
0
    /// <summary>
    /// 是否存在实例
    /// </summary>
    /// <param name="procInstID"></param>
    /// <returns></returns>
    bool ExistprocInst(int procInstID)
    {
        Connection k2Conn = new Connection();

        try
        {
            k2Conn.Open(K2ServerName, WorkflowHelper.GetConnString());
            SourceCode.Workflow.Client.ProcessInstance inst = k2Conn.OpenProcessInstance(procInstID);
            k2Conn.Close();
            return(inst != null);
        }
        catch
        {
            k2Conn.Close();
            return(false);
        }
    }