Ejemplo n.º 1
0
        private List <RoadFlow.Data.Model.WorkFlow> DataReaderToList(MySqlDataReader dataReader)
        {
            List <RoadFlow.Data.Model.WorkFlow> workFlowList = new List <RoadFlow.Data.Model.WorkFlow>();

            while (dataReader.Read())
            {
                RoadFlow.Data.Model.WorkFlow workFlow = new RoadFlow.Data.Model.WorkFlow();
                workFlow.ID              = dataReader.GetString(0).ToGuid();
                workFlow.Name            = dataReader.GetString(1);
                workFlow.Type            = dataReader.GetString(2).ToGuid();
                workFlow.Manager         = dataReader.GetString(3);
                workFlow.InstanceManager = dataReader.GetString(4);
                workFlow.CreateDate      = dataReader.GetDateTime(5);
                workFlow.CreateUserID    = dataReader.GetString(6).ToGuid();
                if (!dataReader.IsDBNull(7))
                {
                    workFlow.DesignJSON = dataReader.GetString(7);
                }
                if (!dataReader.IsDBNull(8))
                {
                    workFlow.InstallDate = new DateTime?(dataReader.GetDateTime(8));
                }
                if (!dataReader.IsDBNull(9))
                {
                    workFlow.InstallUserID = new Guid?(dataReader.GetString(9).ToGuid());
                }
                if (!dataReader.IsDBNull(10))
                {
                    workFlow.RunJSON = dataReader.GetString(10);
                }
                workFlow.Status = dataReader.GetInt32(11);
                workFlowList.Add(workFlow);
            }
            return(workFlowList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 将DataRedar转换为List
        /// </summary>
        private List <RoadFlow.Data.Model.WorkFlow> DataReaderToList(SqlDataReader dataReader)
        {
            List <RoadFlow.Data.Model.WorkFlow> List = new List <RoadFlow.Data.Model.WorkFlow>();

            RoadFlow.Data.Model.WorkFlow model = null;
            while (dataReader.Read())
            {
                model                 = new RoadFlow.Data.Model.WorkFlow();
                model.ID              = dataReader.GetGuid(0);
                model.Name            = dataReader.GetString(1);
                model.Type            = dataReader.GetGuid(2);
                model.Manager         = dataReader.GetString(3);
                model.InstanceManager = dataReader.GetString(4);
                model.CreateDate      = dataReader.GetDateTime(5);
                model.CreateUserID    = dataReader.GetGuid(6);
                if (!dataReader.IsDBNull(7))
                {
                    model.DesignJSON = dataReader.GetString(7);
                }
                if (!dataReader.IsDBNull(8))
                {
                    model.InstallDate = dataReader.GetDateTime(8);
                }
                if (!dataReader.IsDBNull(9))
                {
                    model.InstallUserID = dataReader.GetGuid(9);
                }
                if (!dataReader.IsDBNull(10))
                {
                    model.RunJSON = dataReader.GetString(10);
                }
                model.Status = dataReader.GetInt32(11);
                List.Add(model);
            }
            return(List);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">RoadFlow.Data.Model.WorkFlow实体类</param>
        public int Update(RoadFlow.Data.Model.WorkFlow model)
        {
            string sql = @"UPDATE WorkFlow SET 
				Name=@Name,Type=@Type,Manager=@Manager,InstanceManager=@InstanceManager,CreateDate=@CreateDate,CreateUserID=@CreateUserID,DesignJSON=@DesignJSON,InstallDate=@InstallDate,InstallUserID=@InstallUserID,RunJSON=@RunJSON,Status=@Status
				WHERE ID=@ID"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@Name", SqlDbType.NVarChar, 1000)
                {
                    Value = model.Name
                },
                new SqlParameter("@Type", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.Type
                },
                new SqlParameter("@Manager", SqlDbType.VarChar, 5000)
                {
                    Value = model.Manager
                },
                new SqlParameter("@InstanceManager", SqlDbType.VarChar, 5000)
                {
                    Value = model.InstanceManager
                },
                new SqlParameter("@CreateDate", SqlDbType.DateTime, 8)
                {
                    Value = model.CreateDate
                },
                new SqlParameter("@CreateUserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.CreateUserID
                },
                model.DesignJSON == null ? new SqlParameter("@DesignJSON", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@DesignJSON", SqlDbType.VarChar, -1)
                {
                    Value = model.DesignJSON
                },
                model.InstallDate == null ? new SqlParameter("@InstallDate", SqlDbType.DateTime, 8)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@InstallDate", SqlDbType.DateTime, 8)
                {
                    Value = model.InstallDate
                },
                model.InstallUserID == null ? new SqlParameter("@InstallUserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@InstallUserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.InstallUserID
                },
                model.RunJSON == null ? new SqlParameter("@RunJSON", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@RunJSON", SqlDbType.VarChar, -1)
                {
                    Value = model.RunJSON
                },
                new SqlParameter("@Status", SqlDbType.Int, -1)
                {
                    Value = model.Status
                },
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">RoadFlow.Data.Model.WorkFlow实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(RoadFlow.Data.Model.WorkFlow model)
        {
            string sql = @"INSERT INTO WorkFlow
				(ID,Name,Type,Manager,InstanceManager,CreateDate,CreateUserID,DesignJSON,InstallDate,InstallUserID,RunJSON,Status) 
				VALUES(@ID,@Name,@Type,@Manager,@InstanceManager,@CreateDate,@CreateUserID,@DesignJSON,@InstallDate,@InstallUserID,@RunJSON,@Status)"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                },
                new SqlParameter("@Name", SqlDbType.NVarChar, 1000)
                {
                    Value = model.Name
                },
                new SqlParameter("@Type", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.Type
                },
                new SqlParameter("@Manager", SqlDbType.VarChar, 5000)
                {
                    Value = model.Manager
                },
                new SqlParameter("@InstanceManager", SqlDbType.VarChar, 5000)
                {
                    Value = model.InstanceManager
                },
                new SqlParameter("@CreateDate", SqlDbType.DateTime, 8)
                {
                    Value = model.CreateDate
                },
                new SqlParameter("@CreateUserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.CreateUserID
                },
                model.DesignJSON == null ? new SqlParameter("@DesignJSON", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@DesignJSON", SqlDbType.VarChar, -1)
                {
                    Value = model.DesignJSON
                },
                model.InstallDate == null ? new SqlParameter("@InstallDate", SqlDbType.DateTime, 8)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@InstallDate", SqlDbType.DateTime, 8)
                {
                    Value = model.InstallDate
                },
                model.InstallUserID == null ? new SqlParameter("@InstallUserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@InstallUserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.InstallUserID
                },
                model.RunJSON == null ? new SqlParameter("@RunJSON", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@RunJSON", SqlDbType.VarChar, -1)
                {
                    Value = model.RunJSON
                },
                new SqlParameter("@Status", SqlDbType.Int, -1)
                {
                    Value = model.Status
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">RoadFlow.Data.Model.WorkFlow实体类</param>
        public int Update(RoadFlow.Data.Model.WorkFlow model)
        {
            string sql = @"UPDATE WorkFlow SET 
				Name=:Name,Type=:Type,Manager=:Manager,InstanceManager=:InstanceManager,CreateDate=:CreateDate,CreateUserID=:CreateUserID,DesignJSON=:DesignJSON,InstallDate=:InstallDate,InstallUserID=:InstallUserID,RunJSON=:RunJSON,Status=:Status
				WHERE ID=:ID"                ;

            OracleParameter[] parameters = new OracleParameter[] {
                new OracleParameter(":Name", OracleDbType.NVarchar2, 1000)
                {
                    Value = model.Name
                },
                new OracleParameter(":Type", OracleDbType.Varchar2, 40)
                {
                    Value = model.Type
                },
                new OracleParameter(":Manager", OracleDbType.Varchar2, 5000)
                {
                    Value = model.Manager
                },
                new OracleParameter(":InstanceManager", OracleDbType.Varchar2, 5000)
                {
                    Value = model.InstanceManager
                },
                new OracleParameter(":CreateDate", OracleDbType.Date, 8)
                {
                    Value = model.CreateDate
                },
                new OracleParameter(":CreateUserID", OracleDbType.Varchar2, 40)
                {
                    Value = model.CreateUserID
                },
                model.DesignJSON == null ? new OracleParameter(":DesignJSON", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":DesignJSON", OracleDbType.Clob)
                {
                    Value = model.DesignJSON
                },
                model.InstallDate == null ? new OracleParameter(":InstallDate", OracleDbType.Date, 8)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":InstallDate", OracleDbType.Date, 8)
                {
                    Value = model.InstallDate
                },
                model.InstallUserID == null ? new OracleParameter(":InstallUserID", OracleDbType.Varchar2, 40)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":InstallUserID", OracleDbType.Varchar2, 40)
                {
                    Value = model.InstallUserID
                },
                model.RunJSON == null ? new OracleParameter(":RunJSON", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":RunJSON", OracleDbType.Clob)
                {
                    Value = model.RunJSON
                },
                new OracleParameter(":Status", OracleDbType.Int32)
                {
                    Value = model.Status
                },
                new OracleParameter(":ID", OracleDbType.Varchar2, 40)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">RoadFlow.Data.Model.WorkFlow实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(RoadFlow.Data.Model.WorkFlow model)
        {
            string sql = @"INSERT INTO WorkFlow
				(ID,Name,Type,Manager,InstanceManager,CreateDate,CreateUserID,DesignJSON,InstallDate,InstallUserID,RunJSON,Status) 
				VALUES(:ID,:Name,:Type,:Manager,:InstanceManager,:CreateDate,:CreateUserID,:DesignJSON,:InstallDate,:InstallUserID,:RunJSON,:Status)"                ;

            OracleParameter[] parameters = new OracleParameter[] {
                new OracleParameter(":ID", OracleDbType.Varchar2, 40)
                {
                    Value = model.ID
                },
                new OracleParameter(":Name", OracleDbType.NVarchar2, 1000)
                {
                    Value = model.Name
                },
                new OracleParameter(":Type", OracleDbType.Varchar2, 40)
                {
                    Value = model.Type
                },
                new OracleParameter(":Manager", OracleDbType.Varchar2, 5000)
                {
                    Value = model.Manager
                },
                new OracleParameter(":InstanceManager", OracleDbType.Varchar2, 5000)
                {
                    Value = model.InstanceManager
                },
                new OracleParameter(":CreateDate", OracleDbType.Date, 8)
                {
                    Value = model.CreateDate
                },
                new OracleParameter(":CreateUserID", OracleDbType.Varchar2, 40)
                {
                    Value = model.CreateUserID
                },
                model.DesignJSON == null ? new OracleParameter(":DesignJSON", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":DesignJSON", OracleDbType.Clob)
                {
                    Value = model.DesignJSON
                },
                model.InstallDate == null ? new OracleParameter(":InstallDate", OracleDbType.Date, 8)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":InstallDate", OracleDbType.Date, 8)
                {
                    Value = model.InstallDate
                },
                model.InstallUserID == null ? new OracleParameter(":InstallUserID", OracleDbType.Varchar2, 40)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":InstallUserID", OracleDbType.Varchar2, 40)
                {
                    Value = model.InstallUserID
                },
                model.RunJSON == null ? new OracleParameter(":RunJSON", OracleDbType.Clob)
                {
                    Value = DBNull.Value
                } : new OracleParameter(":RunJSON", OracleDbType.Clob)
                {
                    Value = model.RunJSON
                },
                new OracleParameter(":Status", OracleDbType.Int32)
                {
                    Value = model.Status
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Ejemplo n.º 7
0
        public int Add(RoadFlow.Data.Model.WorkFlow model)
        {
            string sql = "INSERT INTO workflow\r\n\t\t\t\t(ID,Name,Type,Manager,InstanceManager,CreateDate,CreateUserID,DesignJSON,InstallDate,InstallUserID,RunJSON,Status) \r\n\t\t\t\tVALUES(@ID,@Name,@Type,@Manager,@InstanceManager,@CreateDate,@CreateUserID,@DesignJSON,@InstallDate,@InstallUserID,@RunJSON,@Status)";

            MySqlParameter[] mySqlParameterArray = new MySqlParameter[12];
            int            index1          = 0;
            MySqlParameter mySqlParameter1 = new MySqlParameter("@ID", MySqlDbType.VarChar, 36);

            mySqlParameter1.Value       = (object)model.ID;
            mySqlParameterArray[index1] = mySqlParameter1;
            int            index2          = 1;
            MySqlParameter mySqlParameter2 = new MySqlParameter("@Name", MySqlDbType.Text, -1);

            mySqlParameter2.Value       = (object)model.Name;
            mySqlParameterArray[index2] = mySqlParameter2;
            int            index3          = 2;
            MySqlParameter mySqlParameter3 = new MySqlParameter("@Type", MySqlDbType.VarChar, 36);

            mySqlParameter3.Value       = (object)model.Type;
            mySqlParameterArray[index3] = mySqlParameter3;
            int            index4          = 3;
            MySqlParameter mySqlParameter4 = new MySqlParameter("@Manager", MySqlDbType.Text, -1);

            mySqlParameter4.Value       = (object)model.Manager;
            mySqlParameterArray[index4] = mySqlParameter4;
            int            index5          = 4;
            MySqlParameter mySqlParameter5 = new MySqlParameter("@InstanceManager", MySqlDbType.Text, -1);

            mySqlParameter5.Value       = (object)model.InstanceManager;
            mySqlParameterArray[index5] = mySqlParameter5;
            int            index6          = 5;
            MySqlParameter mySqlParameter6 = new MySqlParameter("@CreateDate", MySqlDbType.DateTime, -1);

            mySqlParameter6.Value       = (object)model.CreateDate;
            mySqlParameterArray[index6] = mySqlParameter6;
            int            index7          = 6;
            MySqlParameter mySqlParameter7 = new MySqlParameter("@CreateUserID", MySqlDbType.VarChar, 36);

            mySqlParameter7.Value       = (object)model.CreateUserID;
            mySqlParameterArray[index7] = mySqlParameter7;
            int            index8 = 7;
            MySqlParameter mySqlParameter8;

            if (model.DesignJSON != null)
            {
                MySqlParameter mySqlParameter9 = new MySqlParameter("@DesignJSON", MySqlDbType.LongText, -1);
                mySqlParameter9.Value = (object)model.DesignJSON;
                mySqlParameter8       = mySqlParameter9;
            }
            else
            {
                mySqlParameter8       = new MySqlParameter("@DesignJSON", MySqlDbType.LongText, -1);
                mySqlParameter8.Value = (object)DBNull.Value;
            }
            mySqlParameterArray[index8] = mySqlParameter8;
            int            index9 = 8;
            MySqlParameter mySqlParameter10;

            if (model.InstallDate.HasValue)
            {
                MySqlParameter mySqlParameter9 = new MySqlParameter("@InstallDate", MySqlDbType.DateTime, -1);
                mySqlParameter9.Value = (object)model.InstallDate;
                mySqlParameter10      = mySqlParameter9;
            }
            else
            {
                mySqlParameter10       = new MySqlParameter("@InstallDate", MySqlDbType.DateTime, -1);
                mySqlParameter10.Value = (object)DBNull.Value;
            }
            mySqlParameterArray[index9] = mySqlParameter10;
            int            index10 = 9;
            MySqlParameter mySqlParameter11;

            if (model.InstallUserID.HasValue)
            {
                MySqlParameter mySqlParameter9 = new MySqlParameter("@InstallUserID", MySqlDbType.VarChar, 36);
                mySqlParameter9.Value = (object)model.InstallUserID;
                mySqlParameter11      = mySqlParameter9;
            }
            else
            {
                mySqlParameter11       = new MySqlParameter("@InstallUserID", MySqlDbType.VarChar, 36);
                mySqlParameter11.Value = (object)DBNull.Value;
            }
            mySqlParameterArray[index10] = mySqlParameter11;
            int            index11 = 10;
            MySqlParameter mySqlParameter12;

            if (model.RunJSON != null)
            {
                MySqlParameter mySqlParameter9 = new MySqlParameter("@RunJSON", MySqlDbType.LongText, -1);
                mySqlParameter9.Value = (object)model.RunJSON;
                mySqlParameter12      = mySqlParameter9;
            }
            else
            {
                mySqlParameter12       = new MySqlParameter("@RunJSON", MySqlDbType.LongText, -1);
                mySqlParameter12.Value = (object)DBNull.Value;
            }
            mySqlParameterArray[index11] = mySqlParameter12;
            int            index12          = 11;
            MySqlParameter mySqlParameter13 = new MySqlParameter("@Status", MySqlDbType.Int32, 11);

            mySqlParameter13.Value       = (object)model.Status;
            mySqlParameterArray[index12] = mySqlParameter13;
            MySqlParameter[] parameter = mySqlParameterArray;
            return(this.dbHelper.Execute(sql, parameter, false));
        }
Ejemplo n.º 8
0
        public int Add(RoadFlow.Data.Model.WorkFlow model)
        {
            string sql = "INSERT INTO WorkFlow\r\n\t\t\t\t(ID,Name,Type,Manager,InstanceManager,CreateDate,CreateUserID,DesignJSON,InstallDate,InstallUserID,RunJSON,Status) \r\n\t\t\t\tVALUES(:ID,:Name,:Type,:Manager,:InstanceManager,:CreateDate,:CreateUserID,:DesignJSON,:InstallDate,:InstallUserID,:RunJSON,:Status)";

            OracleParameter[] oracleParameterArray = new OracleParameter[12];
            int             index1           = 0;
            OracleParameter oracleParameter1 = new OracleParameter(":ID", OracleDbType.Varchar2, 40);

            oracleParameter1.Value       = (object)model.ID;
            oracleParameterArray[index1] = oracleParameter1;
            int             index2           = 1;
            OracleParameter oracleParameter2 = new OracleParameter(":Name", OracleDbType.NVarchar2, 1000);

            oracleParameter2.Value       = (object)model.Name;
            oracleParameterArray[index2] = oracleParameter2;
            int             index3           = 2;
            OracleParameter oracleParameter3 = new OracleParameter(":Type", OracleDbType.Varchar2, 40);

            oracleParameter3.Value       = (object)model.Type;
            oracleParameterArray[index3] = oracleParameter3;
            int             index4           = 3;
            OracleParameter oracleParameter4 = new OracleParameter(":Manager", OracleDbType.Varchar2, 5000);

            oracleParameter4.Value       = (object)model.Manager;
            oracleParameterArray[index4] = oracleParameter4;
            int             index5           = 4;
            OracleParameter oracleParameter5 = new OracleParameter(":InstanceManager", OracleDbType.Varchar2, 5000);

            oracleParameter5.Value       = (object)model.InstanceManager;
            oracleParameterArray[index5] = oracleParameter5;
            int             index6           = 5;
            OracleParameter oracleParameter6 = new OracleParameter(":CreateDate", OracleDbType.Date, 8);

            oracleParameter6.Value       = (object)model.CreateDate;
            oracleParameterArray[index6] = oracleParameter6;
            int             index7           = 6;
            OracleParameter oracleParameter7 = new OracleParameter(":CreateUserID", OracleDbType.Varchar2, 40);

            oracleParameter7.Value       = (object)model.CreateUserID;
            oracleParameterArray[index7] = oracleParameter7;
            int             index8 = 7;
            OracleParameter oracleParameter8;

            if (model.DesignJSON != null)
            {
                OracleParameter oracleParameter9 = new OracleParameter(":DesignJSON", OracleDbType.Clob);
                oracleParameter9.Value = (object)model.DesignJSON;
                oracleParameter8       = oracleParameter9;
            }
            else
            {
                oracleParameter8       = new OracleParameter(":DesignJSON", OracleDbType.Clob);
                oracleParameter8.Value = (object)DBNull.Value;
            }
            oracleParameterArray[index8] = oracleParameter8;
            int             index9 = 8;
            OracleParameter oracleParameter10;

            if (model.InstallDate.HasValue)
            {
                OracleParameter oracleParameter9 = new OracleParameter(":InstallDate", OracleDbType.Date, 8);
                oracleParameter9.Value = (object)model.InstallDate;
                oracleParameter10      = oracleParameter9;
            }
            else
            {
                oracleParameter10       = new OracleParameter(":InstallDate", OracleDbType.Date, 8);
                oracleParameter10.Value = (object)DBNull.Value;
            }
            oracleParameterArray[index9] = oracleParameter10;
            int             index10 = 9;
            OracleParameter oracleParameter11;

            if (model.InstallUserID.HasValue)
            {
                OracleParameter oracleParameter9 = new OracleParameter(":InstallUserID", OracleDbType.Varchar2, 40);
                oracleParameter9.Value = (object)model.InstallUserID;
                oracleParameter11      = oracleParameter9;
            }
            else
            {
                oracleParameter11       = new OracleParameter(":InstallUserID", OracleDbType.Varchar2, 40);
                oracleParameter11.Value = (object)DBNull.Value;
            }
            oracleParameterArray[index10] = oracleParameter11;
            int             index11 = 10;
            OracleParameter oracleParameter12;

            if (model.RunJSON != null)
            {
                OracleParameter oracleParameter9 = new OracleParameter(":RunJSON", OracleDbType.Clob);
                oracleParameter9.Value = (object)model.RunJSON;
                oracleParameter12      = oracleParameter9;
            }
            else
            {
                oracleParameter12       = new OracleParameter(":RunJSON", OracleDbType.Clob);
                oracleParameter12.Value = (object)DBNull.Value;
            }
            oracleParameterArray[index11] = oracleParameter12;
            int             index12           = 11;
            OracleParameter oracleParameter13 = new OracleParameter(":Status", OracleDbType.Int32);

            oracleParameter13.Value       = (object)model.Status;
            oracleParameterArray[index12] = oracleParameter13;
            OracleParameter[] parameter = oracleParameterArray;
            return(this.dbHelper.Execute(sql, parameter));
        }
Ejemplo n.º 9
0
        public int Add(RoadFlow.Data.Model.WorkFlow model)
        {
            string sql = "INSERT INTO WorkFlow\r\n\t\t\t\t(ID,Name,Type,Manager,InstanceManager,CreateDate,CreateUserID,DesignJSON,InstallDate,InstallUserID,RunJSON,Status) \r\n\t\t\t\tVALUES(@ID,@Name,@Type,@Manager,@InstanceManager,@CreateDate,@CreateUserID,@DesignJSON,@InstallDate,@InstallUserID,@RunJSON,@Status)";

            SqlParameter[] sqlParameterArray = new SqlParameter[12];
            int            index1            = 0;
            SqlParameter   sqlParameter1     = new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1);

            sqlParameter1.Value       = (object)model.ID;
            sqlParameterArray[index1] = sqlParameter1;
            int          index2        = 1;
            SqlParameter sqlParameter2 = new SqlParameter("@Name", SqlDbType.NVarChar, 1000);

            sqlParameter2.Value       = (object)model.Name;
            sqlParameterArray[index2] = sqlParameter2;
            int          index3        = 2;
            SqlParameter sqlParameter3 = new SqlParameter("@Type", SqlDbType.UniqueIdentifier, -1);

            sqlParameter3.Value       = (object)model.Type;
            sqlParameterArray[index3] = sqlParameter3;
            int          index4        = 3;
            SqlParameter sqlParameter4 = new SqlParameter("@Manager", SqlDbType.VarChar, 5000);

            sqlParameter4.Value       = (object)model.Manager;
            sqlParameterArray[index4] = sqlParameter4;
            int          index5        = 4;
            SqlParameter sqlParameter5 = new SqlParameter("@InstanceManager", SqlDbType.VarChar, 5000);

            sqlParameter5.Value       = (object)model.InstanceManager;
            sqlParameterArray[index5] = sqlParameter5;
            int          index6        = 5;
            SqlParameter sqlParameter6 = new SqlParameter("@CreateDate", SqlDbType.DateTime, 8);

            sqlParameter6.Value       = (object)model.CreateDate;
            sqlParameterArray[index6] = sqlParameter6;
            int          index7        = 6;
            SqlParameter sqlParameter7 = new SqlParameter("@CreateUserID", SqlDbType.UniqueIdentifier, -1);

            sqlParameter7.Value       = (object)model.CreateUserID;
            sqlParameterArray[index7] = sqlParameter7;
            int          index8 = 7;
            SqlParameter sqlParameter8;

            if (model.DesignJSON != null)
            {
                SqlParameter sqlParameter9 = new SqlParameter("@DesignJSON", SqlDbType.VarChar, -1);
                sqlParameter9.Value = (object)model.DesignJSON;
                sqlParameter8       = sqlParameter9;
            }
            else
            {
                sqlParameter8       = new SqlParameter("@DesignJSON", SqlDbType.VarChar, -1);
                sqlParameter8.Value = (object)DBNull.Value;
            }
            sqlParameterArray[index8] = sqlParameter8;
            int          index9 = 8;
            SqlParameter sqlParameter10;

            if (model.InstallDate.HasValue)
            {
                SqlParameter sqlParameter9 = new SqlParameter("@InstallDate", SqlDbType.DateTime, 8);
                sqlParameter9.Value = (object)model.InstallDate;
                sqlParameter10      = sqlParameter9;
            }
            else
            {
                sqlParameter10       = new SqlParameter("@InstallDate", SqlDbType.DateTime, 8);
                sqlParameter10.Value = (object)DBNull.Value;
            }
            sqlParameterArray[index9] = sqlParameter10;
            int          index10 = 9;
            SqlParameter sqlParameter11;

            if (model.InstallUserID.HasValue)
            {
                SqlParameter sqlParameter9 = new SqlParameter("@InstallUserID", SqlDbType.UniqueIdentifier, -1);
                sqlParameter9.Value = (object)model.InstallUserID;
                sqlParameter11      = sqlParameter9;
            }
            else
            {
                sqlParameter11       = new SqlParameter("@InstallUserID", SqlDbType.UniqueIdentifier, -1);
                sqlParameter11.Value = (object)DBNull.Value;
            }
            sqlParameterArray[index10] = sqlParameter11;
            int          index11 = 10;
            SqlParameter sqlParameter12;

            if (model.RunJSON != null)
            {
                SqlParameter sqlParameter9 = new SqlParameter("@RunJSON", SqlDbType.VarChar, -1);
                sqlParameter9.Value = (object)model.RunJSON;
                sqlParameter12      = sqlParameter9;
            }
            else
            {
                sqlParameter12       = new SqlParameter("@RunJSON", SqlDbType.VarChar, -1);
                sqlParameter12.Value = (object)DBNull.Value;
            }
            sqlParameterArray[index11] = sqlParameter12;
            int          index12        = 11;
            SqlParameter sqlParameter13 = new SqlParameter("@Status", SqlDbType.Int, -1);

            sqlParameter13.Value       = (object)model.Status;
            sqlParameterArray[index12] = sqlParameter13;
            SqlParameter[] parameter = sqlParameterArray;
            return(this.dbHelper.Execute(sql, parameter, false));
        }