Show / Hide Table of Contents

Class HourPeriodExtensions

TimePeriod extension methods

Inheritance
object
HourPeriodExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: PayrollEngine.Client.Scripting
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public static class HourPeriodExtensions

Methods

View Source

HasOverlapping(IEnumerable<HourPeriod>)

Test if any period is overlapping another period

Declaration
public static bool HasOverlapping(this IEnumerable<HourPeriod> timePeriods)
Parameters
Type Name Description
IEnumerable<HourPeriod> timePeriods
Returns
Type Description
bool

True, if the period is overlapping this period

Remarks

Fixed: outer loop starts at 0 to include the first element in comparisons.

View Source

Intersect(HourPeriod, HourPeriod)

Get the intersection of a time period with this period

Declaration
public static HourPeriod Intersect(this HourPeriod period, HourPeriod intersectPeriod)
Parameters
Type Name Description
HourPeriod period
HourPeriod intersectPeriod

The period to intersect

Returns
Type Description
HourPeriod

The intersecting time period, null if no intersection is present

View Source

IntersectHours(HourPeriod, HourPeriod)

Get the hours of intersection

Declaration
public static decimal IntersectHours(this HourPeriod period, HourPeriod intersectPeriod)
Parameters
Type Name Description
HourPeriod period
HourPeriod intersectPeriod

The period to intersect

Returns
Type Description
decimal

The intersecting duration in hours, 0 if no intersection is present

View Source

Intersections(IEnumerable<HourPeriod>, HourPeriod)

Get all intersections of a time period with any time period

Declaration
public static List<HourPeriod> Intersections(this IEnumerable<HourPeriod> timePeriods, HourPeriod intersectPeriod)
Parameters
Type Name Description
IEnumerable<HourPeriod> timePeriods
HourPeriod intersectPeriod

The period to intersect

Returns
Type Description
List<HourPeriod>

List of intersecting time periods

View Source

IsAfter(HourPeriod, HourPeriod)

Test if a specific time period is after this period

Declaration
public static bool IsAfter(this HourPeriod period, HourPeriod testPeriod)
Parameters
Type Name Description
HourPeriod period
HourPeriod testPeriod

The period to test

Returns
Type Description
bool

True, if the period is after this period

View Source

IsAfter(HourPeriod, decimal)

Test if a specific time moment is after this period

Declaration
public static bool IsAfter(this HourPeriod period, decimal test)
Parameters
Type Name Description
HourPeriod period
decimal test

The moment to test

Returns
Type Description
bool

True, if the moment is after this period

View Source

IsBefore(HourPeriod, HourPeriod)

Test if a specific time period is before this period

Declaration
public static bool IsBefore(this HourPeriod period, HourPeriod testPeriod)
Parameters
Type Name Description
HourPeriod period
HourPeriod testPeriod

The period to test

Returns
Type Description
bool

True, if the period is before this period

View Source

IsBefore(HourPeriod, decimal)

Test if a specific time moment is before this period

Declaration
public static bool IsBefore(this HourPeriod period, decimal test)
Parameters
Type Name Description
HourPeriod period
decimal test

The moment to test

Returns
Type Description
bool

True, if the moment is before this period

View Source

IsOverlapping(HourPeriod, HourPeriod)

Test if period is overlapping this period

Declaration
public static bool IsOverlapping(this HourPeriod period, HourPeriod testPeriod)
Parameters
Type Name Description
HourPeriod period
HourPeriod testPeriod

The period to test

Returns
Type Description
bool

True, if the period is overlapping this period

View Source

IsWithin(HourPeriod, HourPeriod)

Test if a specific time period is within the period, including open periods

Declaration
public static bool IsWithin(this HourPeriod period, HourPeriod testPeriod)
Parameters
Type Name Description
HourPeriod period
HourPeriod testPeriod

The period to test

Returns
Type Description
bool

True, if the test period is within this period

View Source

IsWithin(HourPeriod, decimal)

Test if a specific time moment is within the period, including open periods

Declaration
public static bool IsWithin(this HourPeriod period, decimal test)
Parameters
Type Name Description
HourPeriod period
decimal test

The moment to test

Returns
Type Description
bool

True, if the moment is within this period

View Source

IsWithinAny(IEnumerable<HourPeriod>, HourPeriod)

Test if a specific time period is within any time period

Declaration
public static bool IsWithinAny(this IEnumerable<HourPeriod> timePeriods, HourPeriod testPeriod)
Parameters
Type Name Description
IEnumerable<HourPeriod> timePeriods
HourPeriod testPeriod

The period to test

Returns
Type Description
bool

True, if the test period is within this period

View Source

IsWithinAny(IEnumerable<HourPeriod>, decimal)

Test if a specific time moment is within any time period

Declaration
public static bool IsWithinAny(this IEnumerable<HourPeriod> timePeriods, decimal test)
Parameters
Type Name Description
IEnumerable<HourPeriod> timePeriods
decimal test

The moment to test

Returns
Type Description
bool

True, if the moment is within this period

View Source

IsWithinOrAfter(HourPeriod, decimal)

Test if a specific time moment is within or after the period, including open periods

Declaration
public static bool IsWithinOrAfter(this HourPeriod period, decimal test)
Parameters
Type Name Description
HourPeriod period
decimal test

The moment to test

Returns
Type Description
bool

True, if the moment is within or after this period

View Source

IsWithinOrBefore(HourPeriod, decimal)

Test if a specific time moment is within or before the period, including open periods

Declaration
public static bool IsWithinOrBefore(this HourPeriod period, decimal test)
Parameters
Type Name Description
HourPeriod period
decimal test

The moment to test

Returns
Type Description
bool

True, if the moment is within or before this period

View Source

Limits(IEnumerable<HourPeriod>)

Get limits period, from the earliest start to the latest end

Declaration
public static HourPeriod Limits(this IEnumerable<HourPeriod> timePeriods)
Parameters
Type Name Description
IEnumerable<HourPeriod> timePeriods
Returns
Type Description
HourPeriod

Time period including all time periods, an anytime period for empty collections

View Source

TotalDuration(IEnumerable<HourPeriod>)

Total duration of all time periods

Declaration
public static TimeSpan TotalDuration(this IEnumerable<HourPeriod> timePeriods)
Parameters
Type Name Description
IEnumerable<HourPeriod> timePeriods
Returns
Type Description
TimeSpan

Accumulated total duration

  • View Source
☀
☾
Back to top Generated by DocFX