GetDwLayoutExcutor.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.SqlClient;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using System.Text;
  7. using JLHHJSvr.BLL;
  8. using JLHHJSvr.Com;
  9. using JLHHJSvr.Com.Model;
  10. using LJLib.DAL.SQL;
  11. using LJLib.Net.SPI.Server;
  12. using LJLib.SQLEX;
  13. namespace JLHHJSvr.Excutor
  14. {
  15. internal sealed class GetDwLayoutExcutor : ExcutorBase<GetDwLayoutRequest, GetDwLayoutResponse>
  16. {
  17. protected override void ExcuteInternal(GetDwLayoutRequest request, object state, GetDwLayoutResponse rslt)
  18. {
  19. var tokendata = BllHelper.GetToken(request.token);
  20. if (tokendata == null)
  21. {
  22. rslt.ErrMsg = "会话已中断";
  23. return;
  24. }
  25. rslt.layout = new FxUserDwlayout();
  26. using (var con = GlobalVar.ConnectionString.NewSqlConnection())
  27. using (var cmd = con.CreateCommand())
  28. {
  29. con.Open();
  30. var whereStr = "userid = @userid and dwname = @dwname";
  31. var parms = new Dictionary<string, object>()
  32. {
  33. {"@userid", tokendata.userid},
  34. {"@dwname", request.dwname}
  35. };
  36. var layout = new FxUserDwlayout();
  37. try
  38. {
  39. if (DbSqlHelper.SelectOne(cmd, "fx_user_dwlayout", whereStr, parms, layout, "column_visible,column_width,column_x,column_autosize,column_detail_height") == 1)
  40. {
  41. rslt.layout = layout;
  42. }
  43. }
  44. catch (Exception ex)
  45. {
  46. Trace.Write(ex.ToString());
  47. }
  48. }
  49. }
  50. }
  51. }