SetSysUserFileStringExcutor.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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;
  10. using JLHHJSvr.BLL;
  11. using JLHHJSvr.Com;
  12. using JLHHJSvr.DBA.DBModle;
  13. using JLHHJSvr.Helper;
  14. using LJLib.Net.SPI.Server;
  15. using LJLib.SQLEX;
  16. using PhoneUI.BLL.L1BLL;
  17. namespace JLHHJSvr.Excutor
  18. {
  19. internal sealed class SetSysUserFileStringExcutor : ExcutorBase<SetSysUserFileStringRequest, SetSysUserFileStringResponse>
  20. {
  21. protected override void ExcuteInternal(SetSysUserFileStringRequest request, object state, SetSysUserFileStringResponse rslt)
  22. {
  23. if (request.empid == null)
  24. {
  25. rslt.ErrMsg = "参数错误,empid不能为null";
  26. return;
  27. }
  28. if (request.dwname == null)
  29. {
  30. rslt.ErrMsg = "参数错误,dwname不能为null";
  31. return;
  32. }
  33. if (request.itemname == null)
  34. {
  35. rslt.ErrMsg = "参数错误,itemname不能为null";
  36. return;
  37. }
  38. if (request.itemvalue == null)
  39. {
  40. rslt.ErrMsg = "参数错误,itemvalue不能为null";
  41. return;
  42. }
  43. var tokendata = BllHelper.GetToken(request.token);
  44. if (tokendata == null)
  45. {
  46. rslt.ErrMsg = "会话已经中断";
  47. return;
  48. }
  49. //if (string.IsNullOrEmpty(tokendata.ConStr))
  50. //{
  51. // rslt.ErrMsg = "当前账套未设置数据库";
  52. // return;
  53. //}
  54. using (var con = GlobalVar.ConnectionString.NewSqlConnection())
  55. using (var cmd = con.CreateCommand())
  56. {
  57. con.Open();
  58. using (cmd.Transaction = con.BeginTransaction())
  59. {
  60. try
  61. {
  62. //var ufs = HelperBase.GetHelper<SysUserFileString>(cmd);
  63. //var ifok = BllHelper.SetValue(cmd, request.empid.Value, request.dwname, request.itemname, request.itemvalue, request.ifcompress == 1 ? true : false);
  64. //if (!ifok)
  65. //{
  66. // rslt.ErrMsg = "自定义值保存失败,可能数据库字段长度不足";
  67. //}
  68. //if (request.empid == -1)
  69. //{
  70. // BllHelper.delOtherLayout(cmd, request.dwname, request.itemname);
  71. //}
  72. var ufs = HelperBase.GetHelper<SysUserFileString>(cmd);
  73. var ifok = ufs.SetValue(request.empid.Value, request.dwname, request.itemname, request.itemvalue, request.ifcompress == 1 ? true : false);
  74. if (!ifok)
  75. {
  76. rslt.ErrMsg = "自定义值保存失败,可能数据库字段长度不足";
  77. return;
  78. }
  79. if (request.ifdelother == 1)
  80. {
  81. ufs.delOtherLayout(request.dwname, request.itemname);
  82. }
  83. if (request.iffilesave != null && request.iffilesave.Value == 1)
  84. {
  85. ufs.saveSystemLayout(request.itemname, request.itemvalue);
  86. // 记录操作日志
  87. LogHelper logHelper = HelperBase.GetHelper<LogHelper>(cmd);
  88. var logType = "L1WEB操作日志";
  89. var logDscrp = "设置默认布局:ifdelother:" + request.ifdelother + ",itemname:" + request.itemname + ",itemvalue:" + request.itemvalue;
  90. var opEmp = tokendata.username;
  91. logHelper.SetSysoplog(logType, logDscrp, opEmp);
  92. }
  93. if (request.empid != null && request.empid.Value != -1)
  94. {
  95. // 记录操作日志
  96. LogHelper logHelper = HelperBase.GetHelper<LogHelper>(cmd);
  97. var logType = "个性布局操作日志";
  98. var logDscrp = "empid:" + request.empid + ",dwname:" + request.dwname + ",itemname:" + request.itemname + ",itemvalue:" + request.itemvalue + " >>>>> UPDATE sys_user_filestring SET itemvalue = '" + request.itemvalue + "' WHERE empid = " + request.empid + " AND dwname = '" + request.dwname + "' AND itemname = '" + request.itemname + "'";
  99. var opEmp = tokendata.username;
  100. logHelper.SetSysoplog(logType, logDscrp, opEmp);
  101. }
  102. cmd.Transaction.Commit();
  103. }
  104. catch (Exception e)
  105. {
  106. cmd.Transaction.Rollback();
  107. rslt.ErrMsg = e.ToString();
  108. }
  109. }
  110. }
  111. }
  112. }
  113. }