MrBaseInf.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:42k
源码类别:

.net编程

开发平台:

Others

  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using qminoa.Common.Data;
  5. namespace qminoa.DA
  6. {
  7. public class MrBaseInf :IDisposable
  8. {
  9. private string conStr ;
  10. private SqlConnection con ;
  11. private SqlDataAdapter commandAdp ;
  12. private string paramChg(string str)
  13. {
  14. str = "@"+str;
  15. return str;
  16. }
  17. public DataSet GetEmpConData_By_ConID(int conID)
  18. {
  19. SqlCommand command = new SqlCommand();
  20. command.CommandText = "GetEmpConInfByConID";
  21. command.CommandType = CommandType.StoredProcedure;
  22. command.Connection = con;
  23. SqlParameter param = new SqlParameter(paramChg(EmpConData.CONID_FIELD),SqlDbType.Int);
  24. param.Value = conID;
  25. command.Parameters.Add(param);
  26. commandAdp.SelectCommand = command;
  27. DataSet data = new DataSet();
  28. try
  29. {
  30. commandAdp.Fill(data);
  31. }
  32. catch(Exception ex)
  33. {
  34. throw new ApplicationException(ex.ToString());
  35. }
  36. return data;
  37. }
  38. public bool UpdateMrContact(EmpConData empData)
  39. {
  40. SqlCommand command = new SqlCommand();
  41. command.CommandText = "UpdateMrContact";
  42. command.CommandType = CommandType.StoredProcedure;
  43. command.Connection = con;
  44. command.Parameters.Add(paramChg(EmpConData.CONID_FIELD),SqlDbType.Int);
  45. command.Parameters.Add(paramChg(EmpConData.CATETORY_FIELD),SqlDbType.VarChar);
  46. command.Parameters.Add(paramChg(EmpConData.FDATE_FIELD),SqlDbType.DateTime);
  47. command.Parameters.Add(paramChg(EmpConData.TDATE_FIELD),SqlDbType.DateTime);
  48. command.Parameters.Add(paramChg(EmpConData.POSILEVL_FIELD),SqlDbType.VarChar);
  49. command.Parameters.Add(paramChg(EmpConData.SALALEVL_FIELD),SqlDbType.VarChar);
  50. command.Parameters.Add(paramChg(EmpConData.ANNSALA_FIELD),SqlDbType.VarChar);
  51. command.Parameters.Add(paramChg(EmpConData.STATUS_FIELD),SqlDbType.VarChar);
  52. command.Parameters.Add(paramChg(EmpConData.CONNOTE_FIELD),SqlDbType.Text);
  53. command.Parameters[paramChg(EmpConData.CONID_FIELD)].SourceColumn = EmpConData.CONID_FIELD;
  54. command.Parameters[paramChg(EmpConData.CATETORY_FIELD)].SourceColumn = EmpConData.CATETORY_FIELD;
  55. command.Parameters[paramChg(EmpConData.FDATE_FIELD)].SourceColumn = EmpConData.FDATE_FIELD;
  56. command.Parameters[paramChg(EmpConData.TDATE_FIELD)].SourceColumn = EmpConData.TDATE_FIELD;
  57. command.Parameters[paramChg(EmpConData.POSILEVL_FIELD)].SourceColumn = EmpConData.POSILEVL_FIELD;
  58. command.Parameters[paramChg(EmpConData.SALALEVL_FIELD)].SourceColumn = EmpConData.SALALEVL_FIELD;
  59. command.Parameters[paramChg(EmpConData.ANNSALA_FIELD)].SourceColumn = EmpConData.ANNSALA_FIELD;
  60. command.Parameters[paramChg(EmpConData.STATUS_FIELD)].SourceColumn = EmpConData.STATUS_FIELD;
  61. command.Parameters[paramChg(EmpConData.CONNOTE_FIELD)].SourceColumn = EmpConData.CONNOTE_FIELD;
  62. commandAdp.UpdateCommand = command;
  63. commandAdp.Update(empData,EmpConData.EMPCONTACT_TABLE_NAME);
  64. if(empData.HasErrors)
  65. {
  66. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  67. return false;
  68. }
  69. else
  70. {
  71. empData.AcceptChanges();
  72. return true;
  73. }
  74. }
  75. public bool InsertMrContact(EmpConData empData)
  76. {
  77. SqlCommand command = new SqlCommand();
  78. command.CommandText = "InsertMrContact";
  79. command.CommandType = CommandType.StoredProcedure;
  80. command.Connection = con;
  81. command.Parameters.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  82. command.Parameters.Add(paramChg(EmpConData.CATETORY_FIELD),SqlDbType.VarChar);
  83. command.Parameters.Add(paramChg(EmpConData.FDATE_FIELD),SqlDbType.DateTime);
  84. command.Parameters.Add(paramChg(EmpConData.TDATE_FIELD),SqlDbType.DateTime);
  85. command.Parameters.Add(paramChg(EmpConData.POSILEVL_FIELD),SqlDbType.VarChar);
  86. command.Parameters.Add(paramChg(EmpConData.SALALEVL_FIELD),SqlDbType.VarChar);
  87. command.Parameters.Add(paramChg(EmpConData.ANNSALA_FIELD),SqlDbType.VarChar);
  88. command.Parameters.Add(paramChg(EmpConData.STATUS_FIELD),SqlDbType.VarChar);
  89. command.Parameters.Add(paramChg(EmpConData.CONNOTE_FIELD),SqlDbType.Text);
  90. command.Parameters[paramChg(EmpBaseData.EMPID_FIELD)].SourceColumn = EmpBaseData.EMPID_FIELD;
  91. command.Parameters[paramChg(EmpConData.CATETORY_FIELD)].SourceColumn = EmpConData.CATETORY_FIELD;
  92. command.Parameters[paramChg(EmpConData.FDATE_FIELD)].SourceColumn = EmpConData.FDATE_FIELD;
  93. command.Parameters[paramChg(EmpConData.TDATE_FIELD)].SourceColumn = EmpConData.TDATE_FIELD;
  94. command.Parameters[paramChg(EmpConData.POSILEVL_FIELD)].SourceColumn = EmpConData.POSILEVL_FIELD;
  95. command.Parameters[paramChg(EmpConData.SALALEVL_FIELD)].SourceColumn = EmpConData.SALALEVL_FIELD;
  96. command.Parameters[paramChg(EmpConData.ANNSALA_FIELD)].SourceColumn = EmpConData.ANNSALA_FIELD;
  97. command.Parameters[paramChg(EmpConData.STATUS_FIELD)].SourceColumn = EmpConData.STATUS_FIELD;
  98. command.Parameters[paramChg(EmpConData.CONNOTE_FIELD)].SourceColumn = EmpConData.CONNOTE_FIELD;
  99. commandAdp.InsertCommand = command;
  100. commandAdp.Update(empData,EmpConData.EMPCONTACT_TABLE_NAME);
  101. if(empData.HasErrors)
  102. {
  103. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  104. return false;
  105. }
  106. else
  107. {
  108. empData.AcceptChanges();
  109. return true;
  110. }
  111. }
  112. public bool DeleteMrContact(int conID)
  113. {
  114. SqlCommand command = new SqlCommand();
  115. command.CommandText = "DeleteMrContact";
  116. command.CommandType = CommandType.StoredProcedure;
  117. command.Connection = con;
  118. SqlParameter param = new SqlParameter(paramChg(EmpConData.CONID_FIELD),SqlDbType.Int);
  119. param.Value = conID;
  120. command.Parameters.Add(param);
  121. con.Open();
  122. int result = command.ExecuteNonQuery();
  123. con.Close();
  124. if(result>0)
  125. {
  126. return true;
  127. }
  128. else
  129. {
  130. return false;
  131. }
  132. }
  133. public DataSet GetEmpConData(int empID)
  134. {
  135. SqlCommand command = new SqlCommand();
  136. command.CommandText = "GetEmpConInf";
  137. command.CommandType = CommandType.StoredProcedure;
  138. command.Connection = con;
  139. SqlParameter param = new SqlParameter(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  140. param.Value = empID;
  141. command.Parameters.Add(param);
  142. commandAdp.SelectCommand = command;
  143. DataSet data = new DataSet();
  144. try
  145. {
  146. commandAdp.Fill(data);
  147. }
  148. catch(Exception ex)
  149. {
  150. throw new ApplicationException(ex.ToString());
  151. }
  152. return data;
  153. }
  154. public bool InsertMrArchive(EmpArcData empData)
  155. {
  156. SqlCommand command = new SqlCommand();
  157. command.CommandText = "InsertMrArchive";
  158. command.CommandType = CommandType.StoredProcedure;
  159. command.Connection = con;
  160. command.Parameters.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  161. command.Parameters.Add(paramChg(EmpArcData.CATETORY_FIELD),SqlDbType.VarChar);
  162. command.Parameters.Add(paramChg(EmpArcData.FDATE_FIELD),SqlDbType.DateTime);
  163. command.Parameters.Add(paramChg(EmpArcData.TDATE_FIELD),SqlDbType.DateTime);
  164. command.Parameters.Add(paramChg(EmpArcData.BRANAME_FIELD),SqlDbType.VarChar);
  165. command.Parameters.Add(paramChg(EmpArcData.DEPNAME_FIELD),SqlDbType.VarChar);
  166. command.Parameters.Add(paramChg(EmpArcData.POSITION_FIELD),SqlDbType.VarChar);
  167. command.Parameters.Add(paramChg(EmpArcData.REASON_FIELD),SqlDbType.Text);
  168. command.Parameters.Add(paramChg(EmpArcData.ARCNOTE_FIELD),SqlDbType.Text);
  169. command.Parameters[paramChg(EmpBaseData.EMPID_FIELD)].SourceColumn = EmpBaseData.EMPID_FIELD;
  170. command.Parameters[paramChg(EmpArcData.CATETORY_FIELD)].SourceColumn = EmpArcData.CATETORY_FIELD;
  171. command.Parameters[paramChg(EmpArcData.FDATE_FIELD)].SourceColumn = EmpArcData.FDATE_FIELD;
  172. command.Parameters[paramChg(EmpArcData.TDATE_FIELD)].SourceColumn = EmpArcData.TDATE_FIELD;
  173. command.Parameters[paramChg(EmpArcData.BRANAME_FIELD)].SourceColumn = EmpArcData.BRANAME_FIELD;
  174. command.Parameters[paramChg(EmpArcData.DEPNAME_FIELD)].SourceColumn = EmpArcData.DEPNAME_FIELD;
  175. command.Parameters[paramChg(EmpArcData.POSITION_FIELD)].SourceColumn = EmpArcData.POSITION_FIELD;
  176. command.Parameters[paramChg(EmpArcData.REASON_FIELD)].SourceColumn = EmpArcData.REASON_FIELD;
  177. command.Parameters[paramChg(EmpArcData.ARCNOTE_FIELD)].SourceColumn = EmpArcData.ARCNOTE_FIELD;
  178. commandAdp.InsertCommand = command;
  179. commandAdp.Update(empData,EmpArcData.EMPARCHIVE_TABLE_NAME);
  180. if(empData.HasErrors)
  181. {
  182. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  183. return false;
  184. }
  185. else
  186. {
  187. empData.AcceptChanges();
  188. return true;
  189. }
  190. }
  191. public bool UpdateMrArchive(EmpArcData empData)
  192. {
  193. SqlCommand command = new SqlCommand();
  194. command.CommandText = "UpdateMrArchive";
  195. command.CommandType = CommandType.StoredProcedure;
  196. command.Connection = con;
  197. command.Parameters.Add(paramChg(EmpArcData.ARCID_FIELD),SqlDbType.Int);
  198. command.Parameters.Add(paramChg(EmpArcData.CATETORY_FIELD),SqlDbType.VarChar)  ;
  199. command.Parameters.Add(paramChg(EmpArcData.FDATE_FIELD),SqlDbType.DateTime);
  200. command.Parameters.Add(paramChg(EmpArcData.TDATE_FIELD),SqlDbType.DateTime);
  201. command.Parameters.Add(paramChg(EmpArcData.BRANAME_FIELD),SqlDbType.VarChar);
  202. command.Parameters.Add(paramChg(EmpArcData.DEPNAME_FIELD),SqlDbType.VarChar);
  203. command.Parameters.Add(paramChg(EmpArcData.POSITION_FIELD),SqlDbType.VarChar);
  204. command.Parameters.Add(paramChg(EmpArcData.REASON_FIELD),SqlDbType.Text);
  205. command.Parameters.Add(paramChg(EmpArcData.ARCNOTE_FIELD),SqlDbType.Text);
  206. //
  207. //
  208. //
  209. command.Parameters[paramChg(EmpArcData.ARCID_FIELD)].SourceColumn = EmpArcData.ARCID_FIELD;
  210. command.Parameters[paramChg(EmpArcData.CATETORY_FIELD)].SourceColumn = EmpArcData.CATETORY_FIELD;
  211. command.Parameters[paramChg(EmpArcData.FDATE_FIELD)].SourceColumn = EmpArcData.FDATE_FIELD;
  212. command.Parameters[paramChg(EmpArcData.TDATE_FIELD)].SourceColumn = EmpArcData.TDATE_FIELD;
  213. command.Parameters[paramChg(EmpArcData.BRANAME_FIELD)].SourceColumn = EmpArcData.BRANAME_FIELD;
  214. command.Parameters[paramChg(EmpArcData.DEPNAME_FIELD)].SourceColumn = EmpArcData.DEPNAME_FIELD;
  215. command.Parameters[paramChg(EmpArcData.POSITION_FIELD)].SourceColumn = EmpArcData.POSITION_FIELD;
  216. command.Parameters[paramChg(EmpArcData.REASON_FIELD)].SourceColumn = EmpArcData.REASON_FIELD;
  217. command.Parameters[paramChg(EmpArcData.ARCNOTE_FIELD)].SourceColumn = EmpArcData.ARCNOTE_FIELD;
  218. commandAdp.UpdateCommand = command;
  219. commandAdp.Update(empData,EmpArcData.EMPARCHIVE_TABLE_NAME);
  220. if(empData.HasErrors)
  221. {
  222. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  223. return false;
  224. }
  225. else
  226. {
  227. empData.AcceptChanges();
  228. return true;
  229. }
  230. }
  231. public DataSet GetEmpArcData_By_ArcID(int arcID)
  232. {
  233. SqlCommand command = new SqlCommand();
  234. command.CommandText = "GetEmpArcInfByArcID";
  235. command.CommandType = CommandType.StoredProcedure;
  236. command.Connection = con;
  237. SqlParameter param = new SqlParameter(paramChg(EmpArcData.ARCID_FIELD),SqlDbType.Int);
  238. param.Value = arcID;
  239. command.Parameters.Add(param);
  240. commandAdp.SelectCommand = command;
  241. DataSet data = new DataSet();
  242. try
  243. {
  244. commandAdp.Fill(data);
  245. }
  246. catch(Exception ex)
  247. {
  248. throw new ApplicationException(ex.ToString());
  249. }
  250. return data;
  251. }
  252. public bool DeleteMrArchive(int arcID)
  253. {
  254. SqlCommand command = new SqlCommand();
  255. command.CommandText = "DeleteMrArchive";
  256. command.CommandType = CommandType.StoredProcedure;
  257. command.Connection = con;
  258. SqlParameter param = new SqlParameter(paramChg(EmpArcData.ARCID_FIELD),SqlDbType.Int);
  259. param.Value = arcID;
  260. command.Parameters.Add(param);
  261. con.Open();
  262. int result = command.ExecuteNonQuery();
  263. con.Close();
  264. if(result>0)
  265. {
  266. return true;
  267. }
  268. else
  269. {
  270. return false;
  271. }
  272. }
  273. public bool UpdateMrVita(EmpVisaData empData)
  274. {
  275. SqlCommand command = new SqlCommand();
  276. command.CommandText = "UpdateMrVita";
  277. command.CommandType = CommandType.StoredProcedure;
  278. command.Connection = con;
  279. command.Parameters.Add(paramChg(EmpVisaData.VISAID_FIELD),SqlDbType.Int);
  280. command.Parameters.Add(paramChg(EmpVisaData.FDATE_FIELD),SqlDbType.DateTime);
  281. command.Parameters.Add(paramChg(EmpVisaData.TDATE_FIELD),SqlDbType.DateTime);
  282. command.Parameters.Add(paramChg(EmpVisaData.COMMPANY_FIELD),SqlDbType.VarChar);
  283. command.Parameters.Add(paramChg(EmpVisaData.DEPNAME_FIELD),SqlDbType.VarChar);
  284. command.Parameters.Add(paramChg(EmpVisaData.POSITION_FIELD),SqlDbType.VarChar);
  285. command.Parameters.Add(paramChg(EmpVisaData.VISANOTE_FIELD),SqlDbType.Text);
  286. //
  287. //
  288. //
  289. command.Parameters[paramChg(EmpVisaData.VISAID_FIELD)].SourceColumn = EmpVisaData.VISAID_FIELD;
  290. command.Parameters[paramChg(EmpVisaData.FDATE_FIELD)].SourceColumn = EmpVisaData.FDATE_FIELD;
  291. command.Parameters[paramChg(EmpVisaData.TDATE_FIELD)].SourceColumn = EmpVisaData.TDATE_FIELD;
  292. command.Parameters[paramChg(EmpVisaData.COMMPANY_FIELD)].SourceColumn = EmpVisaData.COMMPANY_FIELD;
  293. command.Parameters[paramChg(EmpVisaData.DEPNAME_FIELD)].SourceColumn = EmpVisaData.DEPNAME_FIELD;
  294. command.Parameters[paramChg(EmpVisaData.POSITION_FIELD)].SourceColumn = EmpVisaData.POSITION_FIELD;
  295. command.Parameters[paramChg(EmpVisaData.VISANOTE_FIELD)].SourceColumn = EmpVisaData.VISANOTE_FIELD;
  296. commandAdp.UpdateCommand = command;
  297. commandAdp.Update(empData,EmpVisaData.EMPVISA_TABLE_NAME);
  298. if(empData.HasErrors)
  299. {
  300. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  301. return false;
  302. }
  303. else
  304. {
  305. empData.AcceptChanges();
  306. return true;
  307. }
  308. }
  309. public bool InsertMrVita(EmpVisaData empData)
  310. {
  311. SqlCommand command = new SqlCommand();
  312. command.CommandText = "InsertMrVita";
  313. command.CommandType = CommandType.StoredProcedure;
  314. command.Connection = con;
  315. command.Parameters.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  316. command.Parameters.Add(paramChg(EmpVisaData.FDATE_FIELD),SqlDbType.DateTime);
  317. command.Parameters.Add(paramChg(EmpVisaData.TDATE_FIELD),SqlDbType.DateTime);
  318. command.Parameters.Add(paramChg(EmpVisaData.COMMPANY_FIELD),SqlDbType.VarChar);
  319. command.Parameters.Add(paramChg(EmpVisaData.DEPNAME_FIELD),SqlDbType.VarChar);
  320. command.Parameters.Add(paramChg(EmpVisaData.POSITION_FIELD),SqlDbType.VarChar);
  321. command.Parameters.Add(paramChg(EmpVisaData.VISANOTE_FIELD),SqlDbType.Text);
  322. command.Parameters[paramChg(EmpBaseData.EMPID_FIELD)].SourceColumn = EmpBaseData.EMPID_FIELD;
  323. command.Parameters[paramChg(EmpVisaData.FDATE_FIELD)].SourceColumn = EmpVisaData.FDATE_FIELD;
  324. command.Parameters[paramChg(EmpVisaData.TDATE_FIELD)].SourceColumn = EmpVisaData.TDATE_FIELD;
  325. command.Parameters[paramChg(EmpVisaData.COMMPANY_FIELD)].SourceColumn = EmpVisaData.COMMPANY_FIELD;
  326. command.Parameters[paramChg(EmpVisaData.DEPNAME_FIELD)].SourceColumn = EmpVisaData.DEPNAME_FIELD;
  327. command.Parameters[paramChg(EmpVisaData.POSITION_FIELD)].SourceColumn = EmpVisaData.POSITION_FIELD;
  328. command.Parameters[paramChg(EmpVisaData.VISANOTE_FIELD)].SourceColumn = EmpVisaData.VISANOTE_FIELD;
  329. commandAdp.InsertCommand = command;
  330. commandAdp.Update(empData,EmpVisaData.EMPVISA_TABLE_NAME);
  331. if(empData.HasErrors)
  332. {
  333. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  334. return false;
  335. }
  336. else
  337. {
  338. empData.AcceptChanges();
  339. return true;
  340. }
  341. }
  342. public bool DeleteMrVita(int visaID)
  343. {
  344. SqlCommand command = new SqlCommand();
  345. command.CommandText = "DeleteMrVita";
  346. command.CommandType = CommandType.StoredProcedure;
  347. command.Connection = con;
  348. SqlParameter param = new SqlParameter(paramChg(EmpVisaData.VISAID_FIELD),SqlDbType.Int);
  349. param.Value = visaID;
  350. command.Parameters.Add(param);
  351. int result =0;
  352. try
  353. {
  354. con.Open();
  355. result = command.ExecuteNonQuery();
  356. con.Close();
  357. }
  358. catch(Exception ex)
  359. {
  360. throw new ApplicationException(ex.ToString());
  361. }
  362. return (result>0)?true:false;
  363. }
  364. public DataSet GetEmpArcData(int empID)
  365. {
  366. SqlCommand command = new SqlCommand();
  367. command.CommandText = "GetEmpArcInf";
  368. command.CommandType = CommandType.StoredProcedure;
  369. command.Connection = con;
  370. SqlParameter param = new SqlParameter(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  371. param.Value = empID;
  372. command.Parameters.Add(param);
  373. commandAdp.SelectCommand = command;
  374. DataSet data = new DataSet();
  375. try
  376. {
  377. commandAdp.Fill(data);
  378. }
  379. catch(Exception ex)
  380. {
  381. throw new ApplicationException(ex.ToString());
  382. }
  383. return data;
  384. }
  385. public bool UpdateEmpEduInf(EmpBaseData empData)
  386. {
  387. SqlCommand command = new SqlCommand();
  388. command.CommandText = "UpdateEmpEduInf";
  389. command.CommandType =  CommandType.StoredProcedure;
  390. command.Connection = con;
  391. command.Parameters.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  392. command.Parameters.Add(paramChg(EmpBaseData.SCHOOL1_FIELD),SqlDbType.VarChar);
  393. command.Parameters.Add(paramChg(EmpBaseData.SPECIAL1_FIELD),SqlDbType.VarChar);
  394. command.Parameters.Add(paramChg(EmpBaseData.GERTIME1_FIELD),SqlDbType.DateTime);
  395. command.Parameters.Add(paramChg(EmpBaseData.EDUCAT1_FIELD),SqlDbType.VarChar);
  396. command.Parameters.Add(paramChg(EmpBaseData.SCHOOL2_FIELD),SqlDbType.VarChar);
  397. command.Parameters.Add(paramChg(EmpBaseData.SPECIAL2_FIELD),SqlDbType.VarChar);
  398. command.Parameters.Add(paramChg(EmpBaseData.GERTIME2_FIELD),SqlDbType.DateTime);
  399. command.Parameters.Add(paramChg(EmpBaseData.EDUCAT2_FIELD),SqlDbType.VarChar);
  400. command.Parameters.Add(paramChg(EmpBaseData.QULI1_FIELD),SqlDbType.VarChar);
  401. command.Parameters.Add(paramChg(EmpBaseData.QULI2_FIELD),SqlDbType.VarChar);
  402. command.Parameters.Add(paramChg(EmpBaseData.QULI3_FIELD),SqlDbType.VarChar);
  403. command.Parameters.Add(paramChg(EmpBaseData.QULI4_FIELD),SqlDbType.VarChar);
  404. command.Parameters.Add(paramChg(EmpBaseData.EDUNOTE_FIELD),SqlDbType.Text);
  405. command.Parameters[paramChg(EmpBaseData.EMPID_FIELD)].SourceColumn = EmpBaseData.EMPID_FIELD;
  406. command.Parameters[paramChg(EmpBaseData.SCHOOL1_FIELD)].SourceColumn = EmpBaseData.SCHOOL1_FIELD;
  407. command.Parameters[paramChg(EmpBaseData.SPECIAL1_FIELD)].SourceColumn = EmpBaseData.SPECIAL1_FIELD;
  408. command.Parameters[paramChg(EmpBaseData.GERTIME1_FIELD)].SourceColumn = EmpBaseData.GERTIME1_FIELD;
  409. command.Parameters[paramChg(EmpBaseData.EDUCAT1_FIELD)].SourceColumn = EmpBaseData.EDUCAT1_FIELD;
  410. command.Parameters[paramChg(EmpBaseData.SCHOOL2_FIELD)].SourceColumn = EmpBaseData.SCHOOL2_FIELD;
  411. command.Parameters[paramChg(EmpBaseData.SPECIAL2_FIELD)].SourceColumn = EmpBaseData.SPECIAL2_FIELD;
  412. command.Parameters[paramChg(EmpBaseData.GERTIME2_FIELD)].SourceColumn = EmpBaseData.GERTIME2_FIELD;
  413. command.Parameters[paramChg(EmpBaseData.EDUCAT2_FIELD)].SourceColumn = EmpBaseData.EDUCAT2_FIELD;
  414. command.Parameters[paramChg(EmpBaseData.QULI1_FIELD)].SourceColumn = EmpBaseData.QULI1_FIELD;
  415. command.Parameters[paramChg(EmpBaseData.QULI2_FIELD)].SourceColumn = EmpBaseData.QULI2_FIELD;
  416. command.Parameters[paramChg(EmpBaseData.QULI3_FIELD)].SourceColumn = EmpBaseData.QULI3_FIELD;
  417. command.Parameters[paramChg(EmpBaseData.QULI4_FIELD)].SourceColumn = EmpBaseData.QULI4_FIELD;
  418. command.Parameters[paramChg(EmpBaseData.EDUNOTE_FIELD)].SourceColumn = EmpBaseData.EDUNOTE_FIELD;
  419. commandAdp.UpdateCommand = command;
  420. commandAdp.Update(empData,EmpBaseData.EMP_TABLE_NAME);
  421. if(empData.HasErrors)
  422. {
  423. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  424. return false;
  425. }
  426. else
  427. {
  428. empData.AcceptChanges();
  429. return true;
  430. }
  431. }
  432. public DataSet GetEmpVisaData_By_VisaID(int visaID)
  433. {
  434. SqlCommand command = new SqlCommand();
  435. command.CommandText = "GetEmpVisaInfByVisaID";
  436. command.CommandType = CommandType.StoredProcedure;
  437. command.Connection = con;
  438. SqlParameter param = new SqlParameter(paramChg(EmpVisaData.VISAID_FIELD),SqlDbType.Int);
  439. param.Value = visaID;
  440. command.Parameters.Add(param);
  441. commandAdp.SelectCommand = command;
  442. DataSet data = new DataSet();
  443. try
  444. {
  445. commandAdp.Fill(data);
  446. }
  447. catch(Exception ex)
  448. {
  449. throw new ApplicationException(ex.ToString());
  450. }
  451. return data;
  452. }
  453. public DataSet GetEmpVisaData(int empID)
  454. {
  455. SqlCommand command = new SqlCommand();
  456. command.CommandText = "GetEmpVisaInf";
  457. command.CommandType =  CommandType.StoredProcedure;
  458. command.Connection = con;
  459. SqlParameter param = new SqlParameter(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  460. param.Value = empID;
  461. command.Parameters.Add(param);
  462. commandAdp.SelectCommand = command;
  463. DataSet data = new DataSet();
  464. try
  465. {
  466. commandAdp.Fill(data);
  467. }
  468. catch(Exception ex)
  469. {
  470. throw new ApplicationException(ex.ToString());
  471. }
  472. return data;
  473. }
  474. public bool StopEmpLogin(int empID,int allowLogin)
  475. {
  476. SqlCommand command = new SqlCommand();
  477. command.Connection = con;
  478. command.CommandText = "StopEmpLogin";
  479. command.CommandType = CommandType.StoredProcedure;
  480. SqlParameter param = new SqlParameter(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  481. param.Value = empID;
  482. command.Parameters.Add(paramChg(EmpBaseData.ALLOWLOGIN_FIELD),SqlDbType.Bit);
  483. command.Parameters[paramChg(EmpBaseData.ALLOWLOGIN_FIELD)].Value = allowLogin;
  484. command.Parameters.Add(param);
  485. try
  486. {
  487. con.Open();
  488. command.ExecuteNonQuery();
  489. con.Close();
  490. }
  491. catch
  492. {
  493. return false;
  494. }
  495. return true;
  496. }
  497. public DataSet GetEmpDataStoped()
  498. {
  499. SqlCommand command = new SqlCommand();
  500. command.Connection = con;
  501. command.CommandText = "GetEmpInfStoped";
  502. command.CommandType = CommandType.StoredProcedure;
  503. commandAdp.SelectCommand = command ;
  504. DataSet data = new DataSet();
  505. try
  506. {
  507. commandAdp.Fill(data);
  508. }
  509. catch(Exception ex)
  510. {
  511. throw new ApplicationException(ex.ToString());
  512. }
  513. return data;
  514. }
  515. public DataSet GetEmpPicData(int empID)
  516. {
  517. SqlCommand command = new SqlCommand();
  518. command.CommandText = "GetEmpPic";
  519. command.CommandType = CommandType.StoredProcedure;
  520. command.Connection = con;
  521. command.Parameters.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  522. command.Parameters[paramChg(EmpBaseData.EMPID_FIELD)].Value = empID;
  523. commandAdp.SelectCommand = command;
  524. DataSet data = new DataSet();
  525. try
  526. {
  527. commandAdp.Fill(data);
  528. }
  529. catch(Exception ex)
  530. {
  531. throw new ApplicationException(ex.ToString());
  532. }
  533. return data;
  534. }
  535. public void UpdateEmpPic(int empID,byte[] byteArray)
  536. {
  537. SqlCommand command = new SqlCommand();
  538. command.CommandText = "UpdateMrPhoto";
  539. command.CommandType = CommandType.StoredProcedure;
  540. command.Connection = con;
  541. SqlParameterCollection param = command.Parameters;
  542. param.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  543. param.Add(paramChg(EmpBaseData.PHOTO_SIZE_FIELD),SqlDbType.Int);
  544. param.Add(paramChg(EmpBaseData.PHOTO_CONTENT_FIELD),SqlDbType.Image);
  545. param[paramChg(EmpBaseData.EMPID_FIELD)].Value = empID;
  546. if(byteArray != null)
  547. {
  548. param[paramChg(EmpBaseData.PHOTO_SIZE_FIELD)].Value = byteArray.Length;
  549. param[paramChg(EmpBaseData.PHOTO_CONTENT_FIELD)].Value = byteArray;
  550. }
  551. else
  552. {
  553. param[paramChg(EmpBaseData.PHOTO_SIZE_FIELD)].Value = DBNull.Value;
  554. param[paramChg(EmpBaseData.PHOTO_CONTENT_FIELD)].Value = DBNull.Value;
  555. }
  556. con.Open();
  557. command.ExecuteNonQuery();
  558. con.Close();
  559. }
  560. public DataSet GetEmpData_By_QueryStr(string branchID,string depID,string empName)
  561. {
  562. string queryStr = "select i.EmpID,i.LoginID,i.EmpName,i.Email,i.OfficeTel,i.OfficeFax,i.Mobile,i.PhotoSize,j.DepName,k.SimpleCode from mrBaseInf i,mrDepartment j,mrBranch k where i.AllowLogin = 1 and i.DepID = j.DepID and  k.BranchID = "+branchID ;
  563. if(empName!=string.Empty)
  564. {
  565. queryStr = queryStr + " and " ;
  566. queryStr = queryStr + " i.EmpName = '"+empName+"'";
  567. }
  568. if(depID!=string.Empty)
  569. {
  570. queryStr = queryStr + " and ";
  571. queryStr = queryStr + " i.DepID = "+depID;
  572. }
  573. else
  574. {
  575. queryStr = queryStr + " and ";
  576. queryStr = queryStr + " i.DepID in(select DepID from mrDepartment where BranchID = "+branchID+" )";
  577. }
  578. SqlCommand command = new SqlCommand();
  579. command.CommandText = queryStr;
  580. command.Connection = con;
  581. commandAdp.SelectCommand = command;
  582. DataSet data = new DataSet();
  583. try
  584. {
  585. commandAdp.Fill(data);
  586. }
  587. catch(Exception ex)
  588. {
  589. throw new ApplicationException(ex.ToString());
  590. }
  591. return data;
  592. }
  593. public DataSet GetEmpBaseData_By_EmpID(int empID)
  594. {
  595. SqlCommand command = new SqlCommand();
  596. command.CommandText = "GetEmpBaseInfByEmpID";
  597. command.CommandType = CommandType.StoredProcedure;
  598. command.Connection = con;
  599. SqlParameter param = new SqlParameter(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  600. param.Value = empID;
  601. command.Parameters.Add(param);
  602. commandAdp.SelectCommand = command;
  603. DataSet data = new DataSet();
  604. try
  605. {
  606. commandAdp.Fill(data);
  607. }
  608. catch(Exception ex)
  609. {
  610. throw new ApplicationException(ex.ToString());
  611. }
  612. return data;
  613. }
  614. public int InsertMrBaseInf(EmpBaseData empBaseData)
  615. {
  616. SqlCommand command = new SqlCommand();
  617. command.CommandType = CommandType.StoredProcedure;
  618. command.Connection = con;
  619. command.CommandText = "InsertMrBaseInf";
  620. SqlParameterCollection param = command.Parameters;
  621. SqlParameter paramTmp = new SqlParameter("@Identify",SqlDbType.Int);
  622. paramTmp.Direction = ParameterDirection.ReturnValue;
  623. param.Add(paramTmp);
  624. param.Add(paramChg(DepData.DEPID_FIELD),SqlDbType.Int);
  625. param.Add(paramChg(EmpBaseData.EMPNAME_FIELD),SqlDbType.VarChar);
  626. param.Add(paramChg(EmpBaseData.LOGINID_FIELD),SqlDbType.VarChar);
  627. param.Add(paramChg(EmpBaseData.PASSWORD_FIELD),SqlDbType.VarChar);
  628. param.Add(paramChg(EmpBaseData.SEX_FIELD),SqlDbType.Bit);
  629. param.Add(paramChg(EmpBaseData.EMPCODE_FIELD),SqlDbType.VarChar);
  630. param.Add(paramChg(EmpBaseData.EMAIL_FIELD),SqlDbType.VarChar);
  631. param.Add(paramChg(EmpBaseData.OFFICETEL_FIELD),SqlDbType.VarChar);
  632. param.Add(paramChg(EmpBaseData.OFFICEFAX_FIELD),SqlDbType.VarChar);
  633. param.Add(paramChg(EmpBaseData.MOBILE_FIELD),SqlDbType.VarChar);
  634. param.Add(paramChg(EmpBaseData.POSITION_FIELD),SqlDbType.VarChar);
  635. param[paramChg(DepData.DEPID_FIELD)].SourceColumn = DepData.DEPID_FIELD;
  636. param[paramChg(EmpBaseData.EMPNAME_FIELD)].SourceColumn = EmpBaseData.EMPNAME_FIELD;
  637. param[paramChg(EmpBaseData.LOGINID_FIELD)].SourceColumn = EmpBaseData.LOGINID_FIELD;
  638. param[paramChg(EmpBaseData.PASSWORD_FIELD)].SourceColumn = EmpBaseData.PASSWORD_FIELD;
  639. param[paramChg(EmpBaseData.SEX_FIELD)].SourceColumn = EmpBaseData.SEX_FIELD;
  640. param[paramChg(EmpBaseData.EMPCODE_FIELD)].SourceColumn = EmpBaseData.EMPCODE_FIELD;
  641. param[paramChg(EmpBaseData.EMAIL_FIELD)].SourceColumn = EmpBaseData.EMAIL_FIELD;
  642. param[paramChg(EmpBaseData.OFFICETEL_FIELD)].SourceColumn = EmpBaseData.OFFICETEL_FIELD;
  643. param[paramChg(EmpBaseData.OFFICEFAX_FIELD)].SourceColumn = EmpBaseData.OFFICEFAX_FIELD;
  644. param[paramChg(EmpBaseData.MOBILE_FIELD)].SourceColumn = EmpBaseData.MOBILE_FIELD;
  645. param[paramChg(EmpBaseData.POSITION_FIELD)].SourceColumn = EmpBaseData.POSITION_FIELD;
  646. commandAdp.InsertCommand = command;
  647. int result = commandAdp.Update(empBaseData,EmpBaseData.EMP_TABLE_NAME);
  648. if(result>0)
  649. return (int)commandAdp.InsertCommand.Parameters["@Identify"].Value;
  650. else
  651. return 0;
  652. }
  653. public bool UpdateMrBaseInf(EmpBaseData empBaseData)
  654. {
  655. SqlCommand command = new SqlCommand();
  656. command.CommandType = CommandType.StoredProcedure;
  657. command.Connection = con;
  658. command.CommandText = "UpdateMrBaseInf";
  659. SqlParameterCollection param = command.Parameters;
  660. param.Add(paramChg(DepData.DEPID_FIELD),SqlDbType.Int);
  661. param.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  662. param.Add(paramChg(EmpBaseData.EMPNAME_FIELD),SqlDbType.VarChar);
  663. param.Add(paramChg(EmpBaseData.LOGINID_FIELD),SqlDbType.VarChar);
  664. param.Add(paramChg(EmpBaseData.SEX_FIELD),SqlDbType.Bit);
  665. param.Add(paramChg(EmpBaseData.EMPCODE_FIELD),SqlDbType.VarChar);
  666. param.Add(paramChg(EmpBaseData.EMAIL_FIELD),SqlDbType.VarChar);
  667. param.Add(paramChg(EmpBaseData.OFFICETEL_FIELD),SqlDbType.VarChar);
  668. param.Add(paramChg(EmpBaseData.OFFICEFAX_FIELD),SqlDbType.VarChar);
  669. param.Add(paramChg(EmpBaseData.MOBILE_FIELD),SqlDbType.VarChar);
  670. param.Add(paramChg(EmpBaseData.POSITION_FIELD),SqlDbType.VarChar);
  671. param[paramChg(DepData.DEPID_FIELD)].SourceColumn = DepData.DEPID_FIELD;
  672. param[paramChg(EmpBaseData.EMPID_FIELD)].SourceColumn = EmpBaseData.EMPID_FIELD;
  673. param[paramChg(EmpBaseData.EMPNAME_FIELD)].SourceColumn = EmpBaseData.EMPNAME_FIELD;
  674. param[paramChg(EmpBaseData.LOGINID_FIELD)].SourceColumn = EmpBaseData.LOGINID_FIELD;
  675. param[paramChg(EmpBaseData.SEX_FIELD)].SourceColumn = EmpBaseData.SEX_FIELD;
  676. param[paramChg(EmpBaseData.EMPCODE_FIELD)].SourceColumn = EmpBaseData.EMPCODE_FIELD;
  677. param[paramChg(EmpBaseData.EMAIL_FIELD)].SourceColumn = EmpBaseData.EMAIL_FIELD;
  678. param[paramChg(EmpBaseData.OFFICETEL_FIELD)].SourceColumn = EmpBaseData.OFFICETEL_FIELD;
  679. param[paramChg(EmpBaseData.OFFICEFAX_FIELD)].SourceColumn = EmpBaseData.OFFICEFAX_FIELD;
  680. param[paramChg(EmpBaseData.MOBILE_FIELD)].SourceColumn = EmpBaseData.MOBILE_FIELD;
  681. param[paramChg(EmpBaseData.POSITION_FIELD)].SourceColumn = EmpBaseData.POSITION_FIELD;
  682. commandAdp.UpdateCommand = command;
  683. commandAdp.Update(empBaseData,EmpBaseData.EMP_TABLE_NAME);
  684. if(empBaseData.HasErrors)
  685. {
  686. empBaseData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  687. return false;
  688. }
  689. else
  690. {
  691. empBaseData.AcceptChanges();
  692. return true;
  693. }
  694. }
  695. public bool UpdateEmpWelInf(EmpBaseData empData)
  696. {
  697. SqlCommand command = new SqlCommand();
  698. command.CommandText = "UpdateEmpWelInf";
  699. command.CommandType = CommandType.StoredProcedure;
  700. command.Connection = con;
  701. SqlParameterCollection param = command.Parameters;
  702. param.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  703. param.Add(paramChg(EmpBaseData.ENTERDATE_FIELD),SqlDbType.DateTime);
  704. param.Add(paramChg(EmpBaseData.ENTERMODE_FIELD),SqlDbType.VarChar);
  705. param.Add(paramChg(EmpBaseData.POSILEVL_FIELD),SqlDbType.VarChar);
  706. param.Add(paramChg(EmpBaseData.SALALEVL_FIELD),SqlDbType.VarChar);
  707. param.Add(paramChg(EmpBaseData.ENDOFLAG_FIELD),SqlDbType.Bit);
  708. param.Add(paramChg(EmpBaseData.HOSPFLAG_FIELD),SqlDbType.Bit);
  709. param.Add(paramChg(EmpBaseData.HOUSFLAG_FIELD),SqlDbType.Bit);
  710. param.Add(paramChg(EmpBaseData.GRAVFLAG_FIELD),SqlDbType.Bit);
  711. param.Add(paramChg(EmpBaseData.UNEMFLAG_FIELD),SqlDbType.Bit);
  712. param.Add(paramChg(EmpBaseData.WELNOTE_FIELD),SqlDbType.Text);
  713. param[paramChg(EmpBaseData.EMPID_FIELD)].SourceColumn = EmpBaseData.EMPID_FIELD;
  714. param[paramChg(EmpBaseData.ENTERDATE_FIELD)].SourceColumn = EmpBaseData.ENTERDATE_FIELD;
  715. param[paramChg(EmpBaseData.ENTERMODE_FIELD)].SourceColumn = EmpBaseData.ENTERMODE_FIELD;
  716. param[paramChg(EmpBaseData.POSILEVL_FIELD)].SourceColumn = EmpBaseData.POSILEVL_FIELD;
  717. param[paramChg(EmpBaseData.SALALEVL_FIELD)].SourceColumn = EmpBaseData.SALALEVL_FIELD;
  718. param[paramChg(EmpBaseData.ENDOFLAG_FIELD)].SourceColumn = EmpBaseData.ENDOFLAG_FIELD;
  719. param[paramChg(EmpBaseData.HOSPFLAG_FIELD)].SourceColumn = EmpBaseData.HOSPFLAG_FIELD;
  720. param[paramChg(EmpBaseData.HOUSFLAG_FIELD)].SourceColumn = EmpBaseData.HOUSFLAG_FIELD;
  721. param[paramChg(EmpBaseData.GRAVFLAG_FIELD)].SourceColumn = EmpBaseData.GRAVFLAG_FIELD;
  722. param[paramChg(EmpBaseData.UNEMFLAG_FIELD)].SourceColumn = EmpBaseData.UNEMFLAG_FIELD;
  723. param[paramChg(EmpBaseData.WELNOTE_FIELD)].SourceColumn = EmpBaseData.WELNOTE_FIELD;
  724. commandAdp.UpdateCommand = command;
  725. commandAdp.Update(empData,EmpBaseData.EMP_TABLE_NAME);
  726. if(empData.HasErrors)
  727. {
  728. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  729. return false;
  730. }
  731. else
  732. {
  733. empData.AcceptChanges();
  734. return true;
  735. }
  736. }
  737. public bool UpdateEmpPersInf(EmpBaseData empData)
  738. {
  739. SqlCommand command = new SqlCommand();
  740. command.CommandText = "UpdateEmpPersInf";
  741. command.CommandType = CommandType.StoredProcedure;
  742. command.Connection = con;
  743. SqlParameterCollection param = command.Parameters;
  744. param.Add(paramChg(EmpBaseData.EMPID_FIELD),SqlDbType.Int);
  745. param.Add(paramChg(EmpBaseData.PROVINCE_FIELD),SqlDbType.VarChar);
  746. param.Add(paramChg(EmpBaseData.CITY_FIELD),SqlDbType.VarChar);
  747. param.Add(paramChg(EmpBaseData.DISTRICT_FIELD),SqlDbType.VarChar);
  748. param.Add(paramChg(EmpBaseData.STREET_FIELD),SqlDbType.VarChar);
  749. param.Add(paramChg(EmpBaseData.POSTCODE_FIELD),SqlDbType.VarChar);
  750. param.Add(paramChg(EmpBaseData.TEL1_FIELD),SqlDbType.VarChar);
  751. param.Add(paramChg(EmpBaseData.TEL2_FIELD),SqlDbType.VarChar);
  752. param.Add(paramChg(EmpBaseData.BIRTHDAY_FIELD),SqlDbType.DateTime);
  753. param.Add(paramChg(EmpBaseData.IDCARDNO_FIELD),SqlDbType.VarChar);
  754. param.Add(paramChg(EmpBaseData.NAPLACE_FIELD),SqlDbType.VarChar);
  755. param.Add(paramChg(EmpBaseData.PARTY_FIELD),SqlDbType.VarChar);
  756. param.Add(paramChg(EmpBaseData.PERSNOTE_FIELD),SqlDbType.Text);
  757. param[paramChg(EmpBaseData.EMPID_FIELD)].SourceColumn = EmpBaseData.EMPID_FIELD;
  758. param[paramChg(EmpBaseData.PROVINCE_FIELD)].SourceColumn = EmpBaseData.PROVINCE_FIELD;
  759. param[paramChg(EmpBaseData.CITY_FIELD)].SourceColumn = EmpBaseData.CITY_FIELD;
  760. param[paramChg(EmpBaseData.DISTRICT_FIELD)].SourceColumn = EmpBaseData.DISTRICT_FIELD;
  761. param[paramChg(EmpBaseData.STREET_FIELD)].SourceColumn = EmpBaseData.STREET_FIELD;
  762. param[paramChg(EmpBaseData.POSTCODE_FIELD)].SourceColumn = EmpBaseData.POSTCODE_FIELD;
  763. param[paramChg(EmpBaseData.TEL1_FIELD)].SourceColumn = EmpBaseData.TEL1_FIELD;
  764. param[paramChg(EmpBaseData.TEL2_FIELD)].SourceColumn = EmpBaseData.TEL2_FIELD;
  765. param[paramChg(EmpBaseData.BIRTHDAY_FIELD)].SourceColumn = EmpBaseData.BIRTHDAY_FIELD;
  766. param[paramChg(EmpBaseData.IDCARDNO_FIELD)].SourceColumn = EmpBaseData.IDCARDNO_FIELD;
  767. param[paramChg(EmpBaseData.NAPLACE_FIELD)].SourceColumn = EmpBaseData.NAPLACE_FIELD;
  768. param[paramChg(EmpBaseData.PARTY_FIELD)].SourceColumn = EmpBaseData.PARTY_FIELD;
  769. param[paramChg(EmpBaseData.PERSNOTE_FIELD)].SourceColumn = EmpBaseData.PERSNOTE_FIELD;
  770. commandAdp.UpdateCommand = command;
  771. commandAdp.Update(empData,EmpBaseData.EMP_TABLE_NAME);
  772. if(empData.HasErrors)
  773. {
  774. empData.Tables[EmpBaseData.EMP_TABLE_NAME].GetErrors()[0].ClearErrors();
  775. return false;
  776. }
  777. else
  778. {
  779. empData.AcceptChanges();
  780. return true;
  781. }
  782. }
  783. private SqlCommand GetCommand()
  784. {
  785. SqlCommand command = new SqlCommand();
  786. command.CommandType = CommandType.StoredProcedure;
  787. command.Connection = con;
  788. SqlParameterCollection param = command.Parameters;
  789. SqlParameter paramTmp = new SqlParameter("@Identify",SqlDbType.Int);
  790. paramTmp.Direction = ParameterDirection.ReturnValue;
  791. param.Add(paramTmp);
  792. param.Add(paramChg(DepData.DEPID_FIELD),SqlDbType.Int);
  793. param.Add(paramChg(DepData.BRANCHID_FIELD),SqlDbType.Int);
  794. param.Add(paramChg(EmpBaseData.EMPNAME_FIELD),SqlDbType.VarChar);
  795. param.Add(paramChg(EmpBaseData.LOGINID_FIELD),SqlDbType.VarChar);
  796. param.Add(paramChg(EmpBaseData.SEX_FIELD),SqlDbType.Bit);
  797. param.Add(paramChg(EmpBaseData.EMPCODE_FIELD),SqlDbType.VarChar);
  798. param.Add(paramChg(EmpBaseData.EMAIL_FIELD),SqlDbType.VarChar);
  799. param.Add(paramChg(EmpBaseData.OFFICETEL_FIELD),SqlDbType.VarChar);
  800. param.Add(paramChg(EmpBaseData.OFFICEFAX_FIELD),SqlDbType.VarChar);
  801. param.Add(paramChg(EmpBaseData.MOBILE_FIELD),SqlDbType.VarChar);
  802. param.Add(paramChg(EmpBaseData.PROVINCE_FIELD),SqlDbType.VarChar);
  803. param.Add(paramChg(EmpBaseData.CITY_FIELD),SqlDbType.VarChar);
  804. param.Add(paramChg(EmpBaseData.DISTRICT_FIELD),SqlDbType.VarChar);
  805. param.Add(paramChg(EmpBaseData.STREET_FIELD),SqlDbType.VarChar);
  806. param.Add(paramChg(EmpBaseData.POSTCODE_FIELD),SqlDbType.VarChar);
  807. param.Add(paramChg(EmpBaseData.TEL1_FIELD),SqlDbType.VarChar);
  808. param.Add(paramChg(EmpBaseData.TEL2_FIELD),SqlDbType.VarChar);
  809. param.Add(paramChg(EmpBaseData.BIRTHDAY_FIELD),SqlDbType.DateTime);
  810. param.Add(paramChg(EmpBaseData.IDCARDNO_FIELD),SqlDbType.VarChar);
  811. param.Add(paramChg(EmpBaseData.NAPLACE_FIELD),SqlDbType.VarChar);
  812. param.Add(paramChg(EmpBaseData.PARTY_FIELD),SqlDbType.VarChar);
  813. param.Add(paramChg(EmpBaseData.EDUCAT1_FIELD),SqlDbType.VarChar);
  814. param.Add(paramChg(EmpBaseData.SCHOOL1_FIELD),SqlDbType.VarChar);
  815. param.Add(paramChg(EmpBaseData.SPECIAL1_FIELD),SqlDbType.VarChar);
  816. param.Add(paramChg(EmpBaseData.GERTIME1_FIELD),SqlDbType.DateTime);
  817. param.Add(paramChg(EmpBaseData.EDUCAT2_FIELD),SqlDbType.VarChar);
  818. param.Add(paramChg(EmpBaseData.SCHOOL2_FIELD),SqlDbType.VarChar);
  819. param.Add(paramChg(EmpBaseData.SPECIAL2_FIELD),SqlDbType.VarChar);
  820. param.Add(paramChg(EmpBaseData.GERTIME2_FIELD),SqlDbType.DateTime);
  821. param.Add(paramChg(EmpBaseData.QULI1_FIELD),SqlDbType.VarChar);
  822. param.Add(paramChg(EmpBaseData.QULI2_FIELD),SqlDbType.VarChar);
  823. param.Add(paramChg(EmpBaseData.QULI3_FIELD),SqlDbType.VarChar);
  824. param.Add(paramChg(EmpBaseData.QULI4_FIELD),SqlDbType.VarChar);
  825. param.Add(paramChg(EmpBaseData.ENTERDATE_FIELD),SqlDbType.DateTime);
  826. param.Add(paramChg(EmpBaseData.ENTERMODE_FIELD),SqlDbType.VarChar);
  827. param.Add(paramChg(EmpBaseData.POSILEVL_FIELD),SqlDbType.VarChar);
  828. param.Add(paramChg(EmpBaseData.SALALEVL_FIELD),SqlDbType.VarChar);
  829. param.Add(paramChg(EmpBaseData.ENDOFLAG_FIELD),SqlDbType.Bit);
  830. param.Add(paramChg(EmpBaseData.HOSPFLAG_FIELD),SqlDbType.Bit);
  831. param.Add(paramChg(EmpBaseData.HOUSFLAG_FIELD),SqlDbType.Bit);
  832. param.Add(paramChg(EmpBaseData.GRAVFLAG_FIELD),SqlDbType.Bit);
  833. param.Add(paramChg(EmpBaseData.UNEMFLAG_FIELD),SqlDbType.Bit);
  834. param.Add(paramChg(EmpBaseData.WELNOTE_FIELD),SqlDbType.Text);
  835. param.Add(paramChg(EmpBaseData.PERSNOTE_FIELD),SqlDbType.Text);
  836. param[paramChg(DepData.DEPID_FIELD)].SourceColumn = DepData.DEPID_FIELD;
  837. param[paramChg(DepData.BRANCHID_FIELD)].SourceColumn = DepData.BRANCHID_FIELD;
  838. param[paramChg(EmpBaseData.EMPNAME_FIELD)].SourceColumn = EmpBaseData.EMPNAME_FIELD;
  839. param[paramChg(EmpBaseData.LOGINID_FIELD)].SourceColumn = EmpBaseData.LOGINID_FIELD;
  840. param[paramChg(EmpBaseData.SEX_FIELD)].SourceColumn = EmpBaseData.SEX_FIELD;
  841. param[paramChg(EmpBaseData.EMPCODE_FIELD)].SourceColumn = EmpBaseData.EMPCODE_FIELD;
  842. param[paramChg(EmpBaseData.EMAIL_FIELD)].SourceColumn = EmpBaseData.EMAIL_FIELD;
  843. param[paramChg(EmpBaseData.OFFICETEL_FIELD)].SourceColumn = EmpBaseData.OFFICETEL_FIELD;
  844. param[paramChg(EmpBaseData.OFFICEFAX_FIELD)].SourceColumn = EmpBaseData.OFFICEFAX_FIELD;
  845. param[paramChg(EmpBaseData.MOBILE_FIELD)].SourceColumn = EmpBaseData.MOBILE_FIELD;
  846. param[paramChg(EmpBaseData.PROVINCE_FIELD)].SourceColumn = EmpBaseData.PROVINCE_FIELD;
  847. param[paramChg(EmpBaseData.CITY_FIELD)].SourceColumn = EmpBaseData.CITY_FIELD;
  848. param[paramChg(EmpBaseData.DISTRICT_FIELD)].SourceColumn = EmpBaseData.DISTRICT_FIELD;
  849. param[paramChg(EmpBaseData.STREET_FIELD)].SourceColumn = EmpBaseData.STREET_FIELD;
  850. param[paramChg(EmpBaseData.POSTCODE_FIELD)].SourceColumn = EmpBaseData.POSTCODE_FIELD;
  851. param[paramChg(EmpBaseData.TEL1_FIELD)].SourceColumn = EmpBaseData.TEL1_FIELD;
  852. param[paramChg(EmpBaseData.TEL2_FIELD)].SourceColumn = EmpBaseData.TEL2_FIELD;
  853. param[paramChg(EmpBaseData.BIRTHDAY_FIELD)].SourceColumn = EmpBaseData.BIRTHDAY_FIELD;
  854. param[paramChg(EmpBaseData.IDCARDNO_FIELD)].SourceColumn = EmpBaseData.IDCARDNO_FIELD;
  855. param[paramChg(EmpBaseData.NAPLACE_FIELD)].SourceColumn = EmpBaseData.NAPLACE_FIELD;
  856. param[paramChg(EmpBaseData.PARTY_FIELD)].SourceColumn = EmpBaseData.PARTY_FIELD;
  857. param[paramChg(EmpBaseData.EDUCAT1_FIELD)].SourceColumn = EmpBaseData.EDUCAT1_FIELD;
  858. param[paramChg(EmpBaseData.SCHOOL1_FIELD)].SourceColumn = EmpBaseData.SCHOOL1_FIELD;
  859. param[paramChg(EmpBaseData.SPECIAL1_FIELD)].SourceColumn = EmpBaseData.SPECIAL1_FIELD;
  860. param[paramChg(EmpBaseData.GERTIME1_FIELD)].SourceColumn = EmpBaseData.GERTIME1_FIELD;
  861. param[paramChg(EmpBaseData.EDUCAT2_FIELD)].SourceColumn = EmpBaseData.EDUCAT2_FIELD;
  862. param[paramChg(EmpBaseData.SCHOOL2_FIELD)].SourceColumn = EmpBaseData.SCHOOL2_FIELD;
  863. param[paramChg(EmpBaseData.SPECIAL2_FIELD)].SourceColumn = EmpBaseData.SPECIAL2_FIELD;
  864. param[paramChg(EmpBaseData.GERTIME2_FIELD)].SourceColumn = EmpBaseData.GERTIME2_FIELD;
  865. param[paramChg(EmpBaseData.QULI1_FIELD)].SourceColumn = EmpBaseData.QULI1_FIELD;
  866. param[paramChg(EmpBaseData.QULI2_FIELD)].SourceColumn = EmpBaseData.QULI2_FIELD;
  867. param[paramChg(EmpBaseData.QULI3_FIELD)].SourceColumn = EmpBaseData.QULI3_FIELD;
  868. param[paramChg(EmpBaseData.QULI4_FIELD)].SourceColumn = EmpBaseData.QULI4_FIELD;
  869. param[paramChg(EmpBaseData.ENTERDATE_FIELD)].SourceColumn = EmpBaseData.ENTERDATE_FIELD;
  870. param[paramChg(EmpBaseData.ENTERMODE_FIELD)].SourceColumn = EmpBaseData.ENTERMODE_FIELD;
  871. param[paramChg(EmpBaseData.POSILEVL_FIELD)].SourceColumn = EmpBaseData.POSILEVL_FIELD;
  872. param[paramChg(EmpBaseData.SALALEVL_FIELD)].SourceColumn = EmpBaseData.SALALEVL_FIELD;
  873. param[paramChg(EmpBaseData.ENDOFLAG_FIELD)].SourceColumn = EmpBaseData.ENDOFLAG_FIELD;
  874. param[paramChg(EmpBaseData.HOSPFLAG_FIELD)].SourceColumn = EmpBaseData.HOSPFLAG_FIELD;
  875. param[paramChg(EmpBaseData.HOUSFLAG_FIELD)].SourceColumn = EmpBaseData.HOUSFLAG_FIELD;
  876. param[paramChg(EmpBaseData.GRAVFLAG_FIELD)].SourceColumn = EmpBaseData.GRAVFLAG_FIELD;
  877. param[paramChg(EmpBaseData.UNEMFLAG_FIELD)].SourceColumn = EmpBaseData.UNEMFLAG_FIELD;
  878. param[paramChg(EmpBaseData.WELNOTE_FIELD)].SourceColumn = EmpBaseData.WELNOTE_FIELD;
  879. param[paramChg(EmpBaseData.PERSNOTE_FIELD)].SourceColumn = EmpBaseData.PERSNOTE_FIELD;
  880. return command;
  881. }
  882. public void Dispose()
  883. {
  884. Dispose(true);
  885. GC.SuppressFinalize(true);
  886. }
  887. protected virtual void Dispose(bool disposing)
  888. {
  889. }
  890. public MrBaseInf()
  891. {
  892. conStr = System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString");
  893. con = new SqlConnection(conStr);
  894. commandAdp = new SqlDataAdapter();
  895. }
  896. }
  897. }