zoukankan      html  css  js  c++  java
  • 使用C#代码发起K2 Blackpearl流程

    使用C#代码,发起一个K2的流程,其形式和链接SQL Server数据库的代码差不多,都是通过连接字符串,然后OPEN,然后....你懂的。

    下面是K2流程发起的代码,仅供参考。同时,如果有K2方面的高手,还请多多指教小弟。

         protected void ProcessSubmit_Click(object sender, EventArgs e)
    {
    //创建连接对象
    SourceCode.Workflow.Client.Connection wfcon = new SourceCode.Workflow.Client.Connection();

    //打开链接(传入K2服务器及其端口)
    string k2Server = System.Configuration.ConfigurationManager.AppSettings["K2Server"];
    string workflowServicePort = System.Configuration.ConfigurationManager.AppSettings["WorkflowServicePort"];
    wfcon.Open(k2Server
    + ":" + workflowServicePort);

    //创建流程实例
    SourceCode.Workflow.Client.ProcessInstance proInst = wfcon.CreateProcessInstance(@"TestProcess\ProcessDHFKSQ");

    //指定流程单号
    proInst.Folio = Folio.Text;

    //为流程中 DataField 赋值
    proInst.DataFields["HigherLevelApprover"].Value = HigherLevelApprover.Text;
    proInst.DataFields[
    "FinanceApprover"].Value = FinanceApprover.Text;
    proInst.DataFields[
    "ApprovalPage"].Value = System.Configuration.ConfigurationManager.AppSettings["ApprovalPage"];

    //发起流程
    wfcon.StartProcessInstance(proInst);

    //存储数据到 SmartObject
    SaveData(proInst.ID);

    //结束
    wfcon.Dispose();
    Response.Write(
    "<script language='javascript' type='text/javascript'>window.close()</script>");
    }

    流程图如下:

  • 相关阅读:
    TCP/IP协议栈与数据包封装+TCP与UDP区别
    MySQL数据库优化总结
    MySQL存储引擎,锁,优化简述
    java实现常见查找算法
    Java的几种常见排序算法
    UML类图学习
    高性能的RTC服务器OpenFire
    常用的设计模式
    Swing JInternalFrame的使用
    Qt 模态与非模态
  • 原文地址:https://www.cnblogs.com/dannyli/p/2125285.html
Copyright © 2011-2022 走看看