using System; using System.Collections.Generic; using System.Linq; using System.Text; using Muchinfo.MTPClient.Data.Model; namespace Muchinfo.MTPClient.Infrastructure.Utilities { public class SystemParamManager { /// /// 系统参数配置 /// /// The parameter configs. public static List ParamConfigs { get; set; } /// /// 风险率计算公式 /// /// The risk ratio calculate mode. public static eRiskRateMode RiskRatioCalcMode { get { if (ParamConfigs == null) return eRiskRateMode.OCCUPYWORTH; var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "132"); //默认使用占用/净值 if( param == null || param.ParamValue == "1") return eRiskRateMode.OCCUPYWORTH; return eRiskRateMode.WORTHOCCUPY; } } /// /// 首次登录是否强制修改密码 /// /// true if this instance is force modify; otherwise, false. public static bool IsForceModify { get { if (ParamConfigs == null) return false; var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "976"); //默认强制修改密码 if (param == null || param.ParamValue == "1") return true; return false; } } /// /// 浮动盈利是否可用 /// /// true if this instance is float pl avaliabled; otherwise, false. public static bool IsFloatPLAvaliabled { get { if (ParamConfigs == null) return false; var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "113"); if (param == null) return false; if (param.ParamValue == "1") return true; return false; } } /// /// 是否允许客户端下止损止盈 /// /// true if this instance is SPSL avaliabled; otherwise, false. public static bool IsCanSPSL { get { //if (ParamConfigs == null) return false; //var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "144"); //if (param == null) return false; //if (param.ParamValue != "jkd") return true; // 交易所标识不是金口袋时可用 return false; } } /// /// 是否允许客户端一键强平 /// /// true if this instance is CanOneKeyAllClose avaliabled; otherwise, false. public static bool IsCanOneKeyAllClose { get { if (ParamConfigs == null) return false; var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "144"); if (param == null) return false; if (param.ParamValue != "jkd") return true; return false; } } public static double getChannelSuperPoint { get { if (ParamConfigs == null) return 1; var param = ParamConfigs.FirstOrDefault(i => i.ParamCode == "148"); if (param == null) return 1; return Convert.ToDouble(param.ParamValue); } } public static string GetManageUrl { get { if (ParamConfigs == null) return ""; var param = ParamConfigs.FirstOrDefault(i => i.ParamCode == "5035"); if (param == null) return ""; return Convert.ToString(param.ParamValue); } } } }