GetSysUserFileStringExcutor.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.SqlClient;
  4. using System.Diagnostics;
  5. using System.IO;
  6. using System.IO.Compression;
  7. using System.Linq;
  8. using System.Text;
  9. using JLHHJSvr.BLL;
  10. using JLHHJSvr.Com;
  11. using JLHHJSvr.DBA.DBModle;
  12. using LJLib.Net.SPI.Server;
  13. using PhoneUI.BLL.L1BLL;
  14. namespace JLHHJSvr.Excutor
  15. {
  16. internal sealed class GetSysUserFileStringExcutor : ExcutorBase<GetSysUserFileStringRequest, GetSysUserFileStringResponse>
  17. {
  18. protected override void ExcuteInternal(GetSysUserFileStringRequest request, object state, GetSysUserFileStringResponse rslt)
  19. {
  20. if (request.empid == null)
  21. {
  22. rslt.ErrMsg = "参数错误,empid不能为null";
  23. return;
  24. }
  25. if (request.dwname == null)
  26. {
  27. rslt.ErrMsg = "参数错误,dwname不能为null";
  28. return;
  29. }
  30. if (request.itemname == null)
  31. {
  32. rslt.ErrMsg = "参数错误,itemname不能为null";
  33. return;
  34. }
  35. var tokendata = BllHelper.GetToken(request.token);
  36. if (tokendata == null)
  37. {
  38. rslt.ErrMsg = "会话已经中断";
  39. return;
  40. }
  41. //if (string.IsNullOrEmpty(tokendata.ConStr))
  42. //{
  43. // rslt.ErrMsg = "当前账套未设置数据库";
  44. // return;
  45. //}
  46. using (var con = new SqlConnection(GlobalVar.ConnectionString))
  47. using (var cmd = con.CreateCommand())
  48. {
  49. con.Open();
  50. var ufs = HelperBase.GetHelper<SysUserFileString>(cmd);
  51. if (request.empid.Value == -1)
  52. {
  53. rslt.itemvalue = ufs.getSystemLayout(request.dwname, request.itemname, request.ifcompress);
  54. }
  55. else
  56. {
  57. rslt.itemvalue = ufs.GetValue(request.empid.Value, request.dwname, request.itemname, string.Empty, request.ifcompress == 1 ? true : false);
  58. }
  59. if (string.IsNullOrEmpty(rslt.itemvalue))//如果没有自己的布局方案,尝试获取系统的布局方案
  60. {
  61. rslt.itemvalue = ufs.getSystemLayout(request.dwname, request.itemname, request.ifcompress);
  62. }
  63. if (request.ifdel != null && request.ifdel == 1)
  64. {
  65. ufs.delLayout(tokendata.empid, request.dwname, request.itemname);
  66. }
  67. }
  68. }
  69. }
  70. }