Esempio n. 1
0
       /// <summary>
        /// 增加一条数据(以实体传值)
       /// </summary>
        /// <param name="conn">OracleConnection</param>
        /// <param name="model">FLOW_INSTANCE_STATE</param>
       /// <returns></returns>
       public int Add(OracleConnection conn, FLOW_INSTANCE_STATE model)
        {
            string insSql = "INSERT INTO FLOW_INSTANCE_STATE (INSTANCE_ID,STATE,STATUS,UNLOCKED,BLOCKED,INFO,MODIFIED,OWNER_ID,OWNED_UNTIL,NEXT_TIMER,FORMID,CREATEID,CREATENAME,EDITID,EDITNAME) VALUES (:INSTANCE_ID,:STATE,:STATUS,:UNLOCKED,:BLOCKED,:INFO,:MODIFIED,:OWNER_ID,:OWNED_UNTIL,:NEXT_TIMER,:FORMID,:CREATEID,:CREATENAME,:EDITID,:EDITNAME)";
            OracleParameter[] pageparm =
                {               
                    new OracleParameter(":INSTANCE_ID",OracleType.Char,36), 
                    new OracleParameter(":STATE",OracleType.Blob), 
                    new OracleParameter(":STATUS",OracleType.Number,22), 
                    new OracleParameter(":UNLOCKED",OracleType.Number,22), 
                    new OracleParameter(":BLOCKED",OracleType.Number,22), 
                    new OracleParameter(":INFO",OracleType.NClob), 
                    new OracleParameter(":MODIFIED",OracleType.DateTime), 
                    new OracleParameter(":OWNER_ID",OracleType.Char,36), 
                    new OracleParameter(":OWNED_UNTIL",OracleType.DateTime), 
                    new OracleParameter(":NEXT_TIMER",OracleType.DateTime), 
                    new OracleParameter(":FORMID",OracleType.NVarChar,100), 
                    new OracleParameter(":CREATEID",OracleType.NVarChar,100), 
                    new OracleParameter(":CREATENAME",OracleType.NVarChar,100), 
                    new OracleParameter(":EDITID",OracleType.NVarChar,100), 
                    new OracleParameter(":EDITNAME",OracleType.NVarChar,100) 
                  

                };
            pageparm[0].Value = OracleDataProvider.GetValue(model.INSTANCE_ID);//
          pageparm[1].Value = OracleDataProvider.GetValue(model.STATE);//
          pageparm[2].Value = OracleDataProvider.GetValue(model.STATUS);//
          pageparm[3].Value = OracleDataProvider.GetValue(model.UNLOCKED);//
          pageparm[4].Value = OracleDataProvider.GetValue(model.BLOCKED);//
          pageparm[5].Value = OracleDataProvider.GetValue(model.INFO);//
          pageparm[6].Value = OracleDataProvider.GetValue(model.MODIFIED);//
          pageparm[7].Value = OracleDataProvider.GetValue(model.OWNER_ID);//
          pageparm[8].Value = OracleDataProvider.GetValue(model.OWNED_UNTIL);//
          pageparm[9].Value = OracleDataProvider.GetValue(model.NEXT_TIMER);//
          pageparm[10].Value = OracleDataProvider.GetValue(model.FORMID);//
          pageparm[11].Value = OracleDataProvider.GetValue(model.CREATEID);//创建人ID
          pageparm[12].Value = OracleDataProvider.GetValue(model.CREATENAME);//创建人姓名
          pageparm[13].Value = OracleDataProvider.GetValue(model.EDITID);//下一个审核人ID
          pageparm[14].Value = OracleDataProvider.GetValue(model.EDITNAME);//下一个审核人姓名

          return ExecuteSQL(conn,insSql, pageparm);
        }     
        /// <summary>
        /// 增加一条数据(以实体传值)
        /// </summary>
        /// <param name="conn">//OracleConnection</param>
        /// <param name="model">FLOW_INSTANCE_STATE</param>
        /// <returns></returns>
        public int Add( FLOW_INSTANCE_STATE model)
        {
            string insSql = "INSERT INTO FLOW_INSTANCE_STATE (INSTANCE_ID,STATE,STATUS,UNLOCKED,BLOCKED,INFO,MODIFIED,OWNER_ID,OWNED_UNTIL,NEXT_TIMER,FORMID,CREATEID,CREATENAME,EDITID,EDITNAME) VALUES (:INSTANCE_ID,:STATE,:STATUS,:UNLOCKED,:BLOCKED,:INFO,:MODIFIED,:OWNER_ID,:OWNED_UNTIL,:NEXT_TIMER,:FORMID,:CREATEID,:CREATENAME,:EDITID,:EDITNAME)";
            Parameter[] pageparm =
                {
                    new Parameter(":INSTANCE_ID",null),
                    new Parameter(":STATE",null),
                    new Parameter(":STATUS",null),
                    new Parameter(":UNLOCKED",null),
                    new Parameter(":BLOCKED",null),
                    new Parameter(":INFO",null),
                    new Parameter(":MODIFIED",null),
                    new Parameter(":OWNER_ID",null),
                    new Parameter(":OWNED_UNTIL",null),
                    new Parameter(":NEXT_TIMER",null),
                    new Parameter(":FORMID",null),
                    new Parameter(":CREATEID",null),
                    new Parameter(":CREATENAME",null),
                    new Parameter(":EDITID",null),
                    new Parameter(":EDITNAME",null)

                };
            pageparm[0].ParameterValue = GetValue(model.INSTANCE_ID);//
              pageparm[1].ParameterValue = GetValue(model.STATE);//
              pageparm[2].ParameterValue = GetValue(model.STATUS);//
              pageparm[3].ParameterValue = GetValue(model.UNLOCKED);//
              pageparm[4].ParameterValue = GetValue(model.BLOCKED);//
              pageparm[5].ParameterValue = GetValue(model.INFO);//
              pageparm[6].ParameterValue = GetValue(model.MODIFIED);//
              pageparm[7].ParameterValue = GetValue(model.OWNER_ID);//
              pageparm[8].ParameterValue = GetValue(model.OWNED_UNTIL);//
              pageparm[9].ParameterValue = GetValue(model.NEXT_TIMER);//
              pageparm[10].ParameterValue = GetValue(model.FORMID);//
              pageparm[11].ParameterValue = GetValue(model.CREATEID);//创建人ID
              pageparm[12].ParameterValue = GetValue(model.CREATENAME);//创建人姓名
              pageparm[13].ParameterValue = GetValue(model.EDITID);//下一个审核人ID
              pageparm[14].ParameterValue = GetValue(model.EDITNAME);//下一个审核人姓名

              return ExecuteSQL(insSql, pageparm);
        }
Esempio n. 3
0
       /// <summary>
       /// 得到流程持久化实例一个对象实体
       /// </summary>
       /// <param name="conn">OracleConnection</param>
       /// <param name="instance_id">实例ID</param>
       /// <returns></returns>
       public FLOW_INSTANCE_STATE GetInstanceModel(OracleConnection conn, string instance_id)
       {
           FLOW_INSTANCE_STATE model = new FLOW_INSTANCE_STATE();
           string selSql = "SELECT INSTANCE_ID,STATE,STATUS,UNLOCKED,BLOCKED,INFO,MODIFIED,OWNER_ID,OWNED_UNTIL,NEXT_TIMER FROM INSTANCE_STATE WHERE   INSTANCE_ID=:INSTANCE_ID";
           OracleParameter[] pageparm =
                {               
                    new OracleParameter(":INSTANCE_ID",OracleType.Char,36) 

                };
           pageparm[0].Value = instance_id;
           OracleDataReader dr = OracleDataProvider.ExecuteReader(conn, selSql, pageparm);
           if (dr.Read())
           {
               model.INSTANCE_ID = dr["INSTANCE_ID"].ToString();// 
               model.STATE = (byte[])dr["STATE"];//   
               model.STATUS = dr["STATUS"].ToString() != "" ? Convert.ToDecimal(dr["STATUS"]) : 0; //  
               model.UNLOCKED = dr["UNLOCKED"].ToString() != "" ? Convert.ToDecimal(dr["UNLOCKED"]) : 0; //  
               model.BLOCKED = dr["BLOCKED"].ToString() != "" ? Convert.ToDecimal(dr["BLOCKED"]) : 0; //  
               model.INFO = dr["INFO"].ToString();// 
               model.MODIFIED = dr["MODIFIED"].ToString() != "" ? Convert.ToDateTime(dr["MODIFIED"]) : DateTime.Now; //  
               model.OWNER_ID = dr["OWNER_ID"].ToString();// 
               model.OWNED_UNTIL = dr["OWNED_UNTIL"].ToString() != "" ? Convert.ToDateTime(dr["OWNED_UNTIL"]) : DateTime.Now; //  
               model.NEXT_TIMER = dr["NEXT_TIMER"].ToString() != "" ? Convert.ToDateTime(dr["NEXT_TIMER"]) : DateTime.Now; //  
               
           }
           dr.Close();
           conn.Close();
           return model;
       }
Esempio n. 4
0
 /// <summary>
 /// 将每一步的流程审核过程中的持久化实例保存下来
 /// </summary>
 /// <param name="submitData">SubmitData</param>
 public static void AddInstance(SubmitData submitData,FlowUser fUser)
 {
     string instanceid = "";
     try
     {
         //1查找工作流程实例ID;2查询工作流持久化对像;3保存持久化
         FLOW_INSTANCE_STATEDAL dal = new FLOW_INSTANCE_STATEDAL();
         FLOW_FLOWRECORDMASTER_T master = dal.GetFlowerMasterIDByFormid( submitData.FormID);
         if (master != null && !string.IsNullOrEmpty(master.INSTANCEID.Trim()))
         {
             FLOW_INSTANCE_STATE entity = new FLOW_INSTANCE_STATE();
             FLOW_INSTANCE_STATE model = dal.GetInstanceModel(master.INSTANCEID);
             if (!string.IsNullOrEmpty(model.INSTANCE_ID))
             {
                 instanceid = model.INSTANCE_ID;
                 entity.INSTANCE_ID = model.INSTANCE_ID;//
                 entity.STATE = model.STATE;//
                 entity.STATUS = model.STATUS;//
                 entity.UNLOCKED = model.UNLOCKED;//
                 entity.BLOCKED = model.BLOCKED;//
                 entity.INFO = model.INFO;//
                 entity.MODIFIED = model.MODIFIED;//
                 entity.OWNER_ID = model.OWNER_ID;//
                 entity.OWNED_UNTIL = model.OWNED_UNTIL;//
                 entity.NEXT_TIMER = model.NEXT_TIMER;//
                 entity.CREATEID = submitData.ApprovalUser.UserID;//创建人ID
                 entity.CREATENAME = submitData.ApprovalUser.UserName;//创建人姓名
                 entity.EDITID = fUser.NextEditUserID;//下一个审核人ID
                 entity.EDITNAME = fUser.NextEditUserName;//下一个审核人姓名
                 entity.FORMID = master.FORMID;
                 FLOW_INSTANCE_STATEDAL inDal = new FLOW_INSTANCE_STATEDAL();
                 inDal.Add(entity);
                 Tracer.Debug("Formid=" + submitData.FormID + "; instanceid=" + instanceid + " 将每一步的流程审核过程中的持久化实例保存下来,成功!");
             }
             else
             {
                 Tracer.Debug("Formid=" + submitData.FormID + "; 没法找到持久化数据库的instanceid,可能丢失 instanceid=" + master.INSTANCEID + " ");
             }
         }
     }
     catch (Exception e)
     {
         Tracer.Debug("Formid=" + submitData.FormID + "; instanceid=" + instanceid + " 将每一步的流程审核过程中的持久化实例保存下来出错:异常信息:" + e.ToString());
         //throw new Exception(e.Message, e);
     }
 }
        /// <summary>
        /// 得到流程持久化实例一个对象实体
        /// </summary>
        /// <param name="conn">//OracleConnection</param>
        /// <param name="instance_id">实例ID</param>
        /// <returns></returns>
        public FLOW_INSTANCE_STATE GetInstanceModel(string instance_id)
        {
            FLOW_INSTANCE_STATE model = new FLOW_INSTANCE_STATE();
               string selSql = "SELECT INSTANCE_ID,STATE,STATUS,UNLOCKED,BLOCKED,INFO,MODIFIED,OWNER_ID,OWNED_UNTIL,NEXT_TIMER FROM INSTANCE_STATE WHERE   INSTANCE_ID=:INSTANCE_ID";
               Parameter[] pageparm =
                {
                    new Parameter(":INSTANCE_ID",null)

                };
               pageparm[0].ParameterValue = instance_id;
               ParameterCollection pras = new ParameterCollection();
               foreach (var item in pageparm)
               {
               pras.Add(item);
               }

               IDataReader dr = dao.ExecuteReader(selSql, pras);
               if (dr.Read())
               {
               model.INSTANCE_ID = dr["INSTANCE_ID"].ToString();//
               model.STATE = (byte[])dr["STATE"];//
               model.STATUS = dr["STATUS"].ToString() != "" ? Convert.ToDecimal(dr["STATUS"]) : 0; //
               model.UNLOCKED = dr["UNLOCKED"].ToString() != "" ? Convert.ToDecimal(dr["UNLOCKED"]) : 0; //
               model.BLOCKED = dr["BLOCKED"].ToString() != "" ? Convert.ToDecimal(dr["BLOCKED"]) : 0; //
               model.INFO = dr["INFO"].ToString();//
               model.MODIFIED = dr["MODIFIED"].ToString() != "" ? Convert.ToDateTime(dr["MODIFIED"]) : DateTime.Now; //
               model.OWNER_ID = dr["OWNER_ID"].ToString();//
               model.OWNED_UNTIL = dr["OWNED_UNTIL"].ToString() != "" ? Convert.ToDateTime(dr["OWNED_UNTIL"]) : DateTime.Now; //
               model.NEXT_TIMER = dr["NEXT_TIMER"].ToString() != "" ? Convert.ToDateTime(dr["NEXT_TIMER"]) : DateTime.Now; //

               }
               dr.Close();

               return model;
        }