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

            strSql.Append("insert into T_OtherFiles(");
            strSql.Append("n_FileID,s_Version,s_CheckedOut,n_CheckedOutBy,s_CheckedOutPath,s_FileStatus)");
            strSql.Append(" values (");
            strSql.Append("@n_FileID,@s_Version,@s_CheckedOut,@n_CheckedOutBy,@s_CheckedOutPath,@s_FileStatus)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_FileID",         SqlDbType.Int,        4),
                new SqlParameter("@s_Version",        SqlDbType.NVarChar,  20),
                new SqlParameter("@s_CheckedOut",     SqlDbType.NVarChar,   1),
                new SqlParameter("@n_CheckedOutBy",   SqlDbType.Int,        4),
                new SqlParameter("@s_CheckedOutPath", SqlDbType.NVarChar, 500),
                new SqlParameter("@s_FileStatus",     SqlDbType.NVarChar, 1)
            };
            parameters[0].Value = model.n_FileID;
            parameters[1].Value = model.s_Version;
            parameters[2].Value = model.s_CheckedOut;
            parameters[3].Value = model.n_CheckedOutBy;
            parameters[4].Value = model.s_CheckedOutPath;
            parameters[5].Value = model.s_FileStatus;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.T_OtherFiles DataRowToModel(DataRow row)
 {
     IPSP.Model.T_OtherFiles model = new IPSP.Model.T_OtherFiles();
     if (row != null)
     {
         if (row["n_FileID"] != null && row["n_FileID"].ToString() != "")
         {
             model.n_FileID = int.Parse(row["n_FileID"].ToString());
         }
         if (row["s_Version"] != null)
         {
             model.s_Version = row["s_Version"].ToString();
         }
         if (row["s_CheckedOut"] != null)
         {
             model.s_CheckedOut = row["s_CheckedOut"].ToString();
         }
         if (row["n_CheckedOutBy"] != null && row["n_CheckedOutBy"].ToString() != "")
         {
             model.n_CheckedOutBy = int.Parse(row["n_CheckedOutBy"].ToString());
         }
         if (row["s_CheckedOutPath"] != null)
         {
             model.s_CheckedOutPath = row["s_CheckedOutPath"].ToString();
         }
         if (row["s_FileStatus"] != null)
         {
             model.s_FileStatus = row["s_FileStatus"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.T_OtherFiles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_OtherFiles set ");
            strSql.Append("s_Version=@s_Version,");
            strSql.Append("s_CheckedOut=@s_CheckedOut,");
            strSql.Append("n_CheckedOutBy=@n_CheckedOutBy,");
            strSql.Append("s_CheckedOutPath=@s_CheckedOutPath,");
            strSql.Append("s_FileStatus=@s_FileStatus");
            strSql.Append(" where n_FileID=@n_FileID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_Version",        SqlDbType.NVarChar,  20),
                new SqlParameter("@s_CheckedOut",     SqlDbType.NVarChar,   1),
                new SqlParameter("@n_CheckedOutBy",   SqlDbType.Int,        4),
                new SqlParameter("@s_CheckedOutPath", SqlDbType.NVarChar, 500),
                new SqlParameter("@s_FileStatus",     SqlDbType.NVarChar,   1),
                new SqlParameter("@n_FileID",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.s_Version;
            parameters[1].Value = model.s_CheckedOut;
            parameters[2].Value = model.n_CheckedOutBy;
            parameters[3].Value = model.s_CheckedOutPath;
            parameters[4].Value = model.s_FileStatus;
            parameters[5].Value = model.n_FileID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.T_OtherFiles GetModel(int n_FileID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_FileID,s_Version,s_CheckedOut,n_CheckedOutBy,s_CheckedOutPath,s_FileStatus from T_OtherFiles ");
            strSql.Append(" where n_FileID=@n_FileID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_FileID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_FileID;

            IPSP.Model.T_OtherFiles model = new IPSP.Model.T_OtherFiles();
            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.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.T_OtherFiles model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(IPSP.Model.T_OtherFiles model)
 {
     return(dal.Add(model));
 }