Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TFCode_Node GetModel(Guid g_ID, Guid g_CodeTaskChainGuid, Guid g_OwnCodeTaskChainGuid, Guid g_OwnCodeTaskGuid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 g_ID,g_CodeTaskChainGuid,s_Type,g_OwnCodeTaskChainGuid,g_OwnCodeTaskGuid,s_PreGenerate,s_PreCondition,s_Code from TFCode_Node ");
            strSql.Append(" where g_ID=@g_ID and g_CodeTaskChainGuid=@g_CodeTaskChainGuid and g_OwnCodeTaskChainGuid=@g_OwnCodeTaskChainGuid and g_OwnCodeTaskGuid=@g_OwnCodeTaskGuid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@g_ID",                   SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@g_CodeTaskChainGuid",    SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@g_OwnCodeTaskChainGuid", SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@g_OwnCodeTaskGuid",      SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = g_ID;
            parameters[1].Value = g_CodeTaskChainGuid;
            parameters[2].Value = g_OwnCodeTaskChainGuid;
            parameters[3].Value = g_OwnCodeTaskGuid;

            IPSP.Model.TFCode_Node model = new IPSP.Model.TFCode_Node();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TFCode_Node model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TFCode_Node set ");
            strSql.Append("s_Type=@s_Type,");
            strSql.Append("s_PreGenerate=@s_PreGenerate,");
            strSql.Append("s_PreCondition=@s_PreCondition,");
            strSql.Append("s_Code=@s_Code");
            strSql.Append(" where g_ID=@g_ID and g_CodeTaskChainGuid=@g_CodeTaskChainGuid and g_OwnCodeTaskChainGuid=@g_OwnCodeTaskChainGuid and g_OwnCodeTaskGuid=@g_OwnCodeTaskGuid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_Type",                 SqlDbType.NVarChar,            1),
                new SqlParameter("@s_PreGenerate",          SqlDbType.NVarChar,            1),
                new SqlParameter("@s_PreCondition",         SqlDbType.NVarChar,         2000),
                new SqlParameter("@s_Code",                 SqlDbType.NVarChar,           21),
                new SqlParameter("@g_ID",                   SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@g_CodeTaskChainGuid",    SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@g_OwnCodeTaskChainGuid", SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@g_OwnCodeTaskGuid",      SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = model.s_Type;
            parameters[1].Value = model.s_PreGenerate;
            parameters[2].Value = model.s_PreCondition;
            parameters[3].Value = model.s_Code;
            parameters[4].Value = model.g_ID;
            parameters[5].Value = model.g_CodeTaskChainGuid;
            parameters[6].Value = model.g_OwnCodeTaskChainGuid;
            parameters[7].Value = model.g_OwnCodeTaskGuid;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TFCode_Node DataRowToModel(DataRow row)
 {
     IPSP.Model.TFCode_Node model = new IPSP.Model.TFCode_Node();
     if (row != null)
     {
         if (row["g_ID"] != null && row["g_ID"].ToString() != "")
         {
             model.g_ID = new Guid(row["g_ID"].ToString());
         }
         if (row["g_CodeTaskChainGuid"] != null && row["g_CodeTaskChainGuid"].ToString() != "")
         {
             model.g_CodeTaskChainGuid = new Guid(row["g_CodeTaskChainGuid"].ToString());
         }
         if (row["s_Type"] != null)
         {
             model.s_Type = row["s_Type"].ToString();
         }
         if (row["g_OwnCodeTaskChainGuid"] != null && row["g_OwnCodeTaskChainGuid"].ToString() != "")
         {
             model.g_OwnCodeTaskChainGuid = new Guid(row["g_OwnCodeTaskChainGuid"].ToString());
         }
         if (row["g_OwnCodeTaskGuid"] != null && row["g_OwnCodeTaskGuid"].ToString() != "")
         {
             model.g_OwnCodeTaskGuid = new Guid(row["g_OwnCodeTaskGuid"].ToString());
         }
         if (row["s_PreGenerate"] != null)
         {
             model.s_PreGenerate = row["s_PreGenerate"].ToString();
         }
         if (row["s_PreCondition"] != null)
         {
             model.s_PreCondition = row["s_PreCondition"].ToString();
         }
         if (row["s_Code"] != null)
         {
             model.s_Code = row["s_Code"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(IPSP.Model.TFCode_Node model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TFCode_Node(");
            strSql.Append("g_ID,g_CodeTaskChainGuid,s_Type,g_OwnCodeTaskChainGuid,g_OwnCodeTaskGuid,s_PreGenerate,s_PreCondition,s_Code)");
            strSql.Append(" values (");
            strSql.Append("@g_ID,@g_CodeTaskChainGuid,@s_Type,@g_OwnCodeTaskChainGuid,@g_OwnCodeTaskGuid,@s_PreGenerate,@s_PreCondition,@s_Code)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@g_ID",                   SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@g_CodeTaskChainGuid",    SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@s_Type",                 SqlDbType.NVarChar,            1),
                new SqlParameter("@g_OwnCodeTaskChainGuid", SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@g_OwnCodeTaskGuid",      SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@s_PreGenerate",          SqlDbType.NVarChar,            1),
                new SqlParameter("@s_PreCondition",         SqlDbType.NVarChar,         2000),
                new SqlParameter("@s_Code",                 SqlDbType.NVarChar, 21)
            };
            parameters[0].Value = Guid.NewGuid();
            parameters[1].Value = Guid.NewGuid();
            parameters[2].Value = model.s_Type;
            parameters[3].Value = Guid.NewGuid();
            parameters[4].Value = Guid.NewGuid();
            parameters[5].Value = model.s_PreGenerate;
            parameters[6].Value = model.s_PreCondition;
            parameters[7].Value = model.s_Code;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TFCode_Node model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(IPSP.Model.TFCode_Node model)
 {
     return(dal.Add(model));
 }