sendwordDAL.cs
上传用户:lishan0805
上传日期:2019-12-08
资源大小:12048k
文件大小:23k
源码类别:

OA系统

开发平台:

C#

  1. // =================================================================== 
  2. // 产品(COM.OA.SqlServerDAL)项目
  3. //====================================================================
  4. // wangyp @Copy Right 2006-2008
  5. // 文件:sendwordDAL.cs
  6. // 项目名称:工程项目管理
  7. // 创建时间:2008-9-23
  8. // 负责人:wangyp
  9. // 先创建SqlHelper.cs文件,引用System.Configuration程序集和实体(COM.OA.Entity)、产品规则(COM.OA.IDAL)项目、引用业务逻辑(COM.OA.BLL)项目
  10. // ===================================================================
  11. using System;
  12. using System.Collections;
  13. using System.Collections.Generic;
  14. using System.Data;
  15. using System.Data.SqlClient;
  16. using System.Text;
  17. using COM.OA.Entity;
  18. using COM.OA.IDAL;
  19. using COM.OA.BLL;
  20. namespace COM.OA.SqlServerDAL
  21. {
  22.     /// <summary>
  23.     /// 数据访问层dbo.sendword
  24.     /// </summary>
  25.     public partial class sendwordDAL : IsendwordDAL
  26.     {
  27.         #region 构造函数
  28.         /// <summary>
  29.         /// 数据层实例化
  30.         /// </summary>
  31.         public sendwordDAL()
  32.         {
  33.         }
  34.         #endregion
  35.         #region -----------实例化接口函数-----------
  36.         #region 添加
  37.         /// <summary>
  38.         /// 向数据库中插入一条新记录
  39.         /// </summary>
  40.         /// <param name="sendword">sendword实体对象</param>
  41.         /// <returns></returns>
  42.         public int Insert(sendword sendword)
  43.         {
  44.             string sqlCommand = "sendwordInsert";
  45.             int res;
  46.             SqlParameter[] param ={
  47. new SqlParameter("@sw_id",SqlDbType.Int),
  48. new SqlParameter("@sw_title",SqlDbType.VarChar),
  49. new SqlParameter("@sw_content",SqlDbType.VarChar),
  50. new SqlParameter("@sw_dept_id",SqlDbType.Int),
  51. new SqlParameter("@sw_u_id",SqlDbType.Int),
  52. new SqlParameter("@sw_releasetime",SqlDbType.DateTime),
  53. new SqlParameter("@sw_reads",SqlDbType.Int),
  54. new SqlParameter("@sw_state",SqlDbType.Int)
  55. };
  56.             param[0].Direction = ParameterDirection.Output;
  57.             param[1].Value = sendword.sw_title;
  58.             param[2].Value = sendword.sw_content;
  59.             param[3].Value = sendword.sw_dept_id;
  60.             param[4].Value = sendword.sw_u_id;
  61.             param[5].Value = sendword.sw_releasetime;
  62.             param[6].Value = sendword.sw_reads;
  63.             param[7].Value = sendword.sw_state;
  64.             res = SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  65.             sendword.sw_id = ((param[0].Value) == DBNull.Value) ? 0 : Convert.ToInt32(param[0].Value);
  66.             return res;
  67.         }
  68.         /// <summary>
  69.         /// 向数据库中插入一条新记录。带事务
  70.         /// </summary>
  71.         /// <param name="sp">事务对象</param>
  72.         /// <param name="sendword">sendword实体对象</param>
  73.         /// <returns></returns>
  74.         public int Insert(SqlTransaction sp, sendword sendword)
  75.         {
  76.             string sqlCommand = "sendwordInsert";
  77.             int res;
  78.             SqlParameter[] param ={
  79. new SqlParameter("@sw_id",SqlDbType.Int),
  80. new SqlParameter("@sw_title",SqlDbType.VarChar),
  81. new SqlParameter("@sw_content",SqlDbType.VarChar),
  82. new SqlParameter("@sw_dept_id",SqlDbType.Int),
  83. new SqlParameter("@sw_u_id",SqlDbType.Int),
  84. new SqlParameter("@sw_releasetime",SqlDbType.DateTime),
  85. new SqlParameter("@sw_reads",SqlDbType.Int),
  86. new SqlParameter("@sw_state",SqlDbType.Int)
  87. };
  88.             param[0].Direction = ParameterDirection.Output;
  89.             param[1].Value = sendword.sw_title;
  90.             param[2].Value = sendword.sw_content;
  91.             param[3].Value = sendword.sw_dept_id;
  92.             param[4].Value = sendword.sw_u_id;
  93.             param[5].Value = sendword.sw_releasetime;
  94.             param[6].Value = sendword.sw_reads;
  95.             param[7].Value = sendword.sw_state;
  96.             res = SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
  97.             sendword.sw_id = ((param[0].Value) == DBNull.Value) ? 0 : Convert.ToInt32(param[0].Value);
  98.             return res;
  99.         }
  100.         #endregion
  101.         #region 更新
  102.         /// <summary>
  103.         /// 向数据表sendword更新一条记录
  104.         /// </summary>
  105.         /// <param name="sendword">sendword实体对象</param>
  106.         /// <returns></returns>
  107.         public int Update(sendword sendword)
  108.         {
  109.             string sqlCommand = "sendwordUpdate";
  110.             SqlParameter[] param ={
  111. new SqlParameter("@sw_id",SqlDbType.Int),
  112. new SqlParameter("@sw_title",SqlDbType.VarChar),
  113. new SqlParameter("@sw_content",SqlDbType.VarChar),
  114. new SqlParameter("@sw_dept_id",SqlDbType.Int),
  115. new SqlParameter("@sw_u_id",SqlDbType.Int),
  116. new SqlParameter("@sw_releasetime",SqlDbType.DateTime),
  117. new SqlParameter("@sw_reads",SqlDbType.Int),
  118. new SqlParameter("@sw_state",SqlDbType.Int)
  119. };
  120.             param[0].Value = sendword.sw_id;
  121.             param[1].Value = sendword.sw_title;
  122.             param[2].Value = sendword.sw_content;
  123.             param[3].Value = sendword.sw_dept_id;
  124.             param[4].Value = sendword.sw_u_id;
  125.             param[5].Value = sendword.sw_releasetime;
  126.             param[6].Value = sendword.sw_reads;
  127.             param[7].Value = sendword.sw_state;
  128.             return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  129.         }
  130.         /// <summary>
  131.         /// 向数据表sendword更新一条记录。带事务
  132.         /// </summary>
  133.         /// <param name="sp">事务对象</param>
  134.         /// <param name="sendword">sendword实体对象</param>
  135.         /// <returns></returns>
  136.         public int Update(SqlTransaction sp, sendword sendword)
  137.         {
  138.             string sqlCommand = "sendwordUpdate";
  139.             SqlParameter[] param ={
  140. new SqlParameter("@sw_id",SqlDbType.Int),
  141. new SqlParameter("@sw_title",SqlDbType.VarChar),
  142. new SqlParameter("@sw_content",SqlDbType.VarChar),
  143. new SqlParameter("@sw_dept_id",SqlDbType.Int),
  144. new SqlParameter("@sw_u_id",SqlDbType.Int),
  145. new SqlParameter("@sw_releasetime",SqlDbType.DateTime),
  146. new SqlParameter("@sw_reads",SqlDbType.Int),
  147. new SqlParameter("@sw_state",SqlDbType.Int)
  148. };
  149.             param[0].Value = sendword.sw_id;
  150.             param[1].Value = sendword.sw_title;
  151.             param[2].Value = sendword.sw_content;
  152.             param[3].Value = sendword.sw_dept_id;
  153.             param[4].Value = sendword.sw_u_id;
  154.             param[5].Value = sendword.sw_releasetime;
  155.             param[6].Value = sendword.sw_reads;
  156.             param[7].Value = sendword.sw_state;
  157.             return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
  158.         }
  159.         #endregion
  160.         #region 删除
  161.         /// <summary>
  162.         /// 删除数据表sendword中的一条记录
  163.         /// </summary>
  164.         /// <param name="sw_id">sw_id</param>
  165.         /// <returns></returns>
  166.         public int Delete(int sw_id)
  167.         {
  168.             string sqlCommand = "sendwordDelete";
  169.             SqlParameter[] param ={
  170. new SqlParameter("@sw_id",SqlDbType.Int)
  171. };
  172.             param[0].Value = sw_id;
  173.             return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  174.         }
  175.         /// <summary>
  176.         /// 删除数据表sendword中的一条记录
  177.         /// </summary>
  178.         /// <param name="sendword">sendword实体对象</param>
  179.         /// <returns></returns>
  180.         public int Delete(sendword sendword)
  181.         {
  182.             string sqlCommand = "sendwordDelete";
  183.             SqlParameter[] param ={
  184. new SqlParameter("@sw_id",SqlDbType.Int)
  185. };
  186.             param[0].Value = sendword.sw_id;
  187.             return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  188.         }
  189.         /// <summary>
  190.         /// 删除数据表sendword中的一条记录,带事务
  191.         /// </summary>
  192.         /// <param name="sp">事务对象</param>
  193.         /// <param name="sw_id">sw_id</param>
  194.         /// <returns></returns>
  195.         public int Delete(SqlTransaction sp, int sw_id)
  196.         {
  197.             string sqlCommand = "sendwordDelete";
  198.             SqlParameter[] param ={
  199. new SqlParameter("@sw_id",SqlDbType.Int)
  200. };
  201.             param[0].Value = sw_id;
  202.             return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
  203.         }
  204.         /// <summary>
  205.         /// 删除数据表sendword中的一条记录,带事务
  206.         /// </summary>
  207.         /// <param name="sp">事务对象</param>
  208.         /// <param name="sendword">sendword实体对象</param>
  209.         /// <returns></returns>
  210.         public int Delete(SqlTransaction sp, sendword sendword)
  211.         {
  212.             string sqlCommand = "sendwordDelete";
  213.             SqlParameter[] param ={
  214. new SqlParameter("@sw_id",SqlDbType.Int)
  215. };
  216.             param[0].Value = sendword.sw_id;
  217.             return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
  218.         }
  219.         #endregion
  220.         #region 实体对象
  221.         /// <summary>
  222.         /// 得到sendword实体对象
  223.         /// </summary>
  224.         /// <param name="row">row</param>
  225.         /// <returns>sendword实体对象</returns>
  226.         public sendword Select(DataRow row)
  227.         {
  228.             sendword obj = new sendword();
  229.             if (row != null)
  230.             {
  231.                 obj.sw_id = ((row["sw_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["sw_id"]);
  232.                 obj.sw_title = row["sw_title"].ToString();
  233.                 obj.sw_content = row["sw_content"].ToString();
  234.                 obj.sw_dept_id = ((row["sw_dept_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["sw_dept_id"]);
  235.                 obj.sw_u_id = ((row["sw_u_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["sw_u_id"]);
  236.                 obj.sw_releasetime = ((row["sw_releasetime"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(row["sw_releasetime"]);
  237.                 obj.sw_reads = ((row["sw_reads"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["sw_reads"]);
  238.                 obj.sw_state = ((row["sw_state"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["sw_state"]);
  239.             }
  240.             else
  241.             {
  242.                 return null;
  243.             }
  244.             return obj;
  245.         }
  246.         /// <summary>
  247.         /// 得到sendword实体对象
  248.         /// </summary>
  249.         /// <param name="dr">dr</param>
  250.         /// <returns>sendword实体对象</returns>
  251.         public sendword Select(IDataReader dr)
  252.         {
  253.             sendword obj = new sendword();
  254.             obj.sw_id = ((dr["sw_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["sw_id"]);
  255.             obj.sw_title = dr["sw_title"].ToString();
  256.             obj.sw_content = dr["sw_content"].ToString();
  257.             obj.sw_dept_id = ((dr["sw_dept_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["sw_dept_id"]);
  258.             obj.sw_u_id = ((dr["sw_u_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["sw_u_id"]);
  259.             obj.sw_releasetime = ((dr["sw_releasetime"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(dr["sw_releasetime"]);
  260.             obj.sw_reads = ((dr["sw_reads"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["sw_reads"]);
  261.             obj.sw_state = ((dr["sw_state"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["sw_state"]);
  262.             return obj;
  263.         }
  264.         /// <summary>
  265.         /// 根据ID,返回一个sendword实体对象
  266.         /// </summary>
  267.         /// <param name="sw_id">sw_id</param>
  268.         /// <returns>sendword实体对象</returns>
  269.         public sendword Select(int sw_id)
  270.         {
  271.             return this.Select(sw_id, false, false);
  272.         }
  273.         /// <summary>
  274.         /// 根据ID,返回一个sendword实体对象
  275.         /// </summary>
  276.         /// <param name="sw_id">sw_id</param>
  277.         /// <param name="bParentTable">将sendword对象设置与父表关联</param>
  278.         /// <param name="bChildrenTable">将sendword对象设置与子表关联</param>
  279.         /// <returns>sendword实体对象</returns>
  280.         public sendword Select(int sw_id, bool bParentTable, bool bChildrenTable)
  281.         {
  282.             sendword obj = null;
  283.             SqlParameter[] param ={
  284. new SqlParameter("@sw_id",SqlDbType.Int)
  285. };
  286.             param[0].Value = sw_id;
  287.             string sqlCommand = "sendwordSelect";
  288.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
  289.             {
  290.                 while (dr.Read())
  291.                 {
  292.                     obj = this.Select(dr);
  293.                 }
  294.             }
  295.             this.Select(obj, bParentTable, bChildrenTable);
  296.             return obj;
  297.         }
  298.         /// <summary>
  299.         /// 将sendword实体对象设置与父表和子表关联
  300.         /// </summary>
  301.         /// <param name="obj">sendword实体对象</param>
  302.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  303.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  304.         public void Select(sendword obj, bool bParentTable, bool bChildrenTable)
  305.         {
  306.             //关联的主表
  307.             if (bParentTable)
  308.             {
  309.                 obj.users = usersBLL.Select(obj.sw_u_id);
  310.                 obj.department = departmentBLL.Select(obj.sw_dept_id);
  311.             }
  312.             //关联的子表集合
  313.             if (bChildrenTable)
  314.             {
  315.             }
  316.         }
  317.         #endregion
  318.         #region 父表
  319.         /// <summary>
  320.         /// 设置实体对象(sendword)的父表对象
  321.         /// </summary>
  322.         /// <param name="sendword">实体对象</param>
  323.         public void users(sendword sendword)
  324.         {
  325.             sendword.users = usersBLL.Select(sendword.sw_u_id);
  326.         }
  327.         /// <summary>
  328.         /// 设置实体对象(sendword)的父表对象
  329.         /// </summary>
  330.         /// <param name="sendword">实体对象</param>
  331.         public void department(sendword sendword)
  332.         {
  333.             sendword.department = departmentBLL.Select(sendword.sw_dept_id);
  334.         }
  335.         #endregion
  336.         #region 子表
  337.         #endregion
  338.         #region 查询
  339.         /// <summary>
  340.         /// 得到数据表sendword所有记录
  341.         /// </summary>
  342.         /// <returns>结果集</returns>
  343.         public IList<sendword> Select()
  344.         {
  345.             return this.Select(false, false);
  346.         }
  347.         /// <summary>
  348.         /// 得到数据表sendword所有记录
  349.         /// </summary>
  350.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  351.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  352.         /// <returns>结果集</returns>
  353.         public IList<sendword> Select(bool bParentTable, bool bChildrenTable)
  354.         {
  355.             IList<sendword> list = new List<sendword>();
  356.             string sqlCommand = "sendwordSelectAll";
  357.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand))
  358.             {
  359.                 while (dr.Read())
  360.                 {
  361.                     list.Add(this.Select(dr));
  362.                 }
  363.             }
  364.             foreach (sendword obj in list)
  365.             {
  366.                 this.Select(obj, bParentTable, bChildrenTable);
  367.             }
  368.             return list;
  369.         }
  370.         /// <summary>
  371.         /// 得到数据表sendword满足查询条件的记录
  372.         /// </summary>
  373.         /// <param name="where">查询条件</param>
  374.         /// <returns>结果集</returns>
  375.         public IList<sendword> Select(string where)
  376.         {
  377.             return this.Select(where, false, false);
  378.         }
  379.         /// <summary>
  380.         /// 得到数据表sendword满足查询条件的记录
  381.         /// </summary>
  382.         /// <param name="where">查询条件</param>
  383.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  384.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  385.         /// <returns>结果集</returns>
  386.         public IList<sendword> Select(string where, bool bParentTable, bool bChildrenTable)
  387.         {
  388.             IList<sendword> list = new List<sendword>();
  389.             SqlParameter[] param ={
  390. new SqlParameter("@where",SqlDbType.VarChar,8000)
  391. };
  392.             param[0].Value = where;
  393.             string sqlCommand = "sendwordSelectByParams";
  394.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
  395.             {
  396.                 while (dr.Read())
  397.                 {
  398.                     list.Add(this.Select(dr));
  399.                 }
  400.             }
  401.             foreach (sendword obj in list)
  402.             {
  403.                 this.Select(obj, bParentTable, bChildrenTable);
  404.             }
  405.             return list;
  406.         }
  407.         /// <summary>
  408.         /// 得到数据表ArticalInfo满足外键字段查询条件的记录
  409.         /// </summary>
  410.         /// <param name="foreignFieldName">外键字段名称</param>
  411.         /// <param name="foreignFieldValue">外键字段值</param>
  412.         /// <returns>结果集</returns>
  413.         public IList<sendword> Select(string foreignFieldName, int foreignFieldValue)
  414.         {
  415.             return this.Select(foreignFieldName, foreignFieldValue, false, false);
  416.         }
  417.         /// <summary>
  418.         /// 得到数据表ArticalInfo满足外键字段查询条件的记录
  419.         /// </summary>
  420.         /// <param name="foreignFieldName">外键字段名称</param>
  421.         /// <param name="foreignFieldValue">外键字段值</param>
  422.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  423.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  424.         /// <returns>结果集</returns>
  425.         public IList<sendword> Select(string foreignFieldName, int foreignFieldValue, bool bParentTable, bool bChildrenTable)
  426.         {
  427.             return this.Select(string.Format("{0}='{1}'", foreignFieldName, foreignFieldValue), bParentTable, bChildrenTable);
  428.         }
  429.         /// <summary>
  430.         /// 得到数据表sendword满足查询条件的记录数
  431.         /// </summary>
  432.         /// <param name="where">查询条件</param>
  433.         /// <param name="recordCount">记录数</param>
  434.         public void Select(string where, out int recordCount)
  435.         {
  436.             string sqlCommand = "sendwordCountByWhere";
  437.             SqlParameter[] param ={
  438. new SqlParameter("@where",SqlDbType.VarChar,8000),
  439. new SqlParameter("@recordCount",SqlDbType.Int)
  440. };
  441.             param[0].Value = where;
  442.             param[1].Direction = ParameterDirection.Output;
  443.             SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  444.             recordCount = Convert.ToInt32(param[1].Value);
  445.         }
  446.         /// <summary>
  447.         /// 得到数据表sendword满足查询条件的分页记录
  448.         /// </summary>
  449.         /// <param name="pageSize">每页显示记录数</param>
  450.         /// <param name="pageIndex">当前显示第几页</param>
  451.         /// <param name="where">查询条件</param>
  452.         /// <returns>结果集</returns>
  453.         public IList<sendword> Select(int pageSize, int pageIndex, string where)
  454.         {
  455.             return this.Select(pageSize, pageIndex, where, false, false);
  456.         }
  457.         /// <summary>
  458.         /// 得到数据表sendword满足查询条件的分页记录
  459.         /// </summary>
  460.         /// <param name="pageSize">每页显示记录数</param>
  461.         /// <param name="pageIndex">当前显示第几页</param>
  462.         /// <param name="where">查询条件</param>
  463.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  464.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  465.         /// <returns>结果集</returns>
  466.         public IList<sendword> Select(int pageSize, int pageIndex, string where, bool bParentTable, bool bChildrenTable)
  467.         {
  468.             IList<sendword> list = new List<sendword>();
  469.             string sqlCommand = "sendwordSelectByPagerParams";
  470.             SqlParameter[] param ={
  471. new SqlParameter("@pageSize",SqlDbType.Int),
  472. new SqlParameter("@pageIndex",SqlDbType.Int),
  473. new SqlParameter("@where",SqlDbType.VarChar,8000)
  474. };
  475.             param[0].Value = pageSize;
  476.             param[1].Value = pageIndex;
  477.             param[2].Value = where;
  478.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
  479.             {
  480.                 while (dr.Read())
  481.                 {
  482.                     list.Add(this.Select(dr));
  483.                 }
  484.             }
  485.             foreach (sendword obj in list)
  486.             {
  487.                 this.Select(obj, bParentTable, bChildrenTable);
  488.             }
  489.             return list;
  490.         }
  491.         /// <summary>
  492.         /// 得到数据表sendword满足查询条件记录
  493.         /// </summary>
  494.         /// <param name="commandType">命令类型</param>
  495.         /// <param name="sqlCommand">SQL命令</param>
  496.         /// <param name="SqlParameter[]">命令参数数组</param>
  497.         /// <returns>结果集</returns>
  498.         public IList<sendword> Select(CommandType commandType, string sqlCommand, params SqlParameter[] param)
  499.         {
  500.             return this.Select(false, false, commandType, sqlCommand, param);
  501.         }
  502.         /// <summary>
  503.         /// 得到数据表sendword满足查询条件记录
  504.         /// </summary>
  505.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  506.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  507.         /// <param name="commandType">命令类型</param>
  508.         /// <param name="sqlCommand">SQL命令</param>
  509.         /// <param name="SqlParameter[]">命令参数数组</param>
  510.         /// <returns>结果集</returns>
  511.         public IList<sendword> Select(bool bParentTable, bool bChildrenTable, CommandType commandType, string sqlCommand, params SqlParameter[] param)
  512.         {
  513.             IList<sendword> list = new List<sendword>();
  514.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, commandType, sqlCommand, param))
  515.             {
  516.                 while (dr.Read())
  517.                 {
  518.                     list.Add(this.Select(dr));
  519.                 }
  520.             }
  521.             foreach (sendword obj in list)
  522.             {
  523.                 this.Select(obj, bParentTable, bChildrenTable);
  524.             }
  525.             return list;
  526.         }
  527.         /// <summary>
  528.         /// 根据主键检测是否存在该条记录
  529.         /// </summary>
  530.         /// <param name="sw_id">sw_id</param>
  531.         /// <returns>存在/不存在</returns>
  532.         public bool Exists(int sw_id)
  533.         {
  534.             SqlParameter[] param ={
  535.                                  new SqlParameter("@sw_id",SqlDbType.Int)
  536.                                  };
  537.             param[0].Value = sw_id;
  538.             string sqlCommand = "sendwordIsExist";
  539.             int a = Convert.ToInt32(SqlHelper.ExecuteScalar(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param));
  540.             if (a > 0)
  541.             {
  542.                 return true;
  543.             }
  544.             else
  545.             {
  546.                 return false;
  547.             }
  548.         }
  549.         #endregion
  550.         #endregion
  551.     }
  552. }