SpecialValueItem.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System.Text;
  2. using TrendChartSDK.Entity.Base;
  3. using TrendChartSDK.Entity.TrendChart;
  4. using TrendChartSDK.Entity.TrendChartData;
  5. using TrendChartSDK.Interface;
  6. namespace TrendChartSDK.TrendChartManager
  7. {
  8. class SpecialValueItem<TEntity> : ChartItemRepository<TEntity>, IChartItem<TEntity> where TEntity : LotteryOpenCode
  9. {
  10. private new int[] _itemIndex;
  11. /// <summary>
  12. /// 初始化
  13. /// </summary>
  14. /// <param name="cssConfig"></param>
  15. /// <param name="itemConfig"></param>
  16. public override void Init(ChartCssConfigInfo cssConfig, TrendChartItemInfo itemConfig)
  17. {
  18. DefaultInit(cssConfig, itemConfig);
  19. }
  20. #region 未用
  21. public override void MissDataInit(TrendChartData TrendChartCofig, int i)
  22. {
  23. }
  24. public override string GetMissData(MissDataType missDataType)
  25. {
  26. return "";
  27. }
  28. #endregion
  29. /// <summary>
  30. /// 设置项值
  31. /// </summary>
  32. /// <param name="entity"></param>
  33. /// <returns></returns>
  34. public override bool SetItemValue(TEntity entity)
  35. {
  36. if (this._ItemIndex == null)
  37. {
  38. this._ItemIndex = new int[this._itemConfig.ItemCount];
  39. }
  40. _itemIndex = new int[this._itemConfig.ItemCount];
  41. return SetSpecialValue(entity, ref _itemIndex, ref this._ItemIndex);
  42. }
  43. /// <summary>
  44. /// 设置项值
  45. /// </summary>
  46. /// <param name="entity"></param>
  47. /// <param name="lastentity"></param>
  48. /// <returns></returns>
  49. public override bool SetItemValue(TEntity entity, TEntity lastentity)
  50. {
  51. if (this._ItemIndex == null)
  52. {
  53. this._ItemIndex = new int[this._itemConfig.ItemCount];
  54. }
  55. _itemIndex = new int[this._itemConfig.ItemCount];
  56. return SetSpecialValue(entity, ref _itemIndex, ref this._ItemIndex);
  57. }
  58. /// <summary>
  59. /// 去格式化字符串
  60. /// </summary>
  61. /// <param name="fomart"></param>
  62. /// <param name="cssConfig"></param>
  63. /// <returns></returns>
  64. public override string GetFomartString(string fomart, ChartCssConfigInfo cssConfig = null)
  65. {
  66. var html = GetFomartHtml(fomart, cssConfig);
  67. var sp = new StringBuilder((html.Item1.Length + 40) * this._itemConfig.ItemCount);
  68. switch (this._itemConfig.FuntionType)
  69. {
  70. case ChartItemType.SpecialValue_FCSSQ_ChuHaoPL:
  71. sp.Append(CssValueFunction.SpecialValue_FCSSQ_ChuHaoPL(this._LocalEntity, this._itemConfig, this._cssConfig, this._ItemIndex, html.Item1));
  72. break;
  73. case ChartItemType.SpecialValue_TCDLT_ChuHaoPL:
  74. sp.Append(CssValueFunction.SpecialValue_TCDLT_ChuHaoPL(this._LocalEntity, this._itemConfig, this._cssConfig, this._ItemIndex, html.Item1));
  75. break;
  76. default:
  77. for (int i = 0; i < this._itemConfig.ItemCount; i++)
  78. {
  79. sp.Append(GetHtml(true, html.Item1, "", this._ItemIndex[i].ToString(), i));
  80. }
  81. break;
  82. }
  83. return sp.ToString();
  84. }
  85. }
  86. }