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

            strSql.Append("update Table_Log set ");
            strSql.Append("n_CaseID=@n_CaseID,");
            strSql.Append("n_RowID=@n_RowID,");
            strSql.Append("s_CaseSerial=@s_CaseSerial,");
            strSql.Append("strsql=@strsql,");
            strSql.Append("tableName=@tableName,");
            strSql.Append("ExcelName=@ExcelName,");
            strSql.Append("str2=@str2,");
            strSql.Append("msg=@msg");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",     SqlDbType.Int,        4),
                new SqlParameter("@n_RowID",      SqlDbType.Int,        4),
                new SqlParameter("@s_CaseSerial", SqlDbType.VarChar,  500),
                new SqlParameter("@strsql",       SqlDbType.VarChar, 2000),
                new SqlParameter("@tableName",    SqlDbType.VarChar,  500),
                new SqlParameter("@ExcelName",    SqlDbType.VarChar,  500),
                new SqlParameter("@str2",         SqlDbType.VarChar, 2000),
                new SqlParameter("@msg",          SqlDbType.VarChar, 2000),
                new SqlParameter("@n_ID",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_CaseID;
            parameters[1].Value = model.n_RowID;
            parameters[2].Value = model.s_CaseSerial;
            parameters[3].Value = model.strsql;
            parameters[4].Value = model.tableName;
            parameters[5].Value = model.ExcelName;
            parameters[6].Value = model.str2;
            parameters[7].Value = model.msg;
            parameters[8].Value = model.n_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.Table_Log DataRowToModel(DataRow row)
 {
     IPSP.Model.Table_Log model = new IPSP.Model.Table_Log();
     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["n_RowID"] != null && row["n_RowID"].ToString() != "")
         {
             model.n_RowID = int.Parse(row["n_RowID"].ToString());
         }
         if (row["s_CaseSerial"] != null)
         {
             model.s_CaseSerial = row["s_CaseSerial"].ToString();
         }
         if (row["strsql"] != null)
         {
             model.strsql = row["strsql"].ToString();
         }
         if (row["tableName"] != null)
         {
             model.tableName = row["tableName"].ToString();
         }
         if (row["ExcelName"] != null)
         {
             model.ExcelName = row["ExcelName"].ToString();
         }
         if (row["str2"] != null)
         {
             model.str2 = row["str2"].ToString();
         }
         if (row["msg"] != null)
         {
             model.msg = row["msg"].ToString();
         }
     }
     return(model);
 }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.Table_Log model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Table_Log(");
            strSql.Append("n_CaseID,n_RowID,s_CaseSerial,strsql,tableName,ExcelName,str2,msg)");
            strSql.Append(" values (");
            strSql.Append("@n_CaseID,@n_RowID,@s_CaseSerial,@strsql,@tableName,@ExcelName,@str2,@msg)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",     SqlDbType.Int,        4),
                new SqlParameter("@n_RowID",      SqlDbType.Int,        4),
                new SqlParameter("@s_CaseSerial", SqlDbType.VarChar,  500),
                new SqlParameter("@strsql",       SqlDbType.VarChar, 2000),
                new SqlParameter("@tableName",    SqlDbType.VarChar,  500),
                new SqlParameter("@ExcelName",    SqlDbType.VarChar,  500),
                new SqlParameter("@str2",         SqlDbType.VarChar, 2000),
                new SqlParameter("@msg",          SqlDbType.VarChar, 2000)
            };
            parameters[0].Value = model.n_CaseID;
            parameters[1].Value = model.n_RowID;
            parameters[2].Value = model.s_CaseSerial;
            parameters[3].Value = model.strsql;
            parameters[4].Value = model.tableName;
            parameters[5].Value = model.ExcelName;
            parameters[6].Value = model.str2;
            parameters[7].Value = model.msg;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.Table_Log GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_CaseID,n_RowID,s_CaseSerial,strsql,tableName,ExcelName,str2,msg from Table_Log ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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

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