GetSysUserFileStringExcutor.cs 2.6 KB

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