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
{
///
/// 最后更新时间管理类
///
public class LastUpdateTimeManager
{
private const string _fileName = "LastUpdateTimeList.dll";
public static LastUpdateTimeType updateTimeType { get; set; }
///
/// 保存最后更新时间列表文件
///
///
///
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(path, resx, null, true);
}
///
/// 获取最后更新时间列表信息
///
///
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(path).FirstOrDefault();
}
///
/// 获取描述
///
///
///
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);
}
}
///
/// 初始化最后更新时间列表
///
public static void InitLastUpdateTimeType()
{
updateTimeType = GetLastUpdateTimeType();
}
///
/// 保存并设置最后更新时间列表
///
///
///
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
///
/// 枚举常量字典最后更新时间
///
public long DirctionaryUTime { get; set; }
///
/// 错误码字典最后更新时间
///
public long ErrorcodeUTime { get; set; }
///
/// 市场更新时间
///
public long MarketsUTime { get; set; }
///
/// 商品更新时间
///
public long GoodsUTime { get; set; }
///
/// 终端配置参数更新时间
///
public long ConfigUTime { get; set; }
///
/// 风险提示更新时间
///
public long RiskMsgUTime { get; set; }
///
/// 市场运行计划更新时间
///
public long MarketRunSectiionUTime { get; set; }
///
/// 交易日/根据交易日获取市场的当日运行计划
///
public string TradeDate { get; set; }
///
/// 资源内容
///
public Hashtable ResourceHashtable { get; set; }
}
}