GetDwLayoutExcutor.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. namespace JLHHJSvr.Excutor
  13. {
  14. internal sealed class GetDwLayoutExcutor : ExcutorBase<GetDwLayoutRequest, GetDwLayoutResponse>
  15. {
  16. protected override void ExcuteInternal(GetDwLayoutRequest request, object state, GetDwLayoutResponse rslt)
  17. {
  18. var tokendata = BllHelper.GetToken(request.token);
  19. if (tokendata == null)
  20. {
  21. rslt.ErrMsg = "会话已中断";
  22. return;
  23. }
  24. rslt.layout = new FxUserDwlayout();
  25. using (var con = new SqlConnection(GlobalVar.ConnectionString))
  26. using (var cmd = con.CreateCommand())
  27. {
  28. con.Open();
  29. var whereStr = "userid = @userid and dwname = @dwname";
  30. var parms = new Dictionary<string, object>()
  31. {
  32. {"@userid", tokendata.userid},
  33. {"@dwname", request.dwname}
  34. };
  35. var layout = new FxUserDwlayout();
  36. try
  37. {
  38. if (DbSqlHelper.SelectOne(cmd, "fx_user_dwlayout", whereStr, parms, layout, "column_visible,column_width,column_x,column_autosize,column_detail_height") == 1)
  39. {
  40. rslt.layout = layout;
  41. }
  42. }
  43. catch (Exception ex)
  44. {
  45. Trace.Write(ex.ToString());
  46. }
  47. }
  48. }
  49. }
  50. }