SystemParamManager.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Muchinfo.MTPClient.Data.Model;
  6. namespace Muchinfo.MTPClient.Infrastructure.Utilities
  7. {
  8. public class SystemParamManager
  9. {
  10. /// <summary>
  11. /// 系统参数配置
  12. /// </summary>
  13. /// <value>The parameter configs.</value>
  14. public static List<ConfigInfoModel> ParamConfigs { get; set; }
  15. /// <summary>
  16. /// 风险率计算公式
  17. /// </summary>
  18. /// <value>The risk ratio calculate mode.</value>
  19. public static eRiskRateMode RiskRatioCalcMode
  20. {
  21. get
  22. {
  23. if (ParamConfigs == null) return eRiskRateMode.OCCUPYWORTH;
  24. var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "132");
  25. //默认使用占用/净值
  26. if( param == null || param.ParamValue == "1") return eRiskRateMode.OCCUPYWORTH;
  27. return eRiskRateMode.WORTHOCCUPY;
  28. }
  29. }
  30. /// <summary>
  31. /// 首次登录是否强制修改密码
  32. /// </summary>
  33. /// <value><c>true</c> if this instance is force modify; otherwise, <c>false</c>.</value>
  34. public static bool IsForceModify
  35. {
  36. get
  37. {
  38. if (ParamConfigs == null) return false;
  39. var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "976");
  40. //默认强制修改密码
  41. if (param == null || param.ParamValue == "1") return true;
  42. return false;
  43. }
  44. }
  45. /// <summary>
  46. /// 浮动盈利是否可用
  47. /// </summary>
  48. /// <value><c>true</c> if this instance is float pl avaliabled; otherwise, <c>false</c>.</value>
  49. public static bool IsFloatPLAvaliabled
  50. {
  51. get
  52. {
  53. if (ParamConfigs == null) return false;
  54. var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "113");
  55. if (param == null) return false;
  56. if (param.ParamValue == "1") return true;
  57. return false;
  58. }
  59. }
  60. /// <summary>
  61. /// 是否允许客户端下止损止盈
  62. /// </summary>
  63. /// <value><c>true</c> if this instance is SPSL avaliabled; otherwise, <c>false</c>.</value>
  64. public static bool IsCanSPSL
  65. {
  66. get
  67. {
  68. //if (ParamConfigs == null) return false;
  69. //var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "144");
  70. //if (param == null) return false;
  71. //if (param.ParamValue != "jkd") return true; // 交易所标识不是金口袋时可用
  72. return false;
  73. }
  74. }
  75. /// <summary>
  76. /// 是否允许客户端一键强平
  77. /// </summary>
  78. /// <value><c>true</c> if this instance is CanOneKeyAllClose avaliabled; otherwise, <c>false</c>.</value>
  79. public static bool IsCanOneKeyAllClose
  80. {
  81. get
  82. {
  83. if (ParamConfigs == null) return false;
  84. var param = ParamConfigs.FirstOrDefault(z => z.ParamCode == "144");
  85. if (param == null) return false;
  86. if (param.ParamValue != "jkd") return true;
  87. return false;
  88. }
  89. }
  90. public static double getChannelSuperPoint
  91. {
  92. get
  93. {
  94. if (ParamConfigs == null) return 1;
  95. var param = ParamConfigs.FirstOrDefault(i => i.ParamCode == "148");
  96. if (param == null) return 1;
  97. return Convert.ToDouble(param.ParamValue);
  98. }
  99. }
  100. public static string GetManageUrl
  101. {
  102. get
  103. {
  104. if (ParamConfigs == null) return "";
  105. var param = ParamConfigs.FirstOrDefault(i => i.ParamCode == "5035");
  106. if (param == null) return "";
  107. return Convert.ToString(param.ParamValue);
  108. }
  109. }
  110. }
  111. }