AuditBedNetExcutor.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Data.SqlClient;
  3. using System.Linq;
  4. using JLHHJSvr.BLL;
  5. using JLHHJSvr.Com;
  6. using JLHHJSvr.Com.Model;
  7. using JLHHJSvr.Helper;
  8. using JLHHJSvr.LJException;
  9. using LJLib.DAL.SQL;
  10. using LJLib.Net.SPI.Server;
  11. using LJLib.SQLEX;
  12. namespace JLHHJSvr.Excutor
  13. {
  14. internal sealed class AuditBedNetExcutor : ExcutorBase<AuditBedNetRequest, AuditBedNetResponse>
  15. {
  16. protected override void ExcuteInternal(AuditBedNetRequest request, object state, AuditBedNetResponse rslt)
  17. {
  18. var tokendata = BllHelper.GetToken(request.token);
  19. if (tokendata == null)
  20. {
  21. rslt.ErrMsg = "会话已经中断,请重新登录";
  22. return;
  23. }
  24. if (!request.list.Any())
  25. {
  26. rslt.ErrMsg = "至少提交一条需要审核的记录";
  27. return;
  28. }
  29. using (var con = GlobalVar.ConnectionString.NewSqlConnection())
  30. using (var cmd = con.CreateCommand())
  31. {
  32. con.Open();
  33. var bednetHelper = HelperBase.GetHelper<BedNetHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
  34. using (cmd.Transaction = con.BeginTransaction())
  35. {
  36. try
  37. {
  38. foreach (var bill in request.list)
  39. {
  40. if (request.type == 1)
  41. {
  42. bednetHelper.BedNetAudit(bill.bednetid.Value);
  43. }
  44. else
  45. {
  46. bednetHelper.BedNetCAudit(bill.bednetid.Value);
  47. }
  48. }
  49. cmd.Transaction.Commit();
  50. }
  51. catch (Exception e)
  52. {
  53. cmd.Transaction?.Rollback();
  54. rslt.ErrMsg = e.Message;
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }