LastUpdateTimeManager.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using Muchinfo.PC.Common.Bosn;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Text;
  8. namespace Muchinfo.MTPClient.Resources
  9. {
  10. /// <summary>
  11. /// 最后更新时间管理类
  12. /// </summary>
  13. public class LastUpdateTimeManager
  14. {
  15. private const string _fileName = "LastUpdateTimeList.dll";
  16. public static LastUpdateTimeType updateTimeType { get; set; }
  17. /// <summary>
  18. /// 保存最后更新时间列表文件
  19. /// </summary>
  20. /// <param name="hastableResx"></param>
  21. /// <param name="ver"></param>
  22. public static void SaveLastUpdateTimeType(Hashtable hastableResx, long DirctionaryUTime, long ErrorcodeUTime, long MarketsUTime, long GoodsUTime, long ConfigUTime, long RiskMsgUTime, string TradeDate)
  23. {
  24. var resx = new LastUpdateTimeType() { ResourceHashtable = hastableResx, DirctionaryUTime = DirctionaryUTime, ErrorcodeUTime = ErrorcodeUTime, MarketsUTime = MarketsUTime, GoodsUTime = GoodsUTime, ConfigUTime = ConfigUTime, RiskMsgUTime = RiskMsgUTime, TradeDate = TradeDate };
  25. string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _fileName);
  26. JsonHelper.SaveData<LastUpdateTimeType>(path, resx, null, true);
  27. }
  28. /// <summary>
  29. /// 获取最后更新时间列表信息
  30. /// </summary>
  31. /// <returns></returns>
  32. public static LastUpdateTimeType GetLastUpdateTimeType()
  33. {
  34. var resx = new LastUpdateTimeType() { };
  35. string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _fileName);
  36. if (!File.Exists(path))
  37. return resx;
  38. return JsonHelper.LoadData<LastUpdateTimeType>(path).FirstOrDefault();
  39. }
  40. /// <summary>
  41. /// 获取描述
  42. /// </summary>
  43. /// <param name="keyType"></param>
  44. /// <returns></returns>
  45. public static string GetLastUpdateTimeTypeDesc(string keyType)
  46. {
  47. if (updateTimeType != null && updateTimeType.ResourceHashtable != null &&
  48. updateTimeType.ResourceHashtable.ContainsKey(keyType))
  49. {
  50. return updateTimeType.ResourceHashtable[keyType] as string;
  51. }
  52. else
  53. {
  54. return Client_Resource.ResourceManager.GetString(keyType);
  55. }
  56. }
  57. /// <summary>
  58. /// 初始化最后更新时间列表
  59. /// </summary>
  60. public static void InitLastUpdateTimeType()
  61. {
  62. updateTimeType = GetLastUpdateTimeType();
  63. }
  64. /// <summary>
  65. /// 保存并设置最后更新时间列表
  66. /// </summary>
  67. /// <param name="resxHashtable"></param>
  68. /// <param name="ver"></param>
  69. public static void SaveAndSetting(Hashtable resxHashtable, long DirctionaryUTime, long ErrorcodeUTime, long MarketsUTime, long GoodsUTime, long ConfigUTime, long RiskMsgUTime, string TradeDate)
  70. {
  71. updateTimeType = new LastUpdateTimeType() { ResourceHashtable = resxHashtable, DirctionaryUTime = DirctionaryUTime, ErrorcodeUTime = ErrorcodeUTime, MarketsUTime = MarketsUTime, GoodsUTime = GoodsUTime, ConfigUTime = ConfigUTime, RiskMsgUTime = RiskMsgUTime, TradeDate = TradeDate };
  72. SaveLastUpdateTimeType(resxHashtable, DirctionaryUTime, ErrorcodeUTime, MarketsUTime, GoodsUTime, ConfigUTime, RiskMsgUTime, TradeDate);
  73. }
  74. }
  75. public class LastUpdateTimeType
  76. {
  77. #region 字段备注
  78. //DirctionaryUTime 枚举常量字典最后更新时间 uint64
  79. //ErrorcodeUTime 错误码字典最后更新时间 uint64
  80. //MarketsUTime 市场更新时间 uint64
  81. //GoodsUTime 商品更新时间 uint64
  82. //ConfigUTime 终端配置参数更新时间 uint64
  83. //RiskMsgUTime 风险协议书更新时间 uint64
  84. //TradeDate 交易日 string 终端根据交易日获取市场的当日运行计划
  85. #endregion
  86. /// <summary>
  87. /// 枚举常量字典最后更新时间
  88. /// </summary>
  89. public long DirctionaryUTime { get; set; }
  90. /// <summary>
  91. /// 错误码字典最后更新时间
  92. /// </summary>
  93. public long ErrorcodeUTime { get; set; }
  94. /// <summary>
  95. /// 市场更新时间
  96. /// </summary>
  97. public long MarketsUTime { get; set; }
  98. /// <summary>
  99. /// 商品更新时间
  100. /// </summary>
  101. public long GoodsUTime { get; set; }
  102. /// <summary>
  103. /// 终端配置参数更新时间
  104. /// </summary>
  105. public long ConfigUTime { get; set; }
  106. /// <summary>
  107. /// 风险提示更新时间
  108. /// </summary>
  109. public long RiskMsgUTime { get; set; }
  110. /// <summary>
  111. /// 市场运行计划更新时间
  112. /// </summary>
  113. public long MarketRunSectiionUTime { get; set; }
  114. /// <summary>
  115. /// 交易日/根据交易日获取市场的当日运行计划
  116. /// </summary>
  117. public string TradeDate { get; set; }
  118. /// <summary>
  119. /// 资源内容
  120. /// </summary>
  121. public Hashtable ResourceHashtable { get; set; }
  122. }
  123. }