BizComponent_PMU.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. using System;
  2. using System.Data;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. //using MediII.Adapter.BaseBiz;
  7. using System.Data.Common;
  8. using System.Transactions;
  9. using Microsoft.Practices.EnterpriseLibrary.Data;
  10. //using MediII.Adapter.Model.UE;
  11. using System.Globalization;
  12. using MediII.Adapter.BizComponent.Base;
  13. using IL.Common;
  14. using System.Xml;
  15. namespace MediII.Adapter.BizComponent.PMU
  16. {
  17. public class BizComponent_PMU : BaseBizComponent, IBizComponent
  18. {
  19. const string Insert = "B01"; //增加个人纪录
  20. //const string Update = "B02"; //更新个人记录
  21. //const string Delete = "B03"; //删除个人记录
  22. //数据库连接
  23. protected Database ctx
  24. {
  25. get { return base.HealthCarectx; }
  26. }
  27. public BizComponent_PMU()
  28. {
  29. }
  30. ////HealthCareContainer HealthCareContainer = new HealthCareContainer();
  31. //private Database ctx = null;
  32. //public BizComponent_PMU(Database dbCtx)
  33. //{
  34. // ctx = dbCtx;
  35. //}
  36. public override string DoProcess(string m, string msgType)
  37. {
  38. string strMsgType = null;
  39. //try
  40. //{
  41. //try
  42. // {
  43. //取得消息类型 MAD新增 MUP更新 MDL删除 "MDC"作废 "MAC"恢复
  44. OperateXmlUtil helper = new OperateXmlUtil();
  45. string qurysql = "select count(*) from dbo.his_doct where DOCT_CODE=@DOCT_CODE";
  46. DbCommand command = ctx.GetSqlStringCommand(qurysql.ToString());
  47. string pkid = helper.XpathRead(m, "//*[@root='2.16.156.10011.1.4']", "extension");
  48. ctx.AddInParameter(command, "DOCT_CODE", System.Data.DbType.String, pkid);
  49. int counts = Convert.ToInt32(ctx.ExecuteScalar(command));
  50. using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
  51. {
  52. //for (int i = 0; i < pmuB01.EDURepetitionsUsed; i++)
  53. //{
  54. if (counts == 0)
  55. {
  56. //没有查询到记录则新增,否则修改
  57. AddData(m, pkid);
  58. }
  59. else
  60. {
  61. UpDateData(m, pkid);
  62. }
  63. scope.Complete();
  64. }
  65. return string.Empty;
  66. }
  67. public void AddData(string message, string id)
  68. {
  69. #region 新增
  70. string sql = @"INSERT INTO dbo.his_doct
  71. ( DOCT_CODE ,
  72. DOCT_NAME ,
  73. HIS_DEPT_CODE ,
  74. HIS_DEPT_NAME ,
  75. status
  76. )
  77. VALUES ( @DOCT_CODE,
  78. @DOCT_NAME ,
  79. @HIS_DEPT_CODE ,
  80. @HIS_DEPT_NAME ,
  81. @status)";
  82. DbCommand command = ctx.GetSqlStringCommand(sql.ToString());
  83. SetEntity(message, command, id);
  84. SqlDataAccess.ExecuteNonQuery(ctx, command);
  85. #endregion
  86. }
  87. public void UpDateData(string message, string id)
  88. {
  89. #region 修改
  90. string sql1 = @"update dbo.his_doct set
  91. DOCT_NAME =@DOCT_NAME,
  92. HIS_DEPT_CODE =@HIS_DEPT_CODE,
  93. HIS_DEPT_NAME =@HIS_DEPT_NAME,
  94. status=@status
  95. where DOCT_CODE=@DOCT_CODE";
  96. DbCommand command1 = ctx.GetSqlStringCommand(sql1.ToString());
  97. SetEntity(message, command1, id);
  98. SqlDataAccess.ExecuteNonQuery(ctx, command1);
  99. #endregion
  100. }
  101. public void SetEntity(string message, DbCommand command, string id)
  102. {
  103. string value = string.Empty;
  104. OperateXmlUtil xmlHelper = new OperateXmlUtil();
  105. ctx.AddInParameter(command, "DOCT_CODE", System.Data.DbType.String, id);
  106. var valueNode = xmlHelper.XpathRead(message, "//*[name()='healthCarePrincipalPerson']").Item(0);
  107. foreach (XmlNode xe in valueNode.ChildNodes)
  108. {
  109. if (xe.Name == "name")
  110. {
  111. value = xe.LastChild.LastChild.Attributes["value"].Value;
  112. ctx.AddInParameter(command, "DOCT_NAME", System.Data.DbType.String, value);
  113. break;
  114. }
  115. }
  116. value = xmlHelper.XpathRead(message, "//*[@root='2.16.156.10011.1.26']", "extension");
  117. ctx.AddInParameter(command, "HIS_DEPT_CODE", System.Data.DbType.AnsiString, value);
  118. valueNode = xmlHelper.XpathRead(message, "//*[name()='affiliatedPrincipalOrganization']").Item(0);
  119. foreach (XmlNode xe in valueNode.ChildNodes)
  120. {
  121. if (xe.Name == "name")
  122. {
  123. value = xe.LastChild.LastChild.Attributes["value"].Value;
  124. ctx.AddInParameter(command, "HIS_DEPT_NAME", System.Data.DbType.String, value);
  125. break;
  126. }
  127. }
  128. ctx.AddInParameter(command, "status", System.Data.DbType.String, "在用");
  129. //ctx.ExecuteNonQuery(command);
  130. }
  131. public void AddEmpLicense(string type, string pkid, string bm, string updateuser)
  132. {
  133. #region 新增资格编码
  134. var sql = @"INSERT INTO HealthCare.dbo.EmpLicense
  135. ( EmpLicenseID ,
  136. EmpNo ,
  137. LicenseType ,
  138. LicenseClass ,
  139. LicenseNo ,
  140. IsMajor ,
  141. IssueDate ,
  142. StartDate ,
  143. EndDate ,
  144. UpdateUser ,
  145. UpdateTime ,
  146. IsDel
  147. )
  148. VALUES ( NEXT VALUE FOR HealthCare.dbo.Seq_EmpLicense_EmpLicenseID ,
  149. @EmpNo ,
  150. @LicenseType ,
  151. 1 ,
  152. @LicenseNo ,
  153. 0 ,
  154. GETDATE() ,
  155. GETDATE() ,
  156. '2999-12-31 00:00:00.000',
  157. @UpdateUser ,
  158. GETDATE() ,
  159. 0
  160. )";
  161. #endregion
  162. var cmd = SqlDataAccess.GetSqlStringCommand(ctx, sql);
  163. SqlDataAccess.AddInParameter(ctx, cmd, "EmpNo", DbType.AnsiString, pkid);
  164. SqlDataAccess.AddInParameter(ctx, cmd, "LicenseType", DbType.AnsiString, type);
  165. SqlDataAccess.AddInParameter(ctx, cmd, "LicenseNo", DbType.AnsiString, bm);
  166. SqlDataAccess.AddInParameter(ctx, cmd, "UpdateUser", DbType.AnsiString, updateuser);
  167. SqlDataAccess.DBExecuteNonQuery(ctx, cmd);
  168. }
  169. public void UpdateEmpLicense(string type, string pkid, string bm)
  170. {
  171. var sql = @"UPDATE HealthCare.dbo.EmpLicense SET LicenseNo=@LicenseNo WHERE EmpNo=@EmpNo AND LicenseType=@LicenseType ";
  172. var cmd = SqlDataAccess.GetSqlStringCommand(ctx, sql);
  173. SqlDataAccess.AddInParameter(ctx, cmd, "EmpNo", DbType.AnsiString, pkid);
  174. SqlDataAccess.AddInParameter(ctx, cmd, "LicenseType", DbType.AnsiString, type);
  175. SqlDataAccess.AddInParameter(ctx, cmd, "LicenseNo", DbType.AnsiString, bm);
  176. SqlDataAccess.DBExecuteNonQuery(ctx, cmd);
  177. }
  178. public void DeleteEmpLicense(string type, string pkid)
  179. {
  180. var sql = "DELETE FROM HealthCare.dbo.EmpLicense WHERE EmpNo=@EmpNo AND LicenseType=@LicenseType";
  181. var cmd = SqlDataAccess.GetSqlStringCommand(ctx, sql);
  182. SqlDataAccess.AddInParameter(ctx, cmd, "EmpNo", DbType.AnsiString, pkid);
  183. SqlDataAccess.AddInParameter(ctx, cmd, "LicenseType", DbType.AnsiString, type);
  184. SqlDataAccess.DBExecuteNonQuery(ctx, cmd);
  185. }
  186. ///// <summary>
  187. ///// 获取当前时间
  188. ///// </summary>
  189. //internal DateTime GetNow(Database ctx)
  190. //{
  191. // object obj = (DateTime)SqlDataAccess.ExecuteScalar(ctx, CommandType.Text, "select GETDATE()");
  192. // if (obj != null)
  193. // return Convert.ToDateTime(obj.ToString());
  194. // else
  195. // return DateTime.Now;
  196. //}
  197. //获取性别,转化
  198. public string GetSex(string value)
  199. {
  200. string sex = "0";
  201. switch (value)
  202. {
  203. case "F":
  204. sex = "1";//男
  205. break;
  206. case "男":
  207. sex = "1";//男
  208. break;
  209. case "M":
  210. sex = "2";//女
  211. break;
  212. case "女":
  213. sex = "2";//女
  214. break;
  215. default:
  216. sex = "9";//不定
  217. break;
  218. }
  219. return sex;
  220. }
  221. public string GetYsdj(string hiscodeid)
  222. {
  223. var sql = "SELECT CodeID FROM HealthCare.dbo.V_UserLevel WHERE HisCodeID=@HisCodeID";
  224. var cmd = SqlDataAccess.GetSqlStringCommand(ctx, sql);
  225. SqlDataAccess.AddInParameter(ctx, cmd, "HisCodeID", DbType.AnsiString, hiscodeid);
  226. string codeid = StrHelepr.Obj2StrTrim(SqlDataAccess.DBExecuteScalar(ctx, cmd));
  227. if (codeid != null)
  228. {
  229. return codeid;
  230. }
  231. else
  232. {
  233. throw new Exception("V_UserLevel没有找到对应的医生等级");
  234. }
  235. }
  236. public string GetEmpType(string value)
  237. {
  238. string emptype = "";
  239. switch (value) // 员工分类
  240. {
  241. case "1"://1 医生
  242. emptype = "1";
  243. break;
  244. case "2"://2 护士
  245. emptype = "2";
  246. break;
  247. case "3"://3 财务人员
  248. emptype = "3";
  249. break;
  250. case "4"://4 药剂人员
  251. emptype = "4";
  252. break;
  253. case "5"://5 技师(检验)
  254. emptype = "5";
  255. break;
  256. case "6"://6 技师(影像)
  257. emptype = "6";
  258. break;
  259. case "7"://7 管理人员
  260. emptype = "7";
  261. break;
  262. case "8"://8 其他卫生技术人员
  263. emptype = "8";
  264. break;
  265. case "9"://9 其他人员
  266. emptype = "9";
  267. break;
  268. }
  269. return emptype;
  270. }
  271. }
  272. }
  273. #region 此为老版本代码
  274. /*
  275. Employee Module_Employee = new Employee();
  276. strMsgType = pmuB01.EVN.EventTypeCode.Value;
  277. #region STG
  278. STF stf = pmuB01.STF;
  279. Module_Employee.EmpNo = Convert.ToInt16(stf.PrimaryKeyValueSTF.Identifier.Value);// 员工代号
  280. Module_Employee.EmpCode = stf.GetStaffIDCode(0).ID.Value;// 员工代码
  281. Module_Employee.EmpName = stf.GetStaffName(0).GivenName.Value;// 姓名
  282. Module_Employee.EngName = stf.GetStaffName(0).GivenName.Value;// 英文姓名
  283. Module_Employee.IdNo = stf.DriverSLicenseNumberStaff.DriverSLicenseNumber.Value.Trim() ;// 身份证号 <<<<<<<<<<<<<<<<<<<<<< 目前ISNULL
  284. #region 性别转换
  285. // 1:男 2:女
  286. Module_Employee.Sex = His.MediIITransfer.MediII2Ue.GetSex(stf.AdministrativeSex.Value);
  287. #endregion
  288. Module_Employee.Birthday = His.Time.TryParseExact(stf.DateTimeOfBirth.TimeOfAnEvent.Value, "yyyyMMddhhmmss");
  289. #region 婚姻状况
  290. // 婚姻状况 (0:未婚,1:已婚,2:离婚)
  291. switch (stf.MaritalStatus.Text.Value)
  292. {
  293. case "S"://S 独身
  294. case "P"://P 同性恋
  295. case "G"://G 同居
  296. case "B"://B 未婚
  297. case "U"://U 未知
  298. case "O"://O 其他
  299. case "T"://T 未报告
  300. Module_Employee.MaritalStatus = "0";
  301. break;
  302. case "M"://M 结婚
  303. case "A": //A 分居
  304. case "W"://W 丧偶
  305. case "R"://R 已登记同性恋
  306. case "E"://E 合法分居
  307. // case "C"://C 普通法律
  308. case "I"://I 诉讼中
  309. Module_Employee.MaritalStatus = "1";
  310. break;
  311. case "D"://D 离婚
  312. Module_Employee.MaritalStatus = "2";
  313. break;
  314. default:
  315. Module_Employee.MaritalStatus = "0";
  316. break;
  317. }
  318. #endregion
  319. Module_Employee.HomeAdrArea = 0;// 住处区域代码 <<<<<<<<<<<<<<<<<<<<<<<<<<<
  320. Module_Employee.HomeAdrDesc = stf.GetOfficeHomeAddress(0).StreetAddress.StreetOrMailingAddress.Value;// 住处地址
  321. Module_Employee.HomeTel1 = stf.GetPhone(0).PhoneNumber.Value;// 住处电话1
  322. Module_Employee.HomeTel2 = "0"; // 住处电话2(不同步)
  323. Module_Employee.MobilePhone = stf.GetPhone(0).PhoneNumber.Value; // 移动电话
  324. Module_Employee.NativeAdrArea = 0;// 户籍区域代码(不同步)
  325. Module_Employee.NativeAdrDesc = "";// 户籍地址(不同步)
  326. Module_Employee.NativeTel = "";// 户籍电话(不同步)
  327. Module_Employee.ConName = "";// 联系人姓名(不同步)
  328. Module_Employee.ConTel1 = "";// 络人电话(不同步)
  329. Module_Employee.ConTel2 = "";// 络人电话(不同步)
  330. Module_Employee.ConAdrArea = 0;// 联系人区域代码(不同步)
  331. Module_Employee.ConAdrDesc = "";// 联系人地址(不同步)
  332. Module_Employee.Affiliation = "";// 与联系人关系(不同步)
  333. try
  334. {
  335. string sHireDate =stf.GetInstitutionActivationDate(0).Date.TimeOfAnEvent.Value;
  336. DateTime dtHireDate = His.Time.TryParseExact(sHireDate, "yyyyMMddhhmmss");
  337. Module_Employee.HireDate = dtHireDate == His.Time.MaxDateTime ? Convert.ToDateTime("1911-01-01 00:00:00") : dtHireDate; // 到职日期
  338. }
  339. catch
  340. {
  341. Module_Employee.HireDate = Convert.ToDateTime("1911-01-01 00:00:00");
  342. }
  343. Module_Employee.Zone = "A";// 归属院区(联众会开栏位**********)<<<<<<<<<<<<<<<<<<<<<<
  344. string tmp = stf.GetDepartment(0).Identifier.Value;
  345. try
  346. {
  347. string sDepartNo = His.MediIITransfer.MediII2Ue.GetDepartNo(stf.GetDepartment(0).Identifier.Value);
  348. Module_Employee.DepartNo = Convert.ToInt16(sDepartNo);// 部门代码
  349. }
  350. catch (Exception ex)
  351. {
  352. Module_Employee.DepartNo = -1;
  353. }
  354. Module_Employee.EmpType = stf.GetStaffType(0).Value;
  355. #region 员工分类
  356. switch (stf.GetStaffType(0).Value) // 员工分类
  357. {
  358. case "1"://1 医生
  359. Module_Employee.EmpType = "1";
  360. break;
  361. case "2"://2 护士
  362. Module_Employee.EmpType = "2";
  363. break;
  364. case "3"://3 财务人员
  365. Module_Employee.EmpType = "3";
  366. break;
  367. case "4"://4 药剂人员
  368. Module_Employee.EmpType = "4";
  369. break;
  370. case "5"://5 技师(检验)
  371. case "6"://6 技师(影像)
  372. case "7"://7 管理人员
  373. case "8"://8 其他卫生技术人员
  374. case "9"://9 其他人员
  375. Module_Employee.EmpType = "0";
  376. break;
  377. }
  378. #endregion
  379. string tmp2 = stf.JobCodeClass.JobCode.Value;
  380. try
  381. {
  382. Module_Employee.Title = Convert.ToInt16(stf.JobCodeClass.JobCode.Value);// 职称
  383. }
  384. catch (Exception ex)
  385. {
  386. Module_Employee.Title = -1;
  387. }
  388. Module_Employee.ChiefNo = Convert.ToInt16(stf.GetHospitalService(0).Identifier.Value);// 职位
  389. string tmp3 = stf.GetDepartment(0).Identifier.Value;
  390. try
  391. {
  392. string sWorkDepartNo = His.MediIITransfer.MediII2Ue.GetDepartNo(stf.GetDepartment(0).Identifier.Value);
  393. Module_Employee.WorkDepartNo = Convert.ToInt16(sWorkDepartNo);// 工作单位代号 <<<<<<<<<<<<<
  394. }
  395. catch
  396. {
  397. Module_Employee.WorkDepartNo = -1;
  398. }
  399. Module_Employee.SimpleTel = stf.GetPhone(0).PhoneNumber.Value;// 速拨码
  400. Module_Employee.SubTel = stf.GetPhone(0).PhoneNumber.Value;// 分机
  401. string sPassword = stf.GetBackupPersonID(0).Identifier.Value;
  402. Module_Employee.Password = sPassword == null ? "" : sPassword;
  403. Module_Employee.PasswordTime = DateTime.Now; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  404. Module_Employee.PressCard = 0;// 工作卡号(暫時不填)
  405. string sActiveInactiveFlag = stf.ActiveInactiveFlag.Value; // A,在职;I,离职
  406. Module_Employee.ResignDate = sActiveInactiveFlag == "A" ? His.Time.MaxDateTime : His.Time.MaxDateTime;
  407. int iIntParse;
  408. int.TryParse(stf.PreferredMethodOfContact.Identifier.Value, out iIntParse);
  409. if (iIntParse != 0)
  410. {
  411. Module_Employee.UpdateUser = Convert.ToInt16(iIntParse);// 最后修改人
  412. }
  413. Module_Employee.UpdateTime = DateTime.Now;
  414. Module_Employee.EMail = "";// 电子信箱(不同步)
  415. Module_Employee.Remark = "";// 备注说明(不同步)
  416. Module_Employee.Team = 0;// 组别
  417. #endregion
  418. #region 測試
  419. string sErrMsg;
  420. if (string.IsNullOrEmpty(Module_Employee.IdNo))
  421. {
  422. sErrMsg = "【身份证】无法为空";
  423. SetACK(m, "ACK", strMsgType, "ACK", sErrMsg);
  424. }
  425. if (string.IsNullOrEmpty(Module_Employee.HomeAdrDesc))
  426. {
  427. Module_Employee.HomeAdrDesc = "";
  428. }
  429. if (string.IsNullOrEmpty(Module_Employee.HomeTel1))
  430. {
  431. Module_Employee.HomeTel1 = "";
  432. }
  433. if (string.IsNullOrEmpty(Module_Employee.HomeTel1))
  434. {
  435. Module_Employee.HomeTel1 = ""; // 住处电话1
  436. }
  437. if (string.IsNullOrEmpty(Module_Employee.MobilePhone))
  438. {
  439. Module_Employee.MobilePhone = ""; // 移动电话1
  440. }
  441. if (string.IsNullOrEmpty(Module_Employee.MobilePhone))
  442. {
  443. Module_Employee.MobilePhone = ""; // 移动电话1
  444. }
  445. //Module_Employee.HireDate = His.Time.TryParseExact(sHireDate, "yyyyMMdd"); // 到职日期
  446. //Module_Employee.Title = Convert.ToInt16(stf.JobCodeClass.JobCode.Value);// 职称
  447. //Module_Employee.ChiefNo = Convert.ToInt16(stf.GetHospitalService(0).Identifier.Value);// 职位
  448. if (string.IsNullOrEmpty(Module_Employee.MobilePhone))
  449. {
  450. Module_Employee.SimpleTel = "";// 速拨码
  451. }
  452. if (string.IsNullOrEmpty(Module_Employee.MobilePhone))
  453. {
  454. Module_Employee.SubTel = "";// 分机
  455. }
  456. if (string.IsNullOrEmpty(Module_Employee.Password))
  457. {
  458. sErrMsg = "【密碼】无法为空";
  459. SetACK(m, "ACK", strMsgType, "ACK", sErrMsg);
  460. }
  461. //if (Module_Employee.HireDate == DateTime.MinValue)
  462. //{
  463. // Module_Employee.HireDate = His.Time.MaxDateTime;
  464. //}
  465. if (Module_Employee.PasswordTime == DateTime.MinValue)
  466. {
  467. Module_Employee.PasswordTime = His.Time.MaxDateTime;
  468. }
  469. if (Module_Employee.UpdateTime == DateTime.MinValue)
  470. {
  471. Module_Employee.UpdateTime = His.Time.MaxDateTime;
  472. }
  473. if (Module_Employee.ResignDate == DateTime.MinValue)
  474. {
  475. Module_Employee.ResignDate = His.Time.MaxDateTime;
  476. }
  477. //Module_Employee.ResignDate = His.Time.TryParseExact(sResignDate, "yyyyMMdd"); // 离职日期
  478. #endregion
  479. // 開始存入資料庫
  480. int iEmpNo = Convert.ToInt16(stf.PrimaryKeyValueSTF.Identifier.Value);// 员工代号
  481. using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
  482. {
  483. switch (strMsgType)
  484. {
  485. case Insert:
  486. case Update:
  487. EmployeeDelete(iEmpNo, ref HealthCareContainer, scope, ref Module_Employee);
  488. EmployeeInsert(iEmpNo, ref HealthCareContainer, scope, ref Module_Employee);
  489. break;
  490. case Delete:
  491. EmployeeDelete(iEmpNo, ref HealthCareContainer, scope, ref Module_Employee);
  492. break;
  493. }
  494. #region 存入資料庫
  495. try
  496. {
  497. HealthCareContainer.SaveChanges();
  498. }
  499. catch (System.Data.Entity.Validation.DbEntityValidationException ex)
  500. {
  501. scope.Dispose();
  502. throw ex;
  503. }
  504. #endregion
  505. scope.Complete();
  506. }
  507. */
  508. // return string.Empty;
  509. // }
  510. // catch (Exception ex)
  511. // {
  512. // string errMsg = string.Empty;
  513. // if (ex.InnerException == null)
  514. // {
  515. // errMsg = ex.Message + "\r\n" + ex.StackTrace;
  516. // }
  517. // else
  518. // {
  519. // errMsg = ex.Message + "\r\n" + ex.InnerException.Message + "\r\n" + ex.InnerException.StackTrace;
  520. // }
  521. // return errMsg;
  522. // }
  523. //}
  524. // catch (System.Data.Entity.Validation.DbEntityValidationException ex)
  525. //{
  526. //var tmp = ex.EntityValidationErrors.FirstOrDefault().ValidationErrors;
  527. //string errString = "";
  528. //foreach (var item in tmp)
  529. //{
  530. // errString += item.ErrorMessage;
  531. //}
  532. //string ack = SetACK(m, "ACK", mType, "ACK", ex.EntityValidationErrors.ToString());
  533. //throw new Exception(string.Format("{0}\r\n{1}", ex.EntityValidationErrors.ToString()));
  534. //return ex.Message;
  535. //}
  536. //}
  537. /*
  538. public void EmployeeInsert(int iEmpNo, ref HealthCareContainer HealthCareContainer, TransactionScope scope, ref Employee Module_Employee)
  539. {
  540. try
  541. {
  542. HealthCareContainer.Employee.Add(Module_Employee);
  543. }
  544. catch (Exception ex)
  545. {
  546. scope.Dispose();
  547. throw ex;
  548. }
  549. }
  550. public void EmployeeDelete(int iEmpNo, ref HealthCareContainer HealthCareContainer, TransactionScope scope, ref Employee Module_Employee)
  551. {
  552. try
  553. {
  554. IEnumerable<Employee> EmployeeList = HealthCareContainer.Employee.Where(x => x.EmpNo == iEmpNo);
  555. if (EmployeeList.Count() != 0)
  556. {
  557. Employee Module_Employee_Del = EmployeeList.FirstOrDefault();
  558. HealthCareContainer.Employee.Remove(Module_Employee_Del);
  559. HealthCareContainer.SaveChanges();
  560. }
  561. }
  562. catch (Exception ex)
  563. {
  564. scope.Dispose();
  565. throw ex;
  566. }
  567. }
  568. */
  569. // }
  570. //}
  571. #endregion