예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCase_OrigRenewFileConn model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCase_OrigRenewFileConn(");
            strSql.Append("n_OrigFileID,n_NewFileID,g_TaskGuid)");
            strSql.Append(" values (");
            strSql.Append("@n_OrigFileID,@n_NewFileID,@g_TaskGuid)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_OrigFileID", SqlDbType.Int,              4),
                new SqlParameter("@n_NewFileID",  SqlDbType.Int,              4),
                new SqlParameter("@g_TaskGuid",   SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = model.n_OrigFileID;
            parameters[1].Value = model.n_NewFileID;
            parameters[2].Value = Guid.NewGuid();

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCase_OrigRenewFileConn model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCase_OrigRenewFileConn set ");
            strSql.Append("n_OrigFileID=@n_OrigFileID,");
            strSql.Append("g_TaskGuid=@g_TaskGuid");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_OrigFileID", SqlDbType.Int,               4),
                new SqlParameter("@g_TaskGuid",   SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@n_ID",         SqlDbType.Int,               4),
                new SqlParameter("@n_NewFileID",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_OrigFileID;
            parameters[1].Value = model.g_TaskGuid;
            parameters[2].Value = model.n_ID;
            parameters[3].Value = model.n_NewFileID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCase_OrigRenewFileConn DataRowToModel(DataRow row)
 {
     IPSP.Model.TCase_OrigRenewFileConn model = new IPSP.Model.TCase_OrigRenewFileConn();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_OrigFileID"] != null && row["n_OrigFileID"].ToString() != "")
         {
             model.n_OrigFileID = int.Parse(row["n_OrigFileID"].ToString());
         }
         if (row["n_NewFileID"] != null && row["n_NewFileID"].ToString() != "")
         {
             model.n_NewFileID = int.Parse(row["n_NewFileID"].ToString());
         }
         if (row["g_TaskGuid"] != null && row["g_TaskGuid"].ToString() != "")
         {
             model.g_TaskGuid = new Guid(row["g_TaskGuid"].ToString());
         }
     }
     return(model);
 }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCase_OrigRenewFileConn GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_OrigFileID,n_NewFileID,g_TaskGuid from TCase_OrigRenewFileConn ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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

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