SaveSoftBedQuoteExcutor.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using JLHHJSvr.BLL;
  3. using JLHHJSvr.Com;
  4. using JLHHJSvr.Helper;
  5. using LJLib.Net.SPI.Server;
  6. using LJLib.SQLEX;
  7. namespace JLHHJSvr.Excutor
  8. {
  9. internal sealed class SaveSoftBedQuoteExcutor : ExcutorBase<SaveSoftBedQuoteRequest, SaveSoftBedQuoteResponse>
  10. {
  11. protected override void ExcuteInternal(SaveSoftBedQuoteRequest request, object state, SaveSoftBedQuoteResponse rslt)
  12. {
  13. var tokendata = BllHelper.GetToken(request.token);
  14. if (tokendata == null)
  15. {
  16. rslt.ErrMsg = "会话已经中断,请重新登录";
  17. return;
  18. }
  19. using (var con = GlobalVar.ConnectionString.NewSqlConnection())
  20. using (var cmd = con.CreateCommand())
  21. {
  22. con.Open();
  23. var softBedHelper = HelperBase.GetHelper<SoftBedHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
  24. using (cmd.Transaction = con.BeginTransaction())
  25. {
  26. try
  27. {
  28. softBedHelper.SaveSoftBed(request.softbed);
  29. cmd.Transaction.Commit();
  30. }
  31. catch (Exception e)
  32. {
  33. cmd.Transaction?.Rollback();
  34. rslt.ErrMsg = e.ToString();
  35. }
  36. }
  37. }
  38. }
  39. }
  40. }