zoukankan      html  css  js  c++  java
  • 【转载】将数据存储到SmartObject中

    根据对K2 Blackpearl的一定了解,SmartObject可以帮助我们完成一些数据持久化的工作,以下是将表单中的数据存储到SmartObject中的相关代码,SmartObject的结构我就不一一赘述了,相信你能看懂的。

    这些代码SDK中也有,在此贴出来,希望有大虾可以予小弟以指点。

    //将表单中的数据存储到SmartObject中
    private void SaveData(int argProcInstanceID)
    {
        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 = "your user name";
        
    //connectionString.Password = "your password";
        connectionString.WindowsDomain = "dahanis";
        connectionString.SecurityLabelName = "K2";

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

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

            // specify input parameters for the method
            so.Properties["ProInstanceID"].Value = argProcInstanceID.ToString();
            so.Properties["Folio"].Value = Folio.Text.Trim();
            so.Properties["ApplyEmployee"].Value = ApplyEmployee.Text.Trim();
            so.Properties["ApplyAmount"].Value = ApplyAmount.Text.Trim();
            so.Properties["ApplyDate"].Value = ApplyDate.Text.Trim();
            so.Properties["HigherLevelApprover"].Value = HigherLevelApprover.Text.Trim();
            so.Properties["FinanceApprover"].Value = FinanceApprover.Text.Trim();

            // 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);
        }
        catch(Exception ex)
        {
            throw new Exception(ex.Message);
        }
        finally 
        {
            socs.Connection.Close();
        }

  • 相关阅读:
    简单工厂模式
    设计模式概述
    Excel中如何按单元格颜色求和,这五种牛批的方法,值得学习
    Excel数据透视表只能求和运算?快来学习求差运算小技巧
    如何在Excel中分组排名?两个公式轻松搞定!
    开始菜单之数字格式,这些基础知识还记得吗?
    2021,我来了
    2020年会必备,Excel轻松制作抽奖小游戏
    如何用Excel制作工作计划,跟踪任务进度,快来学习吧
    如何防止Excel数据录入出错,巧用数据验证,实现自动限制录入
  • 原文地址:https://www.cnblogs.com/voidxy/p/2376455.html
Copyright © 2011-2022 走看看