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

OA系统

开发平台:

C#

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