Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(IPSP.Model.TCode_AutoDemandParams model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCode_AutoDemandParams(");
            strSql.Append("g_ID,g_CodeAutoDemandID,s_DataType,s_RuleRegex,s_Description,n_Sequence)");
            strSql.Append(" values (");
            strSql.Append("@g_ID,@g_CodeAutoDemandID,@s_DataType,@s_RuleRegex,@s_Description,@n_Sequence)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@g_ID",               SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@g_CodeAutoDemandID", SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@s_DataType",         SqlDbType.NVarChar,          50),
                new SqlParameter("@s_RuleRegex",        SqlDbType.NVarChar,         200),
                new SqlParameter("@s_Description",      SqlDbType.NVarChar,         500),
                new SqlParameter("@n_Sequence",         SqlDbType.Int, 4)
            };
            parameters[0].Value = Guid.NewGuid();
            parameters[1].Value = Guid.NewGuid();
            parameters[2].Value = model.s_DataType;
            parameters[3].Value = model.s_RuleRegex;
            parameters[4].Value = model.s_Description;
            parameters[5].Value = model.n_Sequence;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCode_AutoDemandParams DataRowToModel(DataRow row)
 {
     IPSP.Model.TCode_AutoDemandParams model = new IPSP.Model.TCode_AutoDemandParams();
     if (row != null)
     {
         if (row["g_ID"] != null && row["g_ID"].ToString() != "")
         {
             model.g_ID = new Guid(row["g_ID"].ToString());
         }
         if (row["g_CodeAutoDemandID"] != null && row["g_CodeAutoDemandID"].ToString() != "")
         {
             model.g_CodeAutoDemandID = new Guid(row["g_CodeAutoDemandID"].ToString());
         }
         if (row["s_DataType"] != null)
         {
             model.s_DataType = row["s_DataType"].ToString();
         }
         if (row["s_RuleRegex"] != null)
         {
             model.s_RuleRegex = row["s_RuleRegex"].ToString();
         }
         if (row["s_Description"] != null)
         {
             model.s_Description = row["s_Description"].ToString();
         }
         if (row["n_Sequence"] != null && row["n_Sequence"].ToString() != "")
         {
             model.n_Sequence = int.Parse(row["n_Sequence"].ToString());
         }
     }
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCode_AutoDemandParams model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCode_AutoDemandParams set ");
            strSql.Append("g_CodeAutoDemandID=@g_CodeAutoDemandID,");
            strSql.Append("s_DataType=@s_DataType,");
            strSql.Append("s_RuleRegex=@s_RuleRegex,");
            strSql.Append("s_Description=@s_Description,");
            strSql.Append("n_Sequence=@n_Sequence");
            strSql.Append(" where g_ID=@g_ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@g_CodeAutoDemandID", SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@s_DataType",         SqlDbType.NVarChar,          50),
                new SqlParameter("@s_RuleRegex",        SqlDbType.NVarChar,         200),
                new SqlParameter("@s_Description",      SqlDbType.NVarChar,         500),
                new SqlParameter("@n_Sequence",         SqlDbType.Int,                4),
                new SqlParameter("@g_ID",               SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = model.g_CodeAutoDemandID;
            parameters[1].Value = model.s_DataType;
            parameters[2].Value = model.s_RuleRegex;
            parameters[3].Value = model.s_Description;
            parameters[4].Value = model.n_Sequence;
            parameters[5].Value = model.g_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCode_AutoDemandParams GetModel(Guid g_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 g_ID,g_CodeAutoDemandID,s_DataType,s_RuleRegex,s_Description,n_Sequence from TCode_AutoDemandParams ");
            strSql.Append(" where g_ID=@g_ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@g_ID", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = g_ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TCode_AutoDemandParams model)
 {
     return(dal.Update(model));
 }
Esempio n. 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(IPSP.Model.TCode_AutoDemandParams model)
 {
     return(dal.Add(model));
 }