You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.7 KiB

  1. ///-----------------------------------------------------------------------
  2. /// <copyright file="SystemSettingService.cs" company="Origtek">
  3. /// 程式代號: SystemSettingService
  4. /// 程式名稱: SystemSettingService
  5. /// 程式說明:
  6. /// </copyright>
  7. ///-----------------------------------------------------------------------
  8. namespace CounsellorBL.BLStructure.SYS
  9. {
  10. using CounsellorBL.Common;
  11. using Microsoft.Extensions.Caching.Memory;
  12. using MonumentDefine;
  13. using Newtonsoft.Json.Linq;
  14. using OT.COM.ArsenalDB;
  15. using OT.COM.SignalerMessage;
  16. using SoldierData.EnterprizeV4;
  17. using System.Collections.Generic;
  18. /// <summary>
  19. /// 類別名稱:SystemSettingService
  20. /// 類別說明:
  21. /// </summary>
  22. public class SystemSettingService : SingleDataTableTemplate<tb_sys_system_setting>
  23. {
  24. //const string CACHE_KEY_tb_sys_system_setting = "CACHE_KEY_tb_sys_system_setting";
  25. const string CACHE_KEY_tb_sys_system_setting2 = "CACHE_KEY_tb_sys_system_setting2";
  26. [Auth(false)]
  27. //public new CResponseMessage Read(CRequestMessage i_crmInput) => base.Read(i_crmInput);
  28. public new CResponseMessage Read(CRequestMessage i_crmInput)
  29. {
  30. CResponseMessage crmRes = null;
  31. IMemoryCache imc = GetMemoryCache();
  32. bool bUseBase = true;
  33. try
  34. {
  35. do
  36. {
  37. if (getCommonParameter(i_crmInput, BLWording.QRY_MASTER, out JArray jaDataArray, out tb_sys_session sUserSession) != null)
  38. {
  39. break;
  40. }
  41. if (jaDataArray.Count != 1 || jaDataArray[0] == null)
  42. {
  43. break;
  44. }
  45. JObject joWhere = jaDataArray[0][BLWording.WHEREDATA] as JObject;
  46. if (joWhere == null || joWhere.Count != 0)
  47. {
  48. break;
  49. }
  50. if (imc != null && imc.TryGetValue(CACHE_KEY_tb_sys_system_setting2, out List<tb_sys_system_setting> ul))
  51. {
  52. lock (imc)
  53. {
  54. crmRes = new CSuccessResponseMessage(null, i_crmInput);
  55. crmRes.param.Add(BLWording.DATA, ul);
  56. bUseBase = false;
  57. }
  58. }
  59. }
  60. while (false);
  61. }
  62. catch
  63. {
  64. }
  65. // 填寫回傳
  66. if (bUseBase)
  67. {
  68. crmRes = base.Read(i_crmInput);
  69. }
  70. return crmRes;
  71. }
  72. }
  73. }