WeekPlanDetail.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. //----------------------------------------------------------------
  6. //Module Name: $safeprojectname$
  7. //Purpose:
  8. //CopyRight: Muchinfo
  9. //History:
  10. //----------------------------------------------------------------
  11. //DateTime 2016/6/21 17:06:59
  12. //Author
  13. //Description Create
  14. //----------------------------------------------------------------
  15. using Muchinfo.MTPClient.Data.Helper;
  16. namespace Muchinfo.MTPClient.Data.Quote
  17. {
  18. public class WeekPlanDetail
  19. {
  20. /// <summary>
  21. /// 周计划id
  22. /// </summary>
  23. [PropertyDisc("WeekPlanDetailId")]
  24. public long WeekPlanDetailId { get; set; }
  25. /// <summary>
  26. /// 周结算计划ID
  27. /// </summary>
  28. [PropertyDisc("WeekPlanId")]
  29. public long WeekPlanId { get; set; }
  30. /// <summary>
  31. /// 运行阶段
  32. /// </summary>
  33. [PropertyDisc("RunStep")]
  34. public int RunStep { get; set; }
  35. /// <summary>
  36. /// 起始周几
  37. /// </summary>
  38. [PropertyDisc("StartWeekDay")]
  39. public int StartWeekDay { get; set; }
  40. /// <summary>
  41. /// 结束周几
  42. /// </summary>
  43. [PropertyDisc("EndWeekDay")]
  44. public int EndWeekDay { get; set; }
  45. /// <summary>
  46. /// 开始时间 HH:mm
  47. /// </summary>
  48. [PropertyDisc("Starttime")]
  49. public string Starttime { get; set; }
  50. /// <summary>
  51. /// 结束时间 HH:mm
  52. /// </summary>
  53. [PropertyDisc("EndTime")]
  54. public string EndTime { get; set; }
  55. /// <summary>
  56. /// 交易日
  57. /// </summary>
  58. [PropertyDisc("Tradeday")]
  59. public DateTime Tradeday { get; set; }
  60. /// <summary>
  61. /// 获取开始时间
  62. /// </summary>
  63. /// <returns></returns>
  64. public DateTime GetStartTime()
  65. {
  66. if (this.Tradeday == DateTime.MinValue)
  67. {
  68. throw new Exception("traday is not valid !" + Tradeday);
  69. }
  70. var start = StartWeekDay - (int) Tradeday.DayOfWeek;
  71. var startTime = this.Tradeday.AddDays(start);
  72. if (!DateTime.TryParse(startTime.ToString("yyyy-MM-dd ") + Starttime, out startTime))
  73. {
  74. throw new Exception("traday is not valid !:"+startTime.ToString("yyyy-MM-dd ") + Starttime);
  75. }
  76. return startTime;
  77. }
  78. /// <summary>
  79. /// 获取结束时间
  80. /// </summary>
  81. /// <returns></returns>
  82. public DateTime GetEndTime()
  83. {
  84. if (this.Tradeday == DateTime.MinValue)
  85. {
  86. throw new Exception("traday is not valid !" + Tradeday);
  87. }
  88. var end = EndWeekDay - (int)Tradeday.DayOfWeek;
  89. var endTime = this.Tradeday.AddDays(end);
  90. if (!DateTime.TryParse(endTime.ToString("yyyy-MM-dd ") + EndTime, out endTime))
  91. {
  92. throw new Exception("traday is not valid !:" + endTime.ToString("yyyy-MM-dd ") + EndTime);
  93. }
  94. return endTime;
  95. }
  96. }
  97. }