zoukankan      html  css  js  c++  java
  • 【转载】从SmartObject中读取数据

    对K2 Blackpearl有一定了解的人都知道,SmartObject可以帮助我们完成数据持久化的工作,以下是根据流程实例ID(ProcessInstanceID)从SmartObject中读取数据相关代码,这些代码在SDK中也是可以找到的,现在贴出来给大家,希望有帮助,同时希望有大虾可以予小弟以指点。 


     //根据KEY ID从SmartObject中取数据
            private void LoadData(string argProInstanceID)
            {
                SourceCode.SmartObjects.Client.SmartObjectClientServer socs = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
                
                // build a connection string
                SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder connectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
                connectionString.Authenticate = true;
                connectionString.Host = System.Configuration.ConfigurationManager.AppSettings["K2Server"];
                connectionString.Integrated = true;
                connectionString.IsPrimaryLogin = true;
                connectionString.Port = Convert.ToUInt32(System.Configuration.ConfigurationManager.AppSettings["HostServicePort"]);
                //connectionString.UserID = "UserID";
                
    //connectionString.Password = "******";
                connectionString.WindowsDomain = "domain";
                connectionString.SecurityLabelName = "K2";

                // open a K2 Server connection
                socs.CreateConnection();
                socs.Connection.Open(connectionString.ToString());
                try
                {
                    // get a handle to the 'so_DHFKSQ' SmartObject
                    SourceCode.SmartObjects.Client.SmartObject so = socs.GetSmartObject("so_DHFKSQ");

                    // specify which method will be called
                    so.MethodToExecute = "Load";

                    // specify input parameters for the method
                    so.Properties["ProInstanceID"].Value = argProInstanceID;

                    // call the method
                    socs.ExecuteScalar(so);

                    // note: if a method of type 'list' was specified, then the 'ExecuteList' method should be called
                    
    // serverName.ExecuteList(smartObject);

                    
    // read the return properties of the SmartObject
                    Folio.Text = so.Properties["Folio"].Value;
                    ApplyEmployee.Text = so.Properties["ApplyEmployee"].Value;
                    ApplyAmount.Text = so.Properties["ApplyAmount"].Value;
                    ApplyDate.Text = so.Properties["ApplyDate"].Value;
                    HigherLevelApprover.Text = so.Properties["HigherLevelApprover"].Value;
                    FinanceApprover.Text = so.Properties["FinanceApprover"].Value;
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    // close the connection
                    socs.Connection.Close();
                }

            } 

    希望K2 Blackpearl的大虾们看到后,能给小弟予以指导,不甚感激。 

  • 相关阅读:
    第七节:扩展组件(lodash/富文本/echart/nprogress) 和 帮助类(日期格式化)
    第六节:基础组件(Cascader/Tab/Steps/Upload/TimeLine/alert) 之 参数/商品/订单
    第九节:Vuex简介、基本使用、核心功能(State、Mutation、Action、Getter) 和 案例实战演练
    第四节:基础组件(Breadcrumb、Card、Input、Dialog、Switch、Select、MessageBox) 之 用户管理
    第三节:基础组件(Container布局、NavMenu导航) 之 系统主页面搭建
    第二节:基础配置(路由、less、静态资源、axios、ESLint)、基础组件(Form、Message) 之登录页面搭建
    第七节:框架全面升级5.x版本及常规组件的升级和集成
    第一节:项目初始化(ElementUI、axios)、Git版本管理、基本环境搭建
    第八节:Vue Cli简介/安装、两种Create项目的方式、相关配置说明
    第三节:ES6模块化历史 及 默认、按需、直接导入导出、Vue单文件
  • 原文地址:https://www.cnblogs.com/voidxy/p/2376459.html
Copyright © 2011-2022 走看看