示例#1
0
 /// <summary>
 /// Create Sport Time From Week Time
 /// </summary>
 /// <param name="dayOfWeek">dayOfWeek</param>
 /// <param name="from">hourOfDay</param>
 /// <param name="to">hourOfDay</param>
 public static SportTime From(int dayOfWeek, int from, int to)
 {
     SportTime st = new SportTime();
     st.from = dayOfWeek * 24 + from;
     st.to = dayOfWeek * 24 + to;
     return st;
 }
示例#2
0
 /// <summary>
 /// 重合长度
 /// </summary>
 /// <returns></returns>
 public int OverLapLength(SportTime time)
 {
     int maxFrom = from > time.from ? from : time.from;
     int minTo = to > time.to ? time.to : to;
     return minTo - maxFrom;
 }
示例#3
0
 public bool IsOverLapWith(SportTime time)
 {
     return OverLapLength(time) > 0;
 }