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

OA系统

开发平台:

C#

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