UnLockTableExcutor.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 UnLockTableExcutor : ExcutorBase<UnLockTableRequest, UnLockTableResponse>
  15. {
  16. protected override void ExcuteInternal(UnLockTableRequest request, object state, UnLockTableResponse rslt)
  17. {
  18. var tokendata = BllHelper.GetToken(request.token);
  19. if (tokendata == null)
  20. {
  21. rslt.ErrMsg = "会话已经中断,请重新登录";
  22. return;
  23. }
  24. using (var con = GlobalVar.ConnectionString.NewSqlConnection())
  25. using (var cmd = con.CreateCommand())
  26. {
  27. con.Open();
  28. using (cmd.Transaction = con.BeginTransaction())
  29. {
  30. try
  31. {
  32. foreach (var bill in request.lockList)
  33. {
  34. LockHelper.UnLockBill(cmd, bill.keyword, bill.billid, tokendata.username,tokendata.empid == 0 ? (byte)1 : (byte)0);
  35. }
  36. cmd.Transaction.Commit();
  37. }
  38. catch (Exception e)
  39. {
  40. cmd.Transaction.Rollback();
  41. rslt.ErrMsg = e.Message;
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }