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

OA系统

开发平台:

C#

  1. // =================================================================== 
  2. // 产品(COM.OA.SqlServerDAL)项目
  3. //====================================================================
  4. // wangyp @Copy Right 2006-2008
  5. // 文件:employeeDAL.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.employee
  24.     /// </summary>
  25.     public partial class employeeDAL : IemployeeDAL
  26.     {
  27.         #region 构造函数
  28.         /// <summary>
  29.         /// 数据层实例化
  30.         /// </summary>
  31.         public employeeDAL()
  32.         {
  33.         }
  34.         #endregion
  35.         #region -----------实例化接口函数-----------
  36.         #region 添加
  37.         /// <summary>
  38.         /// 向数据库中插入一条新记录
  39.         /// </summary>
  40.         /// <param name="employee">employee实体对象</param>
  41.         /// <returns></returns>
  42.         public int Insert(employee employee)
  43.         {
  44.             string sqlCommand = "employeeInsert";
  45.             int res;
  46.             SqlParameter[] param ={
  47. new SqlParameter("@em_id",SqlDbType.Int),
  48. new SqlParameter("@em_number",SqlDbType.VarChar),
  49. new SqlParameter("@em_name",SqlDbType.VarChar),
  50. new SqlParameter("@em_evername",SqlDbType.VarChar),
  51. new SqlParameter("@em_gender",SqlDbType.Int),
  52. new SqlParameter("@em_birth",SqlDbType.DateTime),
  53. new SqlParameter("@em_marriage",SqlDbType.VarChar),
  54. new SqlParameter("@em_n_id",SqlDbType.Int),
  55. new SqlParameter("@em_na_id",SqlDbType.Int),
  56. new SqlParameter("@em_p_id",SqlDbType.Int),
  57. new SqlParameter("@em_stature",SqlDbType.VarChar),
  58. new SqlParameter("@em_avoirdupois",SqlDbType.VarChar),
  59. new SqlParameter("@em_v_id",SqlDbType.Int),
  60. new SqlParameter("@em_statuscard",SqlDbType.VarChar),
  61. new SqlParameter("@em_health",SqlDbType.VarChar),
  62. new SqlParameter("@em_bloodtype",SqlDbType.VarChar),
  63. new SqlParameter("@em_phone",SqlDbType.VarChar),
  64. new SqlParameter("@em_mobile",SqlDbType.VarChar),
  65. new SqlParameter("@em_email",SqlDbType.VarChar),
  66. new SqlParameter("@em_finishschool",SqlDbType.VarChar),
  67. new SqlParameter("@em_speciality",SqlDbType.VarChar),
  68. new SqlParameter("@em_l_id",SqlDbType.Int),
  69. new SqlParameter("@em_graduatetime",SqlDbType.DateTime),
  70. new SqlParameter("@em_degree",SqlDbType.VarChar),
  71. new SqlParameter("@em_language",SqlDbType.VarChar),
  72. new SqlParameter("@em_languagelevel",SqlDbType.VarChar),
  73. new SqlParameter("@em_languageletter",SqlDbType.VarChar),
  74. new SqlParameter("@em_computerlevel",SqlDbType.VarChar),
  75. new SqlParameter("@em_computerletter",SqlDbType.VarChar),
  76. new SqlParameter("@em_computergood",SqlDbType.VarChar),
  77. new SqlParameter("@em_mandarinlevel",SqlDbType.VarChar),
  78. new SqlParameter("@em_familyaddress",SqlDbType.VarChar),
  79. new SqlParameter("@em_postalcode",SqlDbType.VarChar),
  80. new SqlParameter("@em_address",SqlDbType.VarChar),
  81. new SqlParameter("@em_familyphone",SqlDbType.VarChar),
  82. new SqlParameter("@em_addresspostalcode",SqlDbType.VarChar),
  83. new SqlParameter("@em_familycircs",SqlDbType.VarChar),
  84. new SqlParameter("@em_recordlocus",SqlDbType.VarChar),
  85. new SqlParameter("@em_jobname",SqlDbType.VarChar),
  86. new SqlParameter("@em_whenjoinwork",SqlDbType.VarChar),
  87. new SqlParameter("@em_whenthiswork",SqlDbType.VarChar),
  88. new SqlParameter("@em_addlength",SqlDbType.VarChar),
  89. new SqlParameter("@em_thisunitlength",SqlDbType.VarChar),
  90. new SqlParameter("@em_dept_id",SqlDbType.Int),
  91. new SqlParameter("@em_duty",SqlDbType.VarChar),
  92. new SqlParameter("@em_remark",SqlDbType.VarChar),
  93. new SqlParameter("@em_bookerid",SqlDbType.Int),
  94. new SqlParameter("@em_registertime",SqlDbType.DateTime),
  95. new SqlParameter("@em_photo",SqlDbType.VarChar)
  96. };
  97.             param[0].Direction = ParameterDirection.Output;
  98.             param[1].Value = employee.em_number;
  99.             param[2].Value = employee.em_name;
  100.             param[3].Value = employee.em_evername;
  101.             param[4].Value = employee.em_gender;
  102.             param[5].Value = employee.em_birth;
  103.             param[6].Value = employee.em_marriage;
  104.             param[7].Value = employee.em_n_id;
  105.             param[8].Value = employee.em_na_id;
  106.             param[9].Value = employee.em_p_id;
  107.             param[10].Value = employee.em_stature;
  108.             param[11].Value = employee.em_avoirdupois;
  109.             param[12].Value = employee.em_v_id;
  110.             param[13].Value = employee.em_statuscard;
  111.             param[14].Value = employee.em_health;
  112.             param[15].Value = employee.em_bloodtype;
  113.             param[16].Value = employee.em_phone;
  114.             param[17].Value = employee.em_mobile;
  115.             param[18].Value = employee.em_email;
  116.             param[19].Value = employee.em_finishschool;
  117.             param[20].Value = employee.em_speciality;
  118.             param[21].Value = employee.em_l_id;
  119.             param[22].Value = employee.em_graduatetime;
  120.             param[23].Value = employee.em_degree;
  121.             param[24].Value = employee.em_language;
  122.             param[25].Value = employee.em_languagelevel;
  123.             param[26].Value = employee.em_languageletter;
  124.             param[27].Value = employee.em_computerlevel;
  125.             param[28].Value = employee.em_computerletter;
  126.             param[29].Value = employee.em_computergood;
  127.             param[30].Value = employee.em_mandarinlevel;
  128.             param[31].Value = employee.em_familyaddress;
  129.             param[32].Value = employee.em_postalcode;
  130.             param[33].Value = employee.em_address;
  131.             param[34].Value = employee.em_familyphone;
  132.             param[35].Value = employee.em_addresspostalcode;
  133.             param[36].Value = employee.em_familycircs;
  134.             param[37].Value = employee.em_recordlocus;
  135.             param[38].Value = employee.em_jobname;
  136.             param[39].Value = employee.em_whenjoinwork;
  137.             param[40].Value = employee.em_whenthiswork;
  138.             param[41].Value = employee.em_addlength;
  139.             param[42].Value = employee.em_thisunitlength;
  140.             param[43].Value = employee.em_dept_id;
  141.             param[44].Value = employee.em_duty;
  142.             param[45].Value = employee.em_remark;
  143.             param[46].Value = employee.em_bookerid;
  144.             param[47].Value = employee.em_registertime;
  145.             param[48].Value = employee.em_photo;
  146.             res = SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  147.             employee.em_id = ((param[0].Value) == DBNull.Value) ? 0 : Convert.ToInt32(param[0].Value);
  148.             return res;
  149.         }
  150.         /// <summary>
  151.         /// 向数据库中插入一条新记录。带事务
  152.         /// </summary>
  153.         /// <param name="sp">事务对象</param>
  154.         /// <param name="employee">employee实体对象</param>
  155.         /// <returns></returns>
  156.         public int Insert(SqlTransaction sp, employee employee)
  157.         {
  158.             string sqlCommand = "employeeInsert";
  159.             int res;
  160.             SqlParameter[] param ={
  161. new SqlParameter("@em_id",SqlDbType.Int),
  162. new SqlParameter("@em_number",SqlDbType.VarChar),
  163. new SqlParameter("@em_name",SqlDbType.VarChar),
  164. new SqlParameter("@em_evername",SqlDbType.VarChar),
  165. new SqlParameter("@em_gender",SqlDbType.Int),
  166. new SqlParameter("@em_birth",SqlDbType.DateTime),
  167. new SqlParameter("@em_marriage",SqlDbType.VarChar),
  168. new SqlParameter("@em_n_id",SqlDbType.Int),
  169. new SqlParameter("@em_na_id",SqlDbType.Int),
  170. new SqlParameter("@em_p_id",SqlDbType.Int),
  171. new SqlParameter("@em_stature",SqlDbType.VarChar),
  172. new SqlParameter("@em_avoirdupois",SqlDbType.VarChar),
  173. new SqlParameter("@em_v_id",SqlDbType.Int),
  174. new SqlParameter("@em_statuscard",SqlDbType.VarChar),
  175. new SqlParameter("@em_health",SqlDbType.VarChar),
  176. new SqlParameter("@em_bloodtype",SqlDbType.VarChar),
  177. new SqlParameter("@em_phone",SqlDbType.VarChar),
  178. new SqlParameter("@em_mobile",SqlDbType.VarChar),
  179. new SqlParameter("@em_email",SqlDbType.VarChar),
  180. new SqlParameter("@em_finishschool",SqlDbType.VarChar),
  181. new SqlParameter("@em_speciality",SqlDbType.VarChar),
  182. new SqlParameter("@em_l_id",SqlDbType.Int),
  183. new SqlParameter("@em_graduatetime",SqlDbType.DateTime),
  184. new SqlParameter("@em_degree",SqlDbType.VarChar),
  185. new SqlParameter("@em_language",SqlDbType.VarChar),
  186. new SqlParameter("@em_languagelevel",SqlDbType.VarChar),
  187. new SqlParameter("@em_languageletter",SqlDbType.VarChar),
  188. new SqlParameter("@em_computerlevel",SqlDbType.VarChar),
  189. new SqlParameter("@em_computerletter",SqlDbType.VarChar),
  190. new SqlParameter("@em_computergood",SqlDbType.VarChar),
  191. new SqlParameter("@em_mandarinlevel",SqlDbType.VarChar),
  192. new SqlParameter("@em_familyaddress",SqlDbType.VarChar),
  193. new SqlParameter("@em_postalcode",SqlDbType.VarChar),
  194. new SqlParameter("@em_address",SqlDbType.VarChar),
  195. new SqlParameter("@em_familyphone",SqlDbType.VarChar),
  196. new SqlParameter("@em_addresspostalcode",SqlDbType.VarChar),
  197. new SqlParameter("@em_familycircs",SqlDbType.VarChar),
  198. new SqlParameter("@em_recordlocus",SqlDbType.VarChar),
  199. new SqlParameter("@em_jobname",SqlDbType.VarChar),
  200. new SqlParameter("@em_whenjoinwork",SqlDbType.VarChar),
  201. new SqlParameter("@em_whenthiswork",SqlDbType.VarChar),
  202. new SqlParameter("@em_addlength",SqlDbType.VarChar),
  203. new SqlParameter("@em_thisunitlength",SqlDbType.VarChar),
  204. new SqlParameter("@em_dept_id",SqlDbType.Int),
  205. new SqlParameter("@em_duty",SqlDbType.VarChar),
  206. new SqlParameter("@em_remark",SqlDbType.VarChar),
  207. new SqlParameter("@em_bookerid",SqlDbType.Int),
  208. new SqlParameter("@em_registertime",SqlDbType.DateTime),
  209. new SqlParameter("@em_photo",SqlDbType.VarChar)
  210. };
  211.             param[0].Direction = ParameterDirection.Output;
  212.             param[1].Value = employee.em_number;
  213.             param[2].Value = employee.em_name;
  214.             param[3].Value = employee.em_evername;
  215.             param[4].Value = employee.em_gender;
  216.             param[5].Value = employee.em_birth;
  217.             param[6].Value = employee.em_marriage;
  218.             param[7].Value = employee.em_n_id;
  219.             param[8].Value = employee.em_na_id;
  220.             param[9].Value = employee.em_p_id;
  221.             param[10].Value = employee.em_stature;
  222.             param[11].Value = employee.em_avoirdupois;
  223.             param[12].Value = employee.em_v_id;
  224.             param[13].Value = employee.em_statuscard;
  225.             param[14].Value = employee.em_health;
  226.             param[15].Value = employee.em_bloodtype;
  227.             param[16].Value = employee.em_phone;
  228.             param[17].Value = employee.em_mobile;
  229.             param[18].Value = employee.em_email;
  230.             param[19].Value = employee.em_finishschool;
  231.             param[20].Value = employee.em_speciality;
  232.             param[21].Value = employee.em_l_id;
  233.             param[22].Value = employee.em_graduatetime;
  234.             param[23].Value = employee.em_degree;
  235.             param[24].Value = employee.em_language;
  236.             param[25].Value = employee.em_languagelevel;
  237.             param[26].Value = employee.em_languageletter;
  238.             param[27].Value = employee.em_computerlevel;
  239.             param[28].Value = employee.em_computerletter;
  240.             param[29].Value = employee.em_computergood;
  241.             param[30].Value = employee.em_mandarinlevel;
  242.             param[31].Value = employee.em_familyaddress;
  243.             param[32].Value = employee.em_postalcode;
  244.             param[33].Value = employee.em_address;
  245.             param[34].Value = employee.em_familyphone;
  246.             param[35].Value = employee.em_addresspostalcode;
  247.             param[36].Value = employee.em_familycircs;
  248.             param[37].Value = employee.em_recordlocus;
  249.             param[38].Value = employee.em_jobname;
  250.             param[39].Value = employee.em_whenjoinwork;
  251.             param[40].Value = employee.em_whenthiswork;
  252.             param[41].Value = employee.em_addlength;
  253.             param[42].Value = employee.em_thisunitlength;
  254.             param[43].Value = employee.em_dept_id;
  255.             param[44].Value = employee.em_duty;
  256.             param[45].Value = employee.em_remark;
  257.             param[46].Value = employee.em_bookerid;
  258.             param[47].Value = employee.em_registertime;
  259.             param[48].Value = employee.em_photo;
  260.             res = SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
  261.             employee.em_id = ((param[0].Value) == DBNull.Value) ? 0 : Convert.ToInt32(param[0].Value);
  262.             return res;
  263.         }
  264.         #endregion
  265.         #region 更新
  266.         /// <summary>
  267.         /// 向数据表employee更新一条记录
  268.         /// </summary>
  269.         /// <param name="employee">employee实体对象</param>
  270.         /// <returns></returns>
  271.         public int Update(employee employee)
  272.         {
  273.             string sqlCommand = "employeeUpdate";
  274.             SqlParameter[] param ={
  275. new SqlParameter("@em_id",SqlDbType.Int),
  276. new SqlParameter("@em_number",SqlDbType.VarChar),
  277. new SqlParameter("@em_name",SqlDbType.VarChar),
  278. new SqlParameter("@em_evername",SqlDbType.VarChar),
  279. new SqlParameter("@em_gender",SqlDbType.Int),
  280. new SqlParameter("@em_birth",SqlDbType.DateTime),
  281. new SqlParameter("@em_marriage",SqlDbType.VarChar),
  282. new SqlParameter("@em_n_id",SqlDbType.Int),
  283. new SqlParameter("@em_na_id",SqlDbType.Int),
  284. new SqlParameter("@em_p_id",SqlDbType.Int),
  285. new SqlParameter("@em_stature",SqlDbType.VarChar),
  286. new SqlParameter("@em_avoirdupois",SqlDbType.VarChar),
  287. new SqlParameter("@em_v_id",SqlDbType.Int),
  288. new SqlParameter("@em_statuscard",SqlDbType.VarChar),
  289. new SqlParameter("@em_health",SqlDbType.VarChar),
  290. new SqlParameter("@em_bloodtype",SqlDbType.VarChar),
  291. new SqlParameter("@em_phone",SqlDbType.VarChar),
  292. new SqlParameter("@em_mobile",SqlDbType.VarChar),
  293. new SqlParameter("@em_email",SqlDbType.VarChar),
  294. new SqlParameter("@em_finishschool",SqlDbType.VarChar),
  295. new SqlParameter("@em_speciality",SqlDbType.VarChar),
  296. new SqlParameter("@em_l_id",SqlDbType.Int),
  297. new SqlParameter("@em_graduatetime",SqlDbType.DateTime),
  298. new SqlParameter("@em_degree",SqlDbType.VarChar),
  299. new SqlParameter("@em_language",SqlDbType.VarChar),
  300. new SqlParameter("@em_languagelevel",SqlDbType.VarChar),
  301. new SqlParameter("@em_languageletter",SqlDbType.VarChar),
  302. new SqlParameter("@em_computerlevel",SqlDbType.VarChar),
  303. new SqlParameter("@em_computerletter",SqlDbType.VarChar),
  304. new SqlParameter("@em_computergood",SqlDbType.VarChar),
  305. new SqlParameter("@em_mandarinlevel",SqlDbType.VarChar),
  306. new SqlParameter("@em_familyaddress",SqlDbType.VarChar),
  307. new SqlParameter("@em_postalcode",SqlDbType.VarChar),
  308. new SqlParameter("@em_address",SqlDbType.VarChar),
  309. new SqlParameter("@em_familyphone",SqlDbType.VarChar),
  310. new SqlParameter("@em_addresspostalcode",SqlDbType.VarChar),
  311. new SqlParameter("@em_familycircs",SqlDbType.VarChar),
  312. new SqlParameter("@em_recordlocus",SqlDbType.VarChar),
  313. new SqlParameter("@em_jobname",SqlDbType.VarChar),
  314. new SqlParameter("@em_whenjoinwork",SqlDbType.VarChar),
  315. new SqlParameter("@em_whenthiswork",SqlDbType.VarChar),
  316. new SqlParameter("@em_addlength",SqlDbType.VarChar),
  317. new SqlParameter("@em_thisunitlength",SqlDbType.VarChar),
  318. new SqlParameter("@em_dept_id",SqlDbType.Int),
  319. new SqlParameter("@em_duty",SqlDbType.VarChar),
  320. new SqlParameter("@em_remark",SqlDbType.VarChar),
  321. new SqlParameter("@em_bookerid",SqlDbType.Int),
  322. new SqlParameter("@em_registertime",SqlDbType.DateTime),
  323. new SqlParameter("@em_photo",SqlDbType.VarChar)
  324. };
  325.             param[0].Value = employee.em_id;
  326.             param[1].Value = employee.em_number;
  327.             param[2].Value = employee.em_name;
  328.             param[3].Value = employee.em_evername;
  329.             param[4].Value = employee.em_gender;
  330.             param[5].Value = employee.em_birth;
  331.             param[6].Value = employee.em_marriage;
  332.             param[7].Value = employee.em_n_id;
  333.             param[8].Value = employee.em_na_id;
  334.             param[9].Value = employee.em_p_id;
  335.             param[10].Value = employee.em_stature;
  336.             param[11].Value = employee.em_avoirdupois;
  337.             param[12].Value = employee.em_v_id;
  338.             param[13].Value = employee.em_statuscard;
  339.             param[14].Value = employee.em_health;
  340.             param[15].Value = employee.em_bloodtype;
  341.             param[16].Value = employee.em_phone;
  342.             param[17].Value = employee.em_mobile;
  343.             param[18].Value = employee.em_email;
  344.             param[19].Value = employee.em_finishschool;
  345.             param[20].Value = employee.em_speciality;
  346.             param[21].Value = employee.em_l_id;
  347.             param[22].Value = employee.em_graduatetime;
  348.             param[23].Value = employee.em_degree;
  349.             param[24].Value = employee.em_language;
  350.             param[25].Value = employee.em_languagelevel;
  351.             param[26].Value = employee.em_languageletter;
  352.             param[27].Value = employee.em_computerlevel;
  353.             param[28].Value = employee.em_computerletter;
  354.             param[29].Value = employee.em_computergood;
  355.             param[30].Value = employee.em_mandarinlevel;
  356.             param[31].Value = employee.em_familyaddress;
  357.             param[32].Value = employee.em_postalcode;
  358.             param[33].Value = employee.em_address;
  359.             param[34].Value = employee.em_familyphone;
  360.             param[35].Value = employee.em_addresspostalcode;
  361.             param[36].Value = employee.em_familycircs;
  362.             param[37].Value = employee.em_recordlocus;
  363.             param[38].Value = employee.em_jobname;
  364.             param[39].Value = employee.em_whenjoinwork;
  365.             param[40].Value = employee.em_whenthiswork;
  366.             param[41].Value = employee.em_addlength;
  367.             param[42].Value = employee.em_thisunitlength;
  368.             param[43].Value = employee.em_dept_id;
  369.             param[44].Value = employee.em_duty;
  370.             param[45].Value = employee.em_remark;
  371.             param[46].Value = employee.em_bookerid;
  372.             param[47].Value = employee.em_registertime;
  373.             param[48].Value = employee.em_photo;
  374.             return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  375.         }
  376.         /// <summary>
  377.         /// 向数据表employee更新一条记录。带事务
  378.         /// </summary>
  379.         /// <param name="sp">事务对象</param>
  380.         /// <param name="employee">employee实体对象</param>
  381.         /// <returns></returns>
  382.         public int Update(SqlTransaction sp, employee employee)
  383.         {
  384.             string sqlCommand = "employeeUpdate";
  385.             SqlParameter[] param ={
  386. new SqlParameter("@em_id",SqlDbType.Int),
  387. new SqlParameter("@em_number",SqlDbType.VarChar),
  388. new SqlParameter("@em_name",SqlDbType.VarChar),
  389. new SqlParameter("@em_evername",SqlDbType.VarChar),
  390. new SqlParameter("@em_gender",SqlDbType.Int),
  391. new SqlParameter("@em_birth",SqlDbType.DateTime),
  392. new SqlParameter("@em_marriage",SqlDbType.VarChar),
  393. new SqlParameter("@em_n_id",SqlDbType.Int),
  394. new SqlParameter("@em_na_id",SqlDbType.Int),
  395. new SqlParameter("@em_p_id",SqlDbType.Int),
  396. new SqlParameter("@em_stature",SqlDbType.VarChar),
  397. new SqlParameter("@em_avoirdupois",SqlDbType.VarChar),
  398. new SqlParameter("@em_v_id",SqlDbType.Int),
  399. new SqlParameter("@em_statuscard",SqlDbType.VarChar),
  400. new SqlParameter("@em_health",SqlDbType.VarChar),
  401. new SqlParameter("@em_bloodtype",SqlDbType.VarChar),
  402. new SqlParameter("@em_phone",SqlDbType.VarChar),
  403. new SqlParameter("@em_mobile",SqlDbType.VarChar),
  404. new SqlParameter("@em_email",SqlDbType.VarChar),
  405. new SqlParameter("@em_finishschool",SqlDbType.VarChar),
  406. new SqlParameter("@em_speciality",SqlDbType.VarChar),
  407. new SqlParameter("@em_l_id",SqlDbType.Int),
  408. new SqlParameter("@em_graduatetime",SqlDbType.DateTime),
  409. new SqlParameter("@em_degree",SqlDbType.VarChar),
  410. new SqlParameter("@em_language",SqlDbType.VarChar),
  411. new SqlParameter("@em_languagelevel",SqlDbType.VarChar),
  412. new SqlParameter("@em_languageletter",SqlDbType.VarChar),
  413. new SqlParameter("@em_computerlevel",SqlDbType.VarChar),
  414. new SqlParameter("@em_computerletter",SqlDbType.VarChar),
  415. new SqlParameter("@em_computergood",SqlDbType.VarChar),
  416. new SqlParameter("@em_mandarinlevel",SqlDbType.VarChar),
  417. new SqlParameter("@em_familyaddress",SqlDbType.VarChar),
  418. new SqlParameter("@em_postalcode",SqlDbType.VarChar),
  419. new SqlParameter("@em_address",SqlDbType.VarChar),
  420. new SqlParameter("@em_familyphone",SqlDbType.VarChar),
  421. new SqlParameter("@em_addresspostalcode",SqlDbType.VarChar),
  422. new SqlParameter("@em_familycircs",SqlDbType.VarChar),
  423. new SqlParameter("@em_recordlocus",SqlDbType.VarChar),
  424. new SqlParameter("@em_jobname",SqlDbType.VarChar),
  425. new SqlParameter("@em_whenjoinwork",SqlDbType.VarChar),
  426. new SqlParameter("@em_whenthiswork",SqlDbType.VarChar),
  427. new SqlParameter("@em_addlength",SqlDbType.VarChar),
  428. new SqlParameter("@em_thisunitlength",SqlDbType.VarChar),
  429. new SqlParameter("@em_dept_id",SqlDbType.Int),
  430. new SqlParameter("@em_duty",SqlDbType.VarChar),
  431. new SqlParameter("@em_remark",SqlDbType.VarChar),
  432. new SqlParameter("@em_bookerid",SqlDbType.Int),
  433. new SqlParameter("@em_registertime",SqlDbType.DateTime),
  434. new SqlParameter("@em_photo",SqlDbType.VarChar)
  435. };
  436.             param[0].Value = employee.em_id;
  437.             param[1].Value = employee.em_number;
  438.             param[2].Value = employee.em_name;
  439.             param[3].Value = employee.em_evername;
  440.             param[4].Value = employee.em_gender;
  441.             param[5].Value = employee.em_birth;
  442.             param[6].Value = employee.em_marriage;
  443.             param[7].Value = employee.em_n_id;
  444.             param[8].Value = employee.em_na_id;
  445.             param[9].Value = employee.em_p_id;
  446.             param[10].Value = employee.em_stature;
  447.             param[11].Value = employee.em_avoirdupois;
  448.             param[12].Value = employee.em_v_id;
  449.             param[13].Value = employee.em_statuscard;
  450.             param[14].Value = employee.em_health;
  451.             param[15].Value = employee.em_bloodtype;
  452.             param[16].Value = employee.em_phone;
  453.             param[17].Value = employee.em_mobile;
  454.             param[18].Value = employee.em_email;
  455.             param[19].Value = employee.em_finishschool;
  456.             param[20].Value = employee.em_speciality;
  457.             param[21].Value = employee.em_l_id;
  458.             param[22].Value = employee.em_graduatetime;
  459.             param[23].Value = employee.em_degree;
  460.             param[24].Value = employee.em_language;
  461.             param[25].Value = employee.em_languagelevel;
  462.             param[26].Value = employee.em_languageletter;
  463.             param[27].Value = employee.em_computerlevel;
  464.             param[28].Value = employee.em_computerletter;
  465.             param[29].Value = employee.em_computergood;
  466.             param[30].Value = employee.em_mandarinlevel;
  467.             param[31].Value = employee.em_familyaddress;
  468.             param[32].Value = employee.em_postalcode;
  469.             param[33].Value = employee.em_address;
  470.             param[34].Value = employee.em_familyphone;
  471.             param[35].Value = employee.em_addresspostalcode;
  472.             param[36].Value = employee.em_familycircs;
  473.             param[37].Value = employee.em_recordlocus;
  474.             param[38].Value = employee.em_jobname;
  475.             param[39].Value = employee.em_whenjoinwork;
  476.             param[40].Value = employee.em_whenthiswork;
  477.             param[41].Value = employee.em_addlength;
  478.             param[42].Value = employee.em_thisunitlength;
  479.             param[43].Value = employee.em_dept_id;
  480.             param[44].Value = employee.em_duty;
  481.             param[45].Value = employee.em_remark;
  482.             param[46].Value = employee.em_bookerid;
  483.             param[47].Value = employee.em_registertime;
  484.             param[48].Value = employee.em_photo;
  485.             return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
  486.         }
  487.         #endregion
  488.         #region 删除
  489.         /// <summary>
  490.         /// 删除数据表employee中的一条记录
  491.         /// </summary>
  492.         /// <param name="em_id">em_id</param>
  493.         /// <returns></returns>
  494.         public int Delete(int em_id)
  495.         {
  496.             string sqlCommand = "employeeDelete";
  497.             SqlParameter[] param ={
  498. new SqlParameter("@em_id",SqlDbType.Int)
  499. };
  500.             param[0].Value = em_id;
  501.             return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  502.         }
  503.         /// <summary>
  504.         /// 删除数据表employee中的一条记录
  505.         /// </summary>
  506.         /// <param name="employee">employee实体对象</param>
  507.         /// <returns></returns>
  508.         public int Delete(employee employee)
  509.         {
  510.             string sqlCommand = "employeeDelete";
  511.             SqlParameter[] param ={
  512. new SqlParameter("@em_id",SqlDbType.Int)
  513. };
  514.             param[0].Value = employee.em_id;
  515.             return SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  516.         }
  517.         /// <summary>
  518.         /// 删除数据表employee中的一条记录,带事务
  519.         /// </summary>
  520.         /// <param name="sp">事务对象</param>
  521.         /// <param name="em_id">em_id</param>
  522.         /// <returns></returns>
  523.         public int Delete(SqlTransaction sp, int em_id)
  524.         {
  525.             string sqlCommand = "employeeDelete";
  526.             SqlParameter[] param ={
  527. new SqlParameter("@em_id",SqlDbType.Int)
  528. };
  529.             param[0].Value = em_id;
  530.             return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
  531.         }
  532.         /// <summary>
  533.         /// 删除数据表employee中的一条记录,带事务
  534.         /// </summary>
  535.         /// <param name="sp">事务对象</param>
  536.         /// <param name="employee">employee实体对象</param>
  537.         /// <returns></returns>
  538.         public int Delete(SqlTransaction sp, employee employee)
  539.         {
  540.             string sqlCommand = "employeeDelete";
  541.             SqlParameter[] param ={
  542. new SqlParameter("@em_id",SqlDbType.Int)
  543. };
  544.             param[0].Value = employee.em_id;
  545.             return SqlHelper.ExecuteNonQuery(sp, CommandType.StoredProcedure, sqlCommand, param);
  546.         }
  547.         #endregion
  548.         #region 实体对象
  549.         /// <summary>
  550.         /// 得到employee实体对象
  551.         /// </summary>
  552.         /// <param name="row">row</param>
  553.         /// <returns>employee实体对象</returns>
  554.         public employee Select(DataRow row)
  555.         {
  556.             employee obj = new employee();
  557.             if (row != null)
  558.             {
  559.                 obj.em_id = ((row["em_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_id"]);
  560.                 obj.em_number = row["em_number"].ToString();
  561.                 obj.em_name = row["em_name"].ToString();
  562.                 obj.em_evername = row["em_evername"].ToString();
  563.                 obj.em_gender = ((row["em_gender"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_gender"]);
  564.                 obj.em_birth = ((row["em_birth"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(row["em_birth"]);
  565.                 obj.em_marriage = row["em_marriage"].ToString();
  566.                 obj.em_n_id = ((row["em_n_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_n_id"]);
  567.                 obj.em_na_id = ((row["em_na_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_na_id"]);
  568.                 obj.em_p_id = ((row["em_p_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_p_id"]);
  569.                 obj.em_stature = row["em_stature"].ToString();
  570.                 obj.em_avoirdupois = row["em_avoirdupois"].ToString();
  571.                 obj.em_v_id = ((row["em_v_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_v_id"]);
  572.                 obj.em_statuscard = row["em_statuscard"].ToString();
  573.                 obj.em_health = row["em_health"].ToString();
  574.                 obj.em_bloodtype = row["em_bloodtype"].ToString();
  575.                 obj.em_phone = row["em_phone"].ToString();
  576.                 obj.em_mobile = row["em_mobile"].ToString();
  577.                 obj.em_email = row["em_email"].ToString();
  578.                 obj.em_finishschool = row["em_finishschool"].ToString();
  579.                 obj.em_speciality = row["em_speciality"].ToString();
  580.                 obj.em_l_id = ((row["em_l_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_l_id"]);
  581.                 obj.em_graduatetime = ((row["em_graduatetime"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(row["em_graduatetime"]);
  582.                 obj.em_degree = row["em_degree"].ToString();
  583.                 obj.em_language = row["em_language"].ToString();
  584.                 obj.em_languagelevel = row["em_languagelevel"].ToString();
  585.                 obj.em_languageletter = row["em_languageletter"].ToString();
  586.                 obj.em_computerlevel = row["em_computerlevel"].ToString();
  587.                 obj.em_computerletter = row["em_computerletter"].ToString();
  588.                 obj.em_computergood = row["em_computergood"].ToString();
  589.                 obj.em_mandarinlevel = row["em_mandarinlevel"].ToString();
  590.                 obj.em_familyaddress = row["em_familyaddress"].ToString();
  591.                 obj.em_postalcode = row["em_postalcode"].ToString();
  592.                 obj.em_address = row["em_address"].ToString();
  593.                 obj.em_familyphone = row["em_familyphone"].ToString();
  594.                 obj.em_addresspostalcode = row["em_addresspostalcode"].ToString();
  595.                 obj.em_familycircs = row["em_familycircs"].ToString();
  596.                 obj.em_recordlocus = row["em_recordlocus"].ToString();
  597.                 obj.em_jobname = row["em_jobname"].ToString();
  598.                 obj.em_whenjoinwork = row["em_whenjoinwork"].ToString();
  599.                 obj.em_whenthiswork = row["em_whenthiswork"].ToString();
  600.                 obj.em_addlength = row["em_addlength"].ToString();
  601.                 obj.em_thisunitlength = row["em_thisunitlength"].ToString();
  602.                 obj.em_dept_id = ((row["em_dept_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_dept_id"]);
  603.                 obj.em_duty = row["em_duty"].ToString();
  604.                 obj.em_remark = row["em_remark"].ToString();
  605.                 obj.em_bookerid = ((row["em_bookerid"]) == DBNull.Value) ? 0 : Convert.ToInt32(row["em_bookerid"]);
  606.                 obj.em_registertime = ((row["em_registertime"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(row["em_registertime"]);
  607.                 obj.em_photo = row["em_photo"].ToString();
  608.             }
  609.             else
  610.             {
  611.                 return null;
  612.             }
  613.             return obj;
  614.         }
  615.         /// <summary>
  616.         /// 得到employee实体对象
  617.         /// </summary>
  618.         /// <param name="dr">dr</param>
  619.         /// <returns>employee实体对象</returns>
  620.         public employee Select(IDataReader dr)
  621.         {
  622.             employee obj = new employee();
  623.             obj.em_id = ((dr["em_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_id"]);
  624.             obj.em_number = dr["em_number"].ToString();
  625.             obj.em_name = dr["em_name"].ToString();
  626.             obj.em_evername = dr["em_evername"].ToString();
  627.             obj.em_gender = ((dr["em_gender"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_gender"]);
  628.             obj.em_birth = ((dr["em_birth"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(dr["em_birth"]);
  629.             obj.em_marriage = dr["em_marriage"].ToString();
  630.             obj.em_n_id = ((dr["em_n_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_n_id"]);
  631.             obj.em_na_id = ((dr["em_na_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_na_id"]);
  632.             obj.em_p_id = ((dr["em_p_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_p_id"]);
  633.             obj.em_stature = dr["em_stature"].ToString();
  634.             obj.em_avoirdupois = dr["em_avoirdupois"].ToString();
  635.             obj.em_v_id = ((dr["em_v_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_v_id"]);
  636.             obj.em_statuscard = dr["em_statuscard"].ToString();
  637.             obj.em_health = dr["em_health"].ToString();
  638.             obj.em_bloodtype = dr["em_bloodtype"].ToString();
  639.             obj.em_phone = dr["em_phone"].ToString();
  640.             obj.em_mobile = dr["em_mobile"].ToString();
  641.             obj.em_email = dr["em_email"].ToString();
  642.             obj.em_finishschool = dr["em_finishschool"].ToString();
  643.             obj.em_speciality = dr["em_speciality"].ToString();
  644.             obj.em_l_id = ((dr["em_l_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_l_id"]);
  645.             obj.em_graduatetime = ((dr["em_graduatetime"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(dr["em_graduatetime"]);
  646.             obj.em_degree = dr["em_degree"].ToString();
  647.             obj.em_language = dr["em_language"].ToString();
  648.             obj.em_languagelevel = dr["em_languagelevel"].ToString();
  649.             obj.em_languageletter = dr["em_languageletter"].ToString();
  650.             obj.em_computerlevel = dr["em_computerlevel"].ToString();
  651.             obj.em_computerletter = dr["em_computerletter"].ToString();
  652.             obj.em_computergood = dr["em_computergood"].ToString();
  653.             obj.em_mandarinlevel = dr["em_mandarinlevel"].ToString();
  654.             obj.em_familyaddress = dr["em_familyaddress"].ToString();
  655.             obj.em_postalcode = dr["em_postalcode"].ToString();
  656.             obj.em_address = dr["em_address"].ToString();
  657.             obj.em_familyphone = dr["em_familyphone"].ToString();
  658.             obj.em_addresspostalcode = dr["em_addresspostalcode"].ToString();
  659.             obj.em_familycircs = dr["em_familycircs"].ToString();
  660.             obj.em_recordlocus = dr["em_recordlocus"].ToString();
  661.             obj.em_jobname = dr["em_jobname"].ToString();
  662.             obj.em_whenjoinwork = dr["em_whenjoinwork"].ToString();
  663.             obj.em_whenthiswork = dr["em_whenthiswork"].ToString();
  664.             obj.em_addlength = dr["em_addlength"].ToString();
  665.             obj.em_thisunitlength = dr["em_thisunitlength"].ToString();
  666.             obj.em_dept_id = ((dr["em_dept_id"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_dept_id"]);
  667.             obj.em_duty = dr["em_duty"].ToString();
  668.             obj.em_remark = dr["em_remark"].ToString();
  669.             obj.em_bookerid = ((dr["em_bookerid"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["em_bookerid"]);
  670.             obj.em_registertime = ((dr["em_registertime"]) == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(dr["em_registertime"]);
  671.             obj.em_photo = dr["em_photo"].ToString();
  672.             return obj;
  673.         }
  674.         /// <summary>
  675.         /// 根据ID,返回一个employee实体对象
  676.         /// </summary>
  677.         /// <param name="em_id">em_id</param>
  678.         /// <returns>employee实体对象</returns>
  679.         public employee Select(int em_id)
  680.         {
  681.             return this.Select(em_id, false, false);
  682.         }
  683.         /// <summary>
  684.         /// 根据ID,返回一个employee实体对象
  685.         /// </summary>
  686.         /// <param name="em_id">em_id</param>
  687.         /// <param name="bParentTable">将employee对象设置与父表关联</param>
  688.         /// <param name="bChildrenTable">将employee对象设置与子表关联</param>
  689.         /// <returns>employee实体对象</returns>
  690.         public employee Select(int em_id, bool bParentTable, bool bChildrenTable)
  691.         {
  692.             employee obj = null;
  693.             SqlParameter[] param ={
  694. new SqlParameter("@em_id",SqlDbType.Int)
  695. };
  696.             param[0].Value = em_id;
  697.             string sqlCommand = "employeeSelect";
  698.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
  699.             {
  700.                 while (dr.Read())
  701.                 {
  702.                     obj = this.Select(dr);
  703.                 }
  704.             }
  705.             this.Select(obj, bParentTable, bChildrenTable);
  706.             return obj;
  707.         }
  708.         /// <summary>
  709.         /// 将employee实体对象设置与父表和子表关联
  710.         /// </summary>
  711.         /// <param name="obj">employee实体对象</param>
  712.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  713.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  714.         public void Select(employee obj, bool bParentTable, bool bChildrenTable)
  715.         {
  716.             //关联的主表
  717.             if (bParentTable)
  718.             {
  719.                 obj.nation = nationBLL.Select(obj.em_na_id);
  720.                 obj.visage = visageBLL.Select(obj.em_v_id);
  721.                 obj.province = provinceBLL.Select(obj.em_p_id);
  722.                 obj.native = nativeBLL.Select(obj.em_n_id);
  723.                 obj.learn = learnBLL.Select(obj.em_l_id);
  724.                 obj.department = departmentBLL.Select(obj.em_dept_id);
  725.             }
  726.             //关联的子表集合
  727.             if (bChildrenTable)
  728.             {
  729.                 obj.users = usersBLL.Select("u_em_id=" + obj.em_id.ToString());
  730.                 foreach (users item in obj.users)
  731.                 {
  732.                     item.employee = obj;
  733.                 }
  734.             }
  735.         }
  736.         #endregion
  737.         #region 父表
  738.         /// <summary>
  739.         /// 设置实体对象(employee)的父表对象
  740.         /// </summary>
  741.         /// <param name="employee">实体对象</param>
  742.         public void nation(employee employee)
  743.         {
  744.             employee.nation = nationBLL.Select(employee.em_na_id);
  745.         }
  746.         /// <summary>
  747.         /// 设置实体对象(employee)的父表对象
  748.         /// </summary>
  749.         /// <param name="employee">实体对象</param>
  750.         public void visage(employee employee)
  751.         {
  752.             employee.visage = visageBLL.Select(employee.em_v_id);
  753.         }
  754.         /// <summary>
  755.         /// 设置实体对象(employee)的父表对象
  756.         /// </summary>
  757.         /// <param name="employee">实体对象</param>
  758.         public void province(employee employee)
  759.         {
  760.             employee.province = provinceBLL.Select(employee.em_p_id);
  761.         }
  762.         /// <summary>
  763.         /// 设置实体对象(employee)的父表对象
  764.         /// </summary>
  765.         /// <param name="employee">实体对象</param>
  766.         public void native(employee employee)
  767.         {
  768.             employee.native = nativeBLL.Select(employee.em_n_id);
  769.         }
  770.         /// <summary>
  771.         /// 设置实体对象(employee)的父表对象
  772.         /// </summary>
  773.         /// <param name="employee">实体对象</param>
  774.         public void learn(employee employee)
  775.         {
  776.             employee.learn = learnBLL.Select(employee.em_l_id);
  777.         }
  778.         /// <summary>
  779.         /// 设置实体对象(employee)的父表对象
  780.         /// </summary>
  781.         /// <param name="employee">实体对象</param>
  782.         public void department(employee employee)
  783.         {
  784.             employee.department = departmentBLL.Select(employee.em_dept_id);
  785.         }
  786.         #endregion
  787.         #region 子表
  788.         /// <summary>
  789.         /// 设置实体对象(employee)的子表对象
  790.         /// </summary>
  791.         /// <param name="employee">实体对象</param>
  792.         public void users(employee employee)
  793.         {
  794.             employee.users = usersBLL.Select("u_em_id=" + employee.em_id.ToString());
  795.         }
  796.         #endregion
  797.         #region 查询
  798.         /// <summary>
  799.         /// 得到数据表employee所有记录
  800.         /// </summary>
  801.         /// <returns>结果集</returns>
  802.         public IList<employee> Select()
  803.         {
  804.             return this.Select(false, false);
  805.         }
  806.         /// <summary>
  807.         /// 得到数据表employee所有记录
  808.         /// </summary>
  809.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  810.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  811.         /// <returns>结果集</returns>
  812.         public IList<employee> Select(bool bParentTable, bool bChildrenTable)
  813.         {
  814.             IList<employee> list = new List<employee>();
  815.             string sqlCommand = "employeeSelectAll";
  816.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand))
  817.             {
  818.                 while (dr.Read())
  819.                 {
  820.                     list.Add(this.Select(dr));
  821.                 }
  822.             }
  823.             foreach (employee obj in list)
  824.             {
  825.                 this.Select(obj, bParentTable, bChildrenTable);
  826.             }
  827.             return list;
  828.         }
  829.         /// <summary>
  830.         /// 得到数据表employee满足查询条件的记录
  831.         /// </summary>
  832.         /// <param name="where">查询条件</param>
  833.         /// <returns>结果集</returns>
  834.         public IList<employee> Select(string where)
  835.         {
  836.             return this.Select(where, false, false);
  837.         }
  838.         /// <summary>
  839.         /// 得到数据表employee满足查询条件的记录
  840.         /// </summary>
  841.         /// <param name="where">查询条件</param>
  842.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  843.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  844.         /// <returns>结果集</returns>
  845.         public IList<employee> Select(string where, bool bParentTable, bool bChildrenTable)
  846.         {
  847.             IList<employee> list = new List<employee>();
  848.             SqlParameter[] param ={
  849. new SqlParameter("@where",SqlDbType.VarChar,8000)
  850. };
  851.             param[0].Value = where;
  852.             string sqlCommand = "employeeSelectByParams";
  853.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
  854.             {
  855.                 while (dr.Read())
  856.                 {
  857.                     list.Add(this.Select(dr));
  858.                 }
  859.             }
  860.             foreach (employee obj in list)
  861.             {
  862.                 this.Select(obj, bParentTable, bChildrenTable);
  863.             }
  864.             return list;
  865.         }
  866.         /// <summary>
  867.         /// 得到数据表ArticalInfo满足外键字段查询条件的记录
  868.         /// </summary>
  869.         /// <param name="foreignFieldName">外键字段名称</param>
  870.         /// <param name="foreignFieldValue">外键字段值</param>
  871.         /// <returns>结果集</returns>
  872.         public IList<employee> Select(string foreignFieldName, int foreignFieldValue)
  873.         {
  874.             return this.Select(foreignFieldName, foreignFieldValue, false, false);
  875.         }
  876.         /// <summary>
  877.         /// 得到数据表ArticalInfo满足外键字段查询条件的记录
  878.         /// </summary>
  879.         /// <param name="foreignFieldName">外键字段名称</param>
  880.         /// <param name="foreignFieldValue">外键字段值</param>
  881.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  882.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  883.         /// <returns>结果集</returns>
  884.         public IList<employee> Select(string foreignFieldName, int foreignFieldValue, bool bParentTable, bool bChildrenTable)
  885.         {
  886.             return this.Select(string.Format("{0}='{1}'", foreignFieldName, foreignFieldValue), bParentTable, bChildrenTable);
  887.         }
  888.         /// <summary>
  889.         /// 得到数据表employee满足查询条件的记录数
  890.         /// </summary>
  891.         /// <param name="where">查询条件</param>
  892.         /// <param name="recordCount">记录数</param>
  893.         public void Select(string where, out int recordCount)
  894.         {
  895.             string sqlCommand = "employeeCountByWhere";
  896.             SqlParameter[] param ={
  897. new SqlParameter("@where",SqlDbType.VarChar,8000),
  898. new SqlParameter("@recordCount",SqlDbType.Int)
  899. };
  900.             param[0].Value = where;
  901.             param[1].Direction = ParameterDirection.Output;
  902.             SqlHelper.ExecuteNonQuery(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param);
  903.             recordCount = Convert.ToInt32(param[1].Value);
  904.         }
  905.         /// <summary>
  906.         /// 得到数据表employee满足查询条件的分页记录
  907.         /// </summary>
  908.         /// <param name="pageSize">每页显示记录数</param>
  909.         /// <param name="pageIndex">当前显示第几页</param>
  910.         /// <param name="where">查询条件</param>
  911.         /// <returns>结果集</returns>
  912.         public IList<employee> Select(int pageSize, int pageIndex, string where)
  913.         {
  914.             return this.Select(pageSize, pageIndex, where, false, false);
  915.         }
  916.         /// <summary>
  917.         /// 得到数据表employee满足查询条件的分页记录
  918.         /// </summary>
  919.         /// <param name="pageSize">每页显示记录数</param>
  920.         /// <param name="pageIndex">当前显示第几页</param>
  921.         /// <param name="where">查询条件</param>
  922.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  923.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  924.         /// <returns>结果集</returns>
  925.         public IList<employee> Select(int pageSize, int pageIndex, string where, bool bParentTable, bool bChildrenTable)
  926.         {
  927.             IList<employee> list = new List<employee>();
  928.             string sqlCommand = "employeeSelectByPagerParams";
  929.             SqlParameter[] param ={
  930. new SqlParameter("@pageSize",SqlDbType.Int),
  931. new SqlParameter("@pageIndex",SqlDbType.Int),
  932. new SqlParameter("@where",SqlDbType.VarChar,8000)
  933. };
  934.             param[0].Value = pageSize;
  935.             param[1].Value = pageIndex;
  936.             param[2].Value = where;
  937.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param))
  938.             {
  939.                 while (dr.Read())
  940.                 {
  941.                     list.Add(this.Select(dr));
  942.                 }
  943.             }
  944.             foreach (employee obj in list)
  945.             {
  946.                 this.Select(obj, bParentTable, bChildrenTable);
  947.             }
  948.             return list;
  949.         }
  950.         /// <summary>
  951.         /// 得到数据表employee满足查询条件记录
  952.         /// </summary>
  953.         /// <param name="commandType">命令类型</param>
  954.         /// <param name="sqlCommand">SQL命令</param>
  955.         /// <param name="SqlParameter[]">命令参数数组</param>
  956.         /// <returns>结果集</returns>
  957.         public IList<employee> Select(CommandType commandType, string sqlCommand, params SqlParameter[] param)
  958.         {
  959.             return this.Select(false, false, commandType, sqlCommand, param);
  960.         }
  961.         /// <summary>
  962.         /// 得到数据表employee满足查询条件记录
  963.         /// </summary>
  964.         /// <param name="bParentTable">是/否设置与父表对象关联</param>
  965.         /// <param name="bChildrenTable">是/否设置与子表对象关联</param>
  966.         /// <param name="commandType">命令类型</param>
  967.         /// <param name="sqlCommand">SQL命令</param>
  968.         /// <param name="SqlParameter[]">命令参数数组</param>
  969.         /// <returns>结果集</returns>
  970.         public IList<employee> Select(bool bParentTable, bool bChildrenTable, CommandType commandType, string sqlCommand, params SqlParameter[] param)
  971.         {
  972.             IList<employee> list = new List<employee>();
  973.             using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, commandType, sqlCommand, param))
  974.             {
  975.                 while (dr.Read())
  976.                 {
  977.                     list.Add(this.Select(dr));
  978.                 }
  979.             }
  980.             foreach (employee obj in list)
  981.             {
  982.                 this.Select(obj, bParentTable, bChildrenTable);
  983.             }
  984.             return list;
  985.         }
  986.         /// <summary>
  987.         /// 根据主键检测是否存在该条记录
  988.         /// </summary>
  989.         /// <param name="em_id">em_id</param>
  990.         /// <returns>存在/不存在</returns>
  991.         public bool Exists(int em_id)
  992.         {
  993.             SqlParameter[] param ={
  994.                                  new SqlParameter("@em_id",SqlDbType.Int)
  995.                                  };
  996.             param[0].Value = em_id;
  997.             string sqlCommand = "employeeIsExist";
  998.             int a = Convert.ToInt32(SqlHelper.ExecuteScalar(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param));
  999.             if (a > 0)
  1000.             {
  1001.                 return true;
  1002.             }
  1003.             else
  1004.             {
  1005.                 return false;
  1006.             }
  1007.         }
  1008.         #endregion
  1009.         #endregion
  1010.     }
  1011. }