40 lines
1021 B
C#
40 lines
1021 B
C#
using Kurisu.AspNetCore.CustomClass;
|
|
|
|
namespace Dlhis.Basic.BusinessShift;
|
|
|
|
/// <summary>
|
|
/// 临时的扩展类 todo: 嵌入框架
|
|
/// </summary>
|
|
public static class TimePeriodExtensions
|
|
{
|
|
public static bool IsDuplicate1(this TimePeriod current, TimePeriod period)
|
|
{
|
|
return !Check();
|
|
|
|
bool Check()
|
|
{
|
|
if (current.IsCrossDay())
|
|
{
|
|
if (period.IsCrossDay())
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return period.Start > current.End && period.End < current.Start;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (period.IsCrossDay())
|
|
{
|
|
return period.Start > current.End && period.End < current.Start;
|
|
}
|
|
else
|
|
{
|
|
return period.Start > current.End || period.End < current.Start;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |