public static ProcessInstanceVar GetProcessInstanceVar(IDataReader dr)
        {
            ProcessInstanceVar processInstanceVar = new ProcessInstanceVar();
            ProcessInstanceVarPk pk = new ProcessInstanceVarPk();
            pk.ProcessInstanceId = Convert.ToString(dr["processinstance_id"]);// (rs.getString("processinstance_id"));
            pk.Name = Convert.ToString(dr["name"]); //(rs.getString("name"));
            processInstanceVar.VarPrimaryKey=pk;

            String valueStr = Convert.ToString(dr["value"]); //rs.getString("value");
            Object valueObj = GetProcessInstanceVarObject(valueStr);
            processInstanceVar.ValueType = valueObj.GetType().Name;
            processInstanceVar.Value = valueObj;

            return processInstanceVar;
        }
示例#2
0
        public override Boolean Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (!(obj is ProcessInstanceVar))
            {
                return(false);
            }
            ProcessInstanceVar var = (ProcessInstanceVar)obj;

            if (var.VarPrimaryKey.Equals(this.VarPrimaryKey))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        public void setProcessInstanceVariable(String name, Object value)
        {
            IPersistenceService persistenceService = this.RuntimeContext.PersistenceService;

            if (_processInstanceVariables == null)
            {
                //通过数据库查询进行初始化
                List <ProcessInstanceVar> allVars = persistenceService.FindProcessInstanceVariable(this.Id);
                _processInstanceVariables = new Dictionary <String, Object>();
                if (allVars != null && allVars.Count != 0)
                {
                    foreach (ProcessInstanceVar theVar in allVars)
                    {
                        _processInstanceVariables.Add(theVar.VarPrimaryKey.Name, theVar.Value);
                    }
                }
            }
            ProcessInstanceVar   procInstVar = new ProcessInstanceVar();
            ProcessInstanceVarPk pk          = new ProcessInstanceVarPk();

            pk.ProcessInstanceId = this.Id;
            pk.Name = name;
            procInstVar.VarPrimaryKey = pk;
            procInstVar.Value         = value.ToString();
            procInstVar.ValueType     = value.GetType().Name;

            if (_processInstanceVariables.ContainsKey(name))
            {
                persistenceService.UpdateProcessInstanceVariable(procInstVar);
                _processInstanceVariables[name] = value;
            }
            else
            {
                persistenceService.SaveProcessInstanceVariable(procInstVar);
                _processInstanceVariables.Add(name, value);
            }
        }
        public bool SaveProcessInstanceVariable(ProcessInstanceVar var)
        {
            string insert = "INSERT INTO T_FF_RT_PROCINST_VAR (" +
                   "PROCESSINSTANCE_ID, VALUE, NAME )VALUES(@1, @2, @3)";
            SqlParameter[] insertParms = { 
				SqlServerHelper.NewSqlParameter("@1", SqlDbType.VarChar, 50, var.ProcessInstanceId), 
				SqlServerHelper.NewSqlParameter("@2", SqlDbType.VarChar, 255, var.ValueType+"#"+var.Value), 
				SqlServerHelper.NewSqlParameter("@3", SqlDbType.VarChar, 255, var.Name)
			};
            if (SqlServerHelper.ExecuteNonQuery(connectionString, CommandType.Text, insert, insertParms) != 1)
                return false;
            else return true;
        }
        public bool UpdateProcessInstanceVariable(ProcessInstanceVar var)
        {
            string update = "UPDATE T_FF_RT_PROCINST_VAR SET " +
                "VALUE=@2" +
                " WHERE PROCESSINSTANCE_ID=@1 AND NAME=@3";
            SqlParameter[] updateParms = { 
				SqlServerHelper.NewSqlParameter("@2", SqlDbType.VarChar, 255, var.ValueType+"#"+var.Value), 
				SqlServerHelper.NewSqlParameter("@1", SqlDbType.VarChar, 50, var.ProcessInstanceId),
				SqlServerHelper.NewSqlParameter("@3", SqlDbType.VarChar, 255, var.Name)
			};
            if (SqlServerHelper.ExecuteNonQuery(connectionString, CommandType.Text, update, updateParms) != 1)
                return false;
            else return true;
        }
        public bool SaveProcessInstanceVariable(ProcessInstanceVar var)
        {
            string insert = "INSERT INTO T_FF_RT_PROCINST_VAR (" +
                   "PROCESSINSTANCE_ID, VALUE, NAME )VALUES(:1, :2, :3)";
            OracleParameter[] insertParms = { 
				OracleHelper.NewOracleParameter(":1", OracleType.VarChar, 50, var.ProcessInstanceId), 
				OracleHelper.NewOracleParameter(":2", OracleType.VarChar, 255, var.ValueType+"#"+var.Value), 
				OracleHelper.NewOracleParameter(":3", OracleType.VarChar, 255, var.Name)
			};
            if (OracleHelper.ExecuteNonQuery(connectionString, CommandType.Text, insert, insertParms) != 1)
                return false;
            else return true;
        }
        public bool UpdateProcessInstanceVariable(ProcessInstanceVar var)
        {
            string update = "UPDATE T_FF_RT_PROCINST_VAR SET " +
                "VALUE=:2" +
                " WHERE PROCESSINSTANCE_ID=:1 AND NAME=:3";
            OracleParameter[] updateParms = { 
				OracleHelper.NewOracleParameter(":2", OracleType.VarChar, 255, var.ValueType+"#"+var.Value), 
				OracleHelper.NewOracleParameter(":1", OracleType.VarChar, 50, var.ProcessInstanceId),
				OracleHelper.NewOracleParameter(":3", OracleType.VarChar, 255, var.Name)
			};
            if (OracleHelper.ExecuteNonQuery(connectionString, CommandType.Text, update, updateParms) != 1)
                return false;
            else return true;
        }
示例#8
0
        public void setProcessInstanceVariable(String name, Object value)
        {
            IPersistenceService persistenceService = this.RuntimeContext.PersistenceService;
            if (_processInstanceVariables == null)
            {
                //通过数据库查询进行初始化
                List<ProcessInstanceVar> allVars = persistenceService.FindProcessInstanceVariable(this.Id);
                _processInstanceVariables = new Dictionary<String, Object>();
                if (allVars != null && allVars.Count != 0)
                {
                    foreach (ProcessInstanceVar theVar in allVars)
                    {
                        _processInstanceVariables.Add(theVar.VarPrimaryKey.Name, theVar.Value);
                    }
                }
            }
            ProcessInstanceVar procInstVar = new ProcessInstanceVar();
            ProcessInstanceVarPk pk = new ProcessInstanceVarPk();
            pk.ProcessInstanceId=this.Id;
            pk.Name=name;
            procInstVar.VarPrimaryKey=pk;
            procInstVar.Value = value.ToString();
            procInstVar.ValueType=value.GetType().Name;

            if (_processInstanceVariables.ContainsKey(name))
            {
                persistenceService.UpdateProcessInstanceVariable(procInstVar);
                _processInstanceVariables[name] = value;
            }
            else
            {
                persistenceService.SaveProcessInstanceVariable(procInstVar);
                _processInstanceVariables.Add(name, value);
            }
        }