| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using Muchinfo.PC.Common.Bosn;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- namespace Muchinfo.MTPClient.Resources
- {
- /// <summary>
- /// 最后更新时间管理类
- /// </summary>
- public class LastUpdateTimeManager
- {
- private const string _fileName = "LastUpdateTimeList.dll";
- public static LastUpdateTimeType updateTimeType { get; set; }
- /// <summary>
- /// 保存最后更新时间列表文件
- /// </summary>
- /// <param name="hastableResx"></param>
- /// <param name="ver"></param>
- public static void SaveLastUpdateTimeType(Hashtable hastableResx, long DirctionaryUTime, long ErrorcodeUTime, long MarketsUTime, long GoodsUTime, long ConfigUTime, long RiskMsgUTime, string TradeDate)
- {
- var resx = new LastUpdateTimeType() { ResourceHashtable = hastableResx, DirctionaryUTime = DirctionaryUTime, ErrorcodeUTime = ErrorcodeUTime, MarketsUTime = MarketsUTime, GoodsUTime = GoodsUTime, ConfigUTime = ConfigUTime, RiskMsgUTime = RiskMsgUTime, TradeDate = TradeDate };
- string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _fileName);
- JsonHelper.SaveData<LastUpdateTimeType>(path, resx, null, true);
- }
- /// <summary>
- /// 获取最后更新时间列表信息
- /// </summary>
- /// <returns></returns>
- public static LastUpdateTimeType GetLastUpdateTimeType()
- {
- var resx = new LastUpdateTimeType() { };
- string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _fileName);
- if (!File.Exists(path))
- return resx;
- return JsonHelper.LoadData<LastUpdateTimeType>(path).FirstOrDefault();
- }
- /// <summary>
- /// 获取描述
- /// </summary>
- /// <param name="keyType"></param>
- /// <returns></returns>
- public static string GetLastUpdateTimeTypeDesc(string keyType)
- {
- if (updateTimeType != null && updateTimeType.ResourceHashtable != null &&
- updateTimeType.ResourceHashtable.ContainsKey(keyType))
- {
- return updateTimeType.ResourceHashtable[keyType] as string;
- }
- else
- {
- return Client_Resource.ResourceManager.GetString(keyType);
- }
- }
- /// <summary>
- /// 初始化最后更新时间列表
- /// </summary>
- public static void InitLastUpdateTimeType()
- {
- updateTimeType = GetLastUpdateTimeType();
- }
- /// <summary>
- /// 保存并设置最后更新时间列表
- /// </summary>
- /// <param name="resxHashtable"></param>
- /// <param name="ver"></param>
- public static void SaveAndSetting(Hashtable resxHashtable, long DirctionaryUTime, long ErrorcodeUTime, long MarketsUTime, long GoodsUTime, long ConfigUTime, long RiskMsgUTime, string TradeDate)
- {
- updateTimeType = new LastUpdateTimeType() { ResourceHashtable = resxHashtable, DirctionaryUTime = DirctionaryUTime, ErrorcodeUTime = ErrorcodeUTime, MarketsUTime = MarketsUTime, GoodsUTime = GoodsUTime, ConfigUTime = ConfigUTime, RiskMsgUTime = RiskMsgUTime, TradeDate = TradeDate };
- SaveLastUpdateTimeType(resxHashtable, DirctionaryUTime, ErrorcodeUTime, MarketsUTime, GoodsUTime, ConfigUTime, RiskMsgUTime, TradeDate);
- }
- }
- public class LastUpdateTimeType
- {
- #region 字段备注
- //DirctionaryUTime 枚举常量字典最后更新时间 uint64
- //ErrorcodeUTime 错误码字典最后更新时间 uint64
- //MarketsUTime 市场更新时间 uint64
- //GoodsUTime 商品更新时间 uint64
- //ConfigUTime 终端配置参数更新时间 uint64
- //RiskMsgUTime 风险协议书更新时间 uint64
- //TradeDate 交易日 string 终端根据交易日获取市场的当日运行计划
- #endregion
- /// <summary>
- /// 枚举常量字典最后更新时间
- /// </summary>
- public long DirctionaryUTime { get; set; }
- /// <summary>
- /// 错误码字典最后更新时间
- /// </summary>
- public long ErrorcodeUTime { get; set; }
- /// <summary>
- /// 市场更新时间
- /// </summary>
- public long MarketsUTime { get; set; }
- /// <summary>
- /// 商品更新时间
- /// </summary>
- public long GoodsUTime { get; set; }
- /// <summary>
- /// 终端配置参数更新时间
- /// </summary>
- public long ConfigUTime { get; set; }
- /// <summary>
- /// 风险提示更新时间
- /// </summary>
- public long RiskMsgUTime { get; set; }
- /// <summary>
- /// 市场运行计划更新时间
- /// </summary>
- public long MarketRunSectiionUTime { get; set; }
- /// <summary>
- /// 交易日/根据交易日获取市场的当日运行计划
- /// </summary>
- public string TradeDate { get; set; }
- /// <summary>
- /// 资源内容
- /// </summary>
- public Hashtable ResourceHashtable { get; set; }
- }
- }
|