UnLockTableExcutor.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.DBA.DBModle;
  8. using JLHHJSvr.Helper;
  9. using JLHHJSvr.LJException;
  10. using LJLib.DAL.SQL;
  11. using LJLib.Net.SPI.Server;
  12. using LJLib.SQLEX;
  13. namespace JLHHJSvr.Excutor
  14. {
  15. internal sealed class UnLockTableExcutor : ExcutorBase<UnLockTableRequest, UnLockTableResponse>
  16. {
  17. protected override void ExcuteInternal(UnLockTableRequest request, object state, UnLockTableResponse rslt)
  18. {
  19. var tokendata = BllHelper.GetToken(request.token);
  20. using (var con = GlobalVar.ConnectionString.NewSqlConnection())
  21. using (var cmd = con.CreateCommand())
  22. {
  23. con.Open();
  24. var user = new u_user_jlhprice() { empid = tokendata.empid };
  25. DbSqlHelper.SelectOne(cmd, user, "usermode");
  26. byte is_admin = 0;
  27. if (tokendata.empid == 0) is_admin = 1;
  28. else if (user.usermode == 0) is_admin = 1;
  29. using (cmd.Transaction = con.BeginTransaction())
  30. {
  31. try
  32. {
  33. LockHelper.UnLockBill(cmd, request.keyword, request.billid, tokendata.username, is_admin);
  34. cmd.Transaction.Commit();
  35. }
  36. catch (Exception e)
  37. {
  38. cmd.Transaction?.Rollback();
  39. rslt.ErrMsg = e.Message;
  40. }
  41. }
  42. }
  43. }
  44. }
  45. }