BizComponent_MFN.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. //using MediII.Adapter.BaseBiz;
  6. using MediII.Common;
  7. using Microsoft.Practices.EnterpriseLibrary.Data;
  8. using MediII.Adapter.BizComponent.Base;
  9. namespace MediII.Adapter.BizComponent.MFN
  10. {
  11. public class BizComponent_MFN : BaseBizComponent, IBizComponent
  12. {
  13. //数据库连接
  14. protected Database ctx
  15. {
  16. get { return base.HealthCarectx; }
  17. }
  18. protected Database healthCarectx
  19. {
  20. get { return base.HealthCarectx; }
  21. }
  22. public override string DoProcess(string m,string msgType)
  23. {
  24. //只插入数据后续处理
  25. //SyncInsert(m);
  26. try
  27. {
  28. try
  29. {
  30. //根据不同的类型再分开不同的类处理
  31. MFNBase processor = MFNBase.GetProcessor(msgType.Replace('^', '_'), ctx);//
  32. int result = processor.Process(m,msgType);
  33. return string.Empty;
  34. //string ack = SetACK(m, "ACK", mType, "ACK");
  35. //return ack;
  36. }
  37. catch (Exception ex)
  38. {
  39. if (ex.InnerException == null)
  40. {
  41. return ex.Message;
  42. }
  43. else
  44. {
  45. return ex.Message + " InnerException:" + ex.InnerException.Message;
  46. }
  47. }
  48. }
  49. catch (Exception ex)
  50. {
  51. //var tmp = ex.EntityValidationErrors.FirstOrDefault().ValidationErrors;
  52. //string errString = "";
  53. //foreach (var item in tmp)
  54. //{
  55. // errString += item.ErrorMessage;
  56. //}
  57. //string ack = SetACK(m, "ACK", mType, "ACK", ex.EntityValidationErrors.ToString());
  58. //throw new Exception(string.Format("{0}\r\n{1}", ex.EntityValidationErrors.ToString()));
  59. return ex.Message;
  60. }
  61. }
  62. }
  63. }