Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TTCase_ChangeItems model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TTCase_ChangeItems set ");
            strSql.Append("s_Item=@s_Item,");
            strSql.Append("n_ProcessID=@n_ProcessID,");
            strSql.Append("s_BeforeChg=@s_BeforeChg,");
            strSql.Append("s_AfterChg=@s_AfterChg,");
            strSql.Append("s_Notes=@s_Notes");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_Item",      SqlDbType.NVarChar, 100),
                new SqlParameter("@n_ProcessID", SqlDbType.Int,        4),
                new SqlParameter("@s_BeforeChg", SqlDbType.NVarChar, 300),
                new SqlParameter("@s_AfterChg",  SqlDbType.NVarChar, 300),
                new SqlParameter("@s_Notes",     SqlDbType.NVarChar, 800),
                new SqlParameter("@n_ID",        SqlDbType.Int,        4),
                new SqlParameter("@n_CaseID",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.s_Item;
            parameters[1].Value = model.n_ProcessID;
            parameters[2].Value = model.s_BeforeChg;
            parameters[3].Value = model.s_AfterChg;
            parameters[4].Value = model.s_Notes;
            parameters[5].Value = model.n_ID;
            parameters[6].Value = model.n_CaseID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TTCase_ChangeItems model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TTCase_ChangeItems(");
            strSql.Append("n_CaseID,s_Item,n_ProcessID,s_BeforeChg,s_AfterChg,s_Notes)");
            strSql.Append(" values (");
            strSql.Append("@n_CaseID,@s_Item,@n_ProcessID,@s_BeforeChg,@s_AfterChg,@s_Notes)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",    SqlDbType.Int,        4),
                new SqlParameter("@s_Item",      SqlDbType.NVarChar, 100),
                new SqlParameter("@n_ProcessID", SqlDbType.Int,        4),
                new SqlParameter("@s_BeforeChg", SqlDbType.NVarChar, 300),
                new SqlParameter("@s_AfterChg",  SqlDbType.NVarChar, 300),
                new SqlParameter("@s_Notes",     SqlDbType.NVarChar, 800)
            };
            parameters[0].Value = model.n_CaseID;
            parameters[1].Value = model.s_Item;
            parameters[2].Value = model.n_ProcessID;
            parameters[3].Value = model.s_BeforeChg;
            parameters[4].Value = model.s_AfterChg;
            parameters[5].Value = model.s_Notes;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TTCase_ChangeItems DataRowToModel(DataRow row)
 {
     IPSP.Model.TTCase_ChangeItems model = new IPSP.Model.TTCase_ChangeItems();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_CaseID"] != null && row["n_CaseID"].ToString() != "")
         {
             model.n_CaseID = int.Parse(row["n_CaseID"].ToString());
         }
         if (row["s_Item"] != null)
         {
             model.s_Item = row["s_Item"].ToString();
         }
         if (row["n_ProcessID"] != null && row["n_ProcessID"].ToString() != "")
         {
             model.n_ProcessID = int.Parse(row["n_ProcessID"].ToString());
         }
         if (row["s_BeforeChg"] != null)
         {
             model.s_BeforeChg = row["s_BeforeChg"].ToString();
         }
         if (row["s_AfterChg"] != null)
         {
             model.s_AfterChg = row["s_AfterChg"].ToString();
         }
         if (row["s_Notes"] != null)
         {
             model.s_Notes = row["s_Notes"].ToString();
         }
     }
     return(model);
 }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TTCase_ChangeItems GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_CaseID,s_Item,n_ProcessID,s_BeforeChg,s_AfterChg,s_Notes from TTCase_ChangeItems ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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

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