filesDAL.cs
资源名称:OASystem.rar [点击查看]
上传用户:lishan0805
上传日期:2019-12-08
资源大小:12048k
文件大小:26k
源码类别:
OA系统
开发平台:
C#
- // ===================================================================
- // 产品(COM.OA.SqlServerDAL)项目
- //====================================================================
- // wangyp @Copy Right 2006-2008
- // 文件:filesDAL.cs
- // 项目名称:工程项目管理
- // 创建时间:2008-9-23
- // 负责人:wangyp
- // 先创建SqlHelper.cs文件,引用System.Configuration程序集和实体(COM.OA.Entity)、产品规则(COM.OA.IDAL)项目、引用业务逻辑(COM.OA.BLL)项目
- // ===================================================================
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Text;
- using COM.OA.Entity;
- using COM.OA.IDAL;
- using COM.OA.BLL;
- namespace COM.OA.SqlServerDAL
- {
- /// <summary>
- /// 数据访问层dbo.files
- /// </summary>
- public partial class filesDAL : IfilesDAL
- {
- #region 构造函数
- /// <summary>
- /// 数据层实例化
- /// </summary>
- public filesDAL()
- {
- }
- #endregion
- #region -----------实例化接口函数-----------
- #region 添加
- /// <summary>
- /// 向数据库中插入一条新记录
- /// </summary>
- /// <param name="files">files实体对象</param>
- /// <returns></returns>
- public int Insert(files files)
- {
- string sqlCommand = "filesInsert";
- int res;
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int),
- new SqlParameter("@f_filename",SqlDbType.VarChar),
- new SqlParameter("@f_ftype_id",SqlDbType.Int),
- new SqlParameter("@f_dept_id",SqlDbType.Int),
- new SqlParameter("@f_sendu_id",SqlDbType.Int),
- new SqlParameter("@f_takeu_id",SqlDbType.Int),
- new SqlParameter("@f_isshare",SqlDbType.Int),
- new SqlParameter("@f_remark",SqlDbType.VarChar),
- new SqlParameter("@f_isreturn",SqlDbType.Int),
- new SqlParameter("@f_isread",SqlDbType.Int),
- new SqlParameter("@f_readdegree",SqlDbType.Int),
- new SqlParameter("@f_releasetime",SqlDbType.DateTime),
- new SqlParameter("@f_state",SqlDbType.Int)
- };
- param[0].Direction = ParameterDirection.Output;
- param[1].Value = files.f_filename;
- param[2].Value = files.f_ftype_id;
- param[3].Value = files.f_dept_id;
- param[4].Value = files.f_sendu_id;
- param[5].Value = files.f_takeu_id;
- param[6].Value = files.f_isshare;
- param[7].Value = files.f_remark;
- param[8].Value = files.f_isreturn;
- param[9].Value = files.f_isread;
- param[10].Value = files.f_readdegree;
- param[11].Value = files.f_releasetime;
- param[12].Value = files.f_state;
- res = SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
- files.f_id = ((param[0].Value) == DBNull.Value) ? 0 : Convert.ToInt32(param[0].Value);
- return res;
- }
- /// <summary>
- /// 向数据库中插入一条新记录。带事务
- /// </summary>
- /// <param name="sp">事务对象</param>
- /// <param name="files">files实体对象</param>
- /// <returns></returns>
- public int Insert(SqlTransaction sp, files files)
- {
- string sqlCommand = "filesInsert";
- int res;
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int),
- new SqlParameter("@f_filename",SqlDbType.VarChar),
- new SqlParameter("@f_ftype_id",SqlDbType.Int),
- new SqlParameter("@f_dept_id",SqlDbType.Int),
- new SqlParameter("@f_sendu_id",SqlDbType.Int),
- new SqlParameter("@f_takeu_id",SqlDbType.Int),
- new SqlParameter("@f_isshare",SqlDbType.Int),
- new SqlParameter("@f_remark",SqlDbType.VarChar),
- new SqlParameter("@f_isreturn",SqlDbType.Int),
- new SqlParameter("@f_isread",SqlDbType.Int),
- new SqlParameter("@f_readdegree",SqlDbType.Int),
- new SqlParameter("@f_releasetime",SqlDbType.DateTime),
- new SqlParameter("@f_state",SqlDbType.Int)
- };
- param[0].Direction = ParameterDirection.Output;
- param[1].Value = files.f_filename;
- param[2].Value = files.f_ftype_id;
- param[3].Value = files.f_dept_id;
- param[4].Value = files.f_sendu_id;
- param[5].Value = files.f_takeu_id;
- param[6].Value = files.f_isshare;
- param[7].Value = files.f_remark;
- param[8].Value = files.f_isreturn;
- param[9].Value = files.f_isread;
- param[10].Value = files.f_readdegree;
- param[11].Value = files.f_releasetime;
- param[12].Value = files.f_state;
- res = SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
- files.f_id = ((param[0].Value) == DBNull.Value) ? 0 : Convert.ToInt32(param[0].Value);
- return res;
- }
- #endregion
- #region 更新
- /// <summary>
- /// 向数据表files更新一条记录
- /// </summary>
- /// <param name="files">files实体对象</param>
- /// <returns></returns>
- public int Update(files files)
- {
- string sqlCommand = "filesUpdate";
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int),
- new SqlParameter("@f_filename",SqlDbType.VarChar),
- new SqlParameter("@f_ftype_id",SqlDbType.Int),
- new SqlParameter("@f_dept_id",SqlDbType.Int),
- new SqlParameter("@f_sendu_id",SqlDbType.Int),
- new SqlParameter("@f_takeu_id",SqlDbType.Int),
- new SqlParameter("@f_isshare",SqlDbType.Int),
- new SqlParameter("@f_remark",SqlDbType.VarChar),
- new SqlParameter("@f_isreturn",SqlDbType.Int),
- new SqlParameter("@f_isread",SqlDbType.Int),
- new SqlParameter("@f_readdegree",SqlDbType.Int),
- new SqlParameter("@f_releasetime",SqlDbType.DateTime),
- new SqlParameter("@f_state",SqlDbType.Int)
- };
- param[0].Value = files.f_id;
- param[1].Value = files.f_filename;
- param[2].Value = files.f_ftype_id;
- param[3].Value = files.f_dept_id;
- param[4].Value = files.f_sendu_id;
- param[5].Value = files.f_takeu_id;
- param[6].Value = files.f_isshare;
- param[7].Value = files.f_remark;
- param[8].Value = files.f_isreturn;
- param[9].Value = files.f_isread;
- param[10].Value = files.f_readdegree;
- param[11].Value = files.f_releasetime;
- param[12].Value = files.f_state;
- return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
- }
- /// <summary>
- /// 向数据表files更新一条记录。带事务
- /// </summary>
- /// <param name="sp">事务对象</param>
- /// <param name="files">files实体对象</param>
- /// <returns></returns>
- public int Update(SqlTransaction sp, files files)
- {
- string sqlCommand = "filesUpdate";
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int),
- new SqlParameter("@f_filename",SqlDbType.VarChar),
- new SqlParameter("@f_ftype_id",SqlDbType.Int),
- new SqlParameter("@f_dept_id",SqlDbType.Int),
- new SqlParameter("@f_sendu_id",SqlDbType.Int),
- new SqlParameter("@f_takeu_id",SqlDbType.Int),
- new SqlParameter("@f_isshare",SqlDbType.Int),
- new SqlParameter("@f_remark",SqlDbType.VarChar),
- new SqlParameter("@f_isreturn",SqlDbType.Int),
- new SqlParameter("@f_isread",SqlDbType.Int),
- new SqlParameter("@f_readdegree",SqlDbType.Int),
- new SqlParameter("@f_releasetime",SqlDbType.DateTime),
- new SqlParameter("@f_state",SqlDbType.Int)
- };
- param[0].Value = files.f_id;
- param[1].Value = files.f_filename;
- param[2].Value = files.f_ftype_id;
- param[3].Value = files.f_dept_id;
- param[4].Value = files.f_sendu_id;
- param[5].Value = files.f_takeu_id;
- param[6].Value = files.f_isshare;
- param[7].Value = files.f_remark;
- param[8].Value = files.f_isreturn;
- param[9].Value = files.f_isread;
- param[10].Value = files.f_readdegree;
- param[11].Value = files.f_releasetime;
- param[12].Value = files.f_state;
- return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
- }
- #endregion
- #region 删除
- /// <summary>
- /// 删除数据表files中的一条记录
- /// </summary>
- /// <param name="f_id">f_id</param>
- /// <returns></returns>
- public int Delete(int f_id)
- {
- string sqlCommand = "filesDelete";
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int)
- };
- param[0].Value = f_id;
- return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
- }
- /// <summary>
- /// 删除数据表files中的一条记录
- /// </summary>
- /// <param name="files">files实体对象</param>
- /// <returns></returns>
- public int Delete(files files)
- {
- string sqlCommand = "filesDelete";
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int)
- };
- param[0].Value = files.f_id;
- return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
- }
- /// <summary>
- /// 删除数据表files中的一条记录,带事务
- /// </summary>
- /// <param name="sp">事务对象</param>
- /// <param name="f_id">f_id</param>
- /// <returns></returns>
- public int Delete(SqlTransaction sp, int f_id)
- {
- string sqlCommand = "filesDelete";
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int)
- };
- param[0].Value = f_id;
- return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
- }
- /// <summary>
- /// 删除数据表files中的一条记录,带事务
- /// </summary>
- /// <param name="sp">事务对象</param>
- /// <param name="files">files实体对象</param>
- /// <returns></returns>
- public int Delete(SqlTransaction sp, files files)
- {
- string sqlCommand = "filesDelete";
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int)
- };
- param[0].Value = files.f_id;
- return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
- }
- #endregion
- #region 实体对象
- /// <summary>
- /// 得到files实体对象
- /// </summary>
- /// <param name="row">row</param>
- /// <returns>files实体对象</returns>
- public files Select(DataRow row)
- {
- files obj = new files();
- if (row != null)
- {
- obj.f_id = ((row["f_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_id"]);
- obj.f_filename = row["f_filename"].ToString();
- obj.f_ftype_id = ((row["f_ftype_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_ftype_id"]);
- obj.f_dept_id = ((row["f_dept_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_dept_id"]);
- obj.f_sendu_id = ((row["f_sendu_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_sendu_id"]);
- obj.f_takeu_id = ((row["f_takeu_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_takeu_id"]);
- obj.f_isshare = ((row["f_isshare"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_isshare"]);
- obj.f_remark = row["f_remark"].ToString();
- obj.f_isreturn = ((row["f_isreturn"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_isreturn"]);
- obj.f_isread = ((row["f_isread"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_isread"]);
- obj.f_readdegree = ((row["f_readdegree"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_readdegree"]);
- obj.f_releasetime = ((row["f_releasetime"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(row["f_releasetime"]);
- obj.f_state = ((row["f_state"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["f_state"]);
- }
- else
- {
- return null;
- }
- return obj;
- }
- /// <summary>
- /// 得到files实体对象
- /// </summary>
- /// <param name="dr">dr</param>
- /// <returns>files实体对象</returns>
- public files Select(IDataReader dr)
- {
- files obj = new files();
- obj.f_id = ((dr["f_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_id"]);
- obj.f_filename = dr["f_filename"].ToString();
- obj.f_ftype_id = ((dr["f_ftype_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_ftype_id"]);
- obj.f_dept_id = ((dr["f_dept_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_dept_id"]);
- obj.f_sendu_id = ((dr["f_sendu_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_sendu_id"]);
- obj.f_takeu_id = ((dr["f_takeu_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_takeu_id"]);
- obj.f_isshare = ((dr["f_isshare"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_isshare"]);
- obj.f_remark = dr["f_remark"].ToString();
- obj.f_isreturn = ((dr["f_isreturn"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_isreturn"]);
- obj.f_isread = ((dr["f_isread"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_isread"]);
- obj.f_readdegree = ((dr["f_readdegree"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_readdegree"]);
- obj.f_releasetime = ((dr["f_releasetime"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(dr["f_releasetime"]);
- obj.f_state = ((dr["f_state"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["f_state"]);
- return obj;
- }
- /// <summary>
- /// 根据ID,返回一个files实体对象
- /// </summary>
- /// <param name="f_id">f_id</param>
- /// <returns>files实体对象</returns>
- public files Select(int f_id)
- {
- return this.Select(f_id, false, false);
- }
- /// <summary>
- /// 根据ID,返回一个files实体对象
- /// </summary>
- /// <param name="f_id">f_id</param>
- /// <param name="bParentTable">将files对象设置与父表关联</param>
- /// <param name="bChildrenTable">将files对象设置与子表关联</param>
- /// <returns>files实体对象</returns>
- public files Select(int f_id, bool bParentTable, bool bChildrenTable)
- {
- files obj = null;
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int)
- };
- param[0].Value = f_id;
- string sqlCommand = "filesSelect";
- using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
- {
- while (dr.Read())
- {
- obj = this.Select(dr);
- }
- }
- this.Select(obj, bParentTable, bChildrenTable);
- return obj;
- }
- /// <summary>
- /// 将files实体对象设置与父表和子表关联
- /// </summary>
- /// <param name="obj">files实体对象</param>
- /// <param name="bParentTable">是/否设置与父表对象关联</param>
- /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
- public void Select(files obj, bool bParentTable, bool bChildrenTable)
- {
- //关联的主表
- if (bParentTable)
- {
- obj.users = usersBLL.Select(obj.f_takeu_id);
- obj.filetype = filetypeBLL.Select(obj.f_ftype_id);
- obj.department = departmentBLL.Select(obj.f_dept_id);
- }
- //关联的子表集合
- if (bChildrenTable)
- {
- obj.filerevert = filerevertBLL.Select("fre_f_id=" + obj.f_id.ToString());
- foreach (filerevert item in obj.filerevert)
- {
- item.files = obj;
- }
- }
- }
- #endregion
- #region 父表
- /// <summary>
- /// 设置实体对象(files)的父表对象
- /// </summary>
- /// <param name="files">实体对象</param>
- public void users(files files)
- {
- files.users = usersBLL.Select(files.f_takeu_id);
- }
- /// <summary>
- /// 设置实体对象(files)的父表对象
- /// </summary>
- /// <param name="files">实体对象</param>
- public void filetype(files files)
- {
- files.filetype = filetypeBLL.Select(files.f_ftype_id);
- }
- /// <summary>
- /// 设置实体对象(files)的父表对象
- /// </summary>
- /// <param name="files">实体对象</param>
- public void department(files files)
- {
- files.department = departmentBLL.Select(files.f_dept_id);
- }
- #endregion
- #region 子表
- /// <summary>
- /// 设置实体对象(files)的子表对象
- /// </summary>
- /// <param name="files">实体对象</param>
- public void filerevert(files files)
- {
- files.filerevert = filerevertBLL.Select("fre_f_id=" + files.f_id.ToString());
- }
- #endregion
- #region 查询
- /// <summary>
- /// 得到数据表files所有记录
- /// </summary>
- /// <returns>结果集</returns>
- public IList<files> Select()
- {
- return this.Select(false, false);
- }
- /// <summary>
- /// 得到数据表files所有记录
- /// </summary>
- /// <param name="bParentTable">是/否设置与父表对象关联</param>
- /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
- /// <returns>结果集</returns>
- public IList<files> Select(bool bParentTable, bool bChildrenTable)
- {
- IList<files> list = new List<files>();
- string sqlCommand = "filesSelectAll";
- using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand))
- {
- while (dr.Read())
- {
- list.Add(this.Select(dr));
- }
- }
- foreach (files obj in list)
- {
- this.Select(obj, bParentTable, bChildrenTable);
- }
- return list;
- }
- /// <summary>
- /// 得到数据表files满足查询条件的记录
- /// </summary>
- /// <param name="where">查询条件</param>
- /// <returns>结果集</returns>
- public IList<files> Select(string where)
- {
- return this.Select(where, false, false);
- }
- /// <summary>
- /// 得到数据表files满足查询条件的记录
- /// </summary>
- /// <param name="where">查询条件</param>
- /// <param name="bParentTable">是/否设置与父表对象关联</param>
- /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
- /// <returns>结果集</returns>
- public IList<files> Select(string where, bool bParentTable, bool bChildrenTable)
- {
- IList<files> list = new List<files>();
- SqlParameter[] param ={
- new SqlParameter("@where",SqlDbType.VarChar,8000)
- };
- param[0].Value = where;
- string sqlCommand = "filesSelectByParams";
- using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
- {
- while (dr.Read())
- {
- list.Add(this.Select(dr));
- }
- }
- foreach (files obj in list)
- {
- this.Select(obj, bParentTable, bChildrenTable);
- }
- return list;
- }
- /// <summary>
- /// 得到数据表ArticalInfo满足外键字段查询条件的记录
- /// </summary>
- /// <param name="foreignFieldName">外键字段名称</param>
- /// <param name="foreignFieldValue">外键字段值</param>
- /// <returns>结果集</returns>
- public IList<files> Select(string foreignFieldName, int foreignFieldValue)
- {
- return this.Select(foreignFieldName, foreignFieldValue, false, false);
- }
- /// <summary>
- /// 得到数据表ArticalInfo满足外键字段查询条件的记录
- /// </summary>
- /// <param name="foreignFieldName">外键字段名称</param>
- /// <param name="foreignFieldValue">外键字段值</param>
- /// <param name="bParentTable">是/否设置与父表对象关联</param>
- /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
- /// <returns>结果集</returns>
- public IList<files> Select(string foreignFieldName, int foreignFieldValue, bool bParentTable, bool bChildrenTable)
- {
- return this.Select(string.Format("{0}='{1}'", foreignFieldName, foreignFieldValue), bParentTable, bChildrenTable);
- }
- /// <summary>
- /// 得到数据表files满足查询条件的记录数
- /// </summary>
- /// <param name="where">查询条件</param>
- /// <param name="recordCount">记录数</param>
- public void Select(string where, out int recordCount)
- {
- string sqlCommand = "filesCountByWhere";
- SqlParameter[] param ={
- new SqlParameter("@where",SqlDbType.VarChar,8000),
- new SqlParameter("@recordCount",SqlDbType.Int)
- };
- param[0].Value = where;
- param[1].Direction = ParameterDirection.Output;
- SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
- recordCount = Convert.ToInt32(param[1].Value);
- }
- /// <summary>
- /// 得到数据表files满足查询条件的分页记录
- /// </summary>
- /// <param name="pageSize">每页显示记录数</param>
- /// <param name="pageIndex">当前显示第几页</param>
- /// <param name="where">查询条件</param>
- /// <returns>结果集</returns>
- public IList<files> Select(int pageSize, int pageIndex, string where)
- {
- return this.Select(pageSize, pageIndex, where, false, false);
- }
- /// <summary>
- /// 得到数据表files满足查询条件的分页记录
- /// </summary>
- /// <param name="pageSize">每页显示记录数</param>
- /// <param name="pageIndex">当前显示第几页</param>
- /// <param name="where">查询条件</param>
- /// <param name="bParentTable">是/否设置与父表对象关联</param>
- /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
- /// <returns>结果集</returns>
- public IList<files> Select(int pageSize, int pageIndex, string where, bool bParentTable, bool bChildrenTable)
- {
- IList<files> list = new List<files>();
- string sqlCommand = "filesSelectByPagerParams";
- SqlParameter[] param ={
- new SqlParameter("@pageSize",SqlDbType.Int),
- new SqlParameter("@pageIndex",SqlDbType.Int),
- new SqlParameter("@where",SqlDbType.VarChar,8000)
- };
- param[0].Value = pageSize;
- param[1].Value = pageIndex;
- param[2].Value = where;
- using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
- {
- while (dr.Read())
- {
- list.Add(this.Select(dr));
- }
- }
- foreach (files obj in list)
- {
- this.Select(obj, bParentTable, bChildrenTable);
- }
- return list;
- }
- /// <summary>
- /// 得到数据表files满足查询条件记录
- /// </summary>
- /// <param name="commandType">命令类型</param>
- /// <param name="sqlCommand">SQL命令</param>
- /// <param name="SqlParameter[]">命令参数数组</param>
- /// <returns>结果集</returns>
- public IList<files> Select(CommandType commandType, string sqlCommand, params SqlParameter[] param)
- {
- return this.Select(false, false, commandType, sqlCommand, param);
- }
- /// <summary>
- /// 得到数据表files满足查询条件记录
- /// </summary>
- /// <param name="bParentTable">是/否设置与父表对象关联</param>
- /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
- /// <param name="commandType">命令类型</param>
- /// <param name="sqlCommand">SQL命令</param>
- /// <param name="SqlParameter[]">命令参数数组</param>
- /// <returns>结果集</returns>
- public IList<files> Select(bool bParentTable, bool bChildrenTable, CommandType commandType, string sqlCommand, params SqlParameter[] param)
- {
- IList<files> list = new List<files>();
- using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, commandType, sqlCommand, param))
- {
- while (dr.Read())
- {
- list.Add(this.Select(dr));
- }
- }
- foreach (files obj in list)
- {
- this.Select(obj, bParentTable, bChildrenTable);
- }
- return list;
- }
- /// <summary>
- /// 根据主键检测是否存在该条记录
- /// </summary>
- /// <param name="f_id">f_id</param>
- /// <returns>存在/不存在</returns>
- public bool Exists(int f_id)
- {
- SqlParameter[] param ={
- new SqlParameter("@f_id",SqlDbType.Int)
- };
- param[0].Value = f_id;
- string sqlCommand = "filesIsExist";
- int a = Convert.ToInt32(SqlHelper.ExecuteScalar(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param));
- if (a > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- #endregion
- #endregion
- }
- }