BizComponent_DFT.cs 22 KB

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