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

OA系统

开发平台:

C#

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