Show / Hide Table of Contents

Class HourPeriod

An immutable hour period between the start and end time

Inheritance
object
HourPeriod
Inherited Members
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: PayrollEngine.Client.Scripting
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public sealed class HourPeriod

Constructors

HourPeriod(decimal, decimal)

Create a period from start to end

Declaration
public HourPeriod(decimal start, decimal end)
Parameters
Type Name Description
decimal start
decimal end

HourPeriod(decimal?, decimal?)

Create a period from conditional start to conditional end

Declaration
public HourPeriod(decimal? start, decimal? end)
Parameters
Type Name Description
decimal? start
decimal? end

Properties

Duration

The period duration

Declaration
[JsonIgnore]
public TimeSpan Duration { get; }
Property Value
Type Description
TimeSpan

End

The period end time

Declaration
public decimal End { get; }
Property Value
Type Description
decimal

Hours

The period hours

Declaration
[JsonIgnore]
public decimal Hours { get; }
Property Value
Type Description
decimal

IsEmpty

Test if period is empty

Declaration
[JsonIgnore]
public bool IsEmpty { get; }
Property Value
Type Description
bool

IsMoment

Test if start and end are equal

Declaration
[JsonIgnore]
public bool IsMoment { get; }
Property Value
Type Description
bool

Start

The period start time

Declaration
public decimal Start { get; }
Property Value
Type Description
decimal

Methods

Equals(object)

Determines whether the specified object is equal to this instance

Declaration
public override bool Equals(object source)
Parameters
Type Name Description
object source

The object to compare with the current object

Returns
Type Description
bool

True if the specified object is equal to this instance

Overrides
object.Equals(object)

FromEnd(decimal, decimal)

Create time from end time and duration

Declaration
public static HourPeriod FromEnd(decimal hours, decimal end)
Parameters
Type Name Description
decimal hours

Duration time

decimal end

Period end

Returns
Type Description
HourPeriod

FromEnd(decimal?, decimal?)

Create time from end time and duration

Declaration
public static HourPeriod FromEnd(decimal? hours, decimal? end)
Parameters
Type Name Description
decimal? hours

Duration time

decimal? end

Period end

Returns
Type Description
HourPeriod

FromStart(decimal, decimal)

Create time from start time and duration

Declaration
public static HourPeriod FromStart(decimal start, decimal hours)
Parameters
Type Name Description
decimal start

Period start

decimal hours

Duration time

Returns
Type Description
HourPeriod

FromStart(decimal?, decimal?)

Create time from start time and duration

Declaration
public static HourPeriod FromStart(decimal? start, decimal? hours)
Parameters
Type Name Description
decimal? start

Period start

decimal? hours

Duration time

Returns
Type Description
HourPeriod

GetEndDate(DateTime)

Get end date

Declaration
public DateTime GetEndDate(DateTime day)
Parameters
Type Name Description
DateTime day
Returns
Type Description
DateTime

GetHashCode()

Returns a hash code for this instance

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table

Overrides
object.GetHashCode()

GetStartDate(DateTime)

Get start date

Declaration
public DateTime GetStartDate(DateTime day)
Parameters
Type Name Description
DateTime day
Returns
Type Description
DateTime

ToString()

Returns a string that represents this instance

Declaration
public override string ToString()
Returns
Type Description
string

A string that represents this instance

Overrides
object.ToString()

Operators

operator ==(HourPeriod, HourPeriod)

Compare two time periods for equal values

Declaration
public static bool operator ==(HourPeriod left, HourPeriod right)
Parameters
Type Name Description
HourPeriod left

The left period to compare

HourPeriod right

The right period to compare

Returns
Type Description
bool

True if the periods are equal

operator !=(HourPeriod, HourPeriod)

Compare two time periods for different values

Declaration
public static bool operator !=(HourPeriod left, HourPeriod right)
Parameters
Type Name Description
HourPeriod left

The left period to compare

HourPeriod right

The right period to compare

Returns
Type Description
bool

True if the periods are different

Extension Methods

HourPeriodExtensions.Intersect(HourPeriod, HourPeriod)
HourPeriodExtensions.IntersectHours(HourPeriod, HourPeriod)
HourPeriodExtensions.IsAfter(HourPeriod, HourPeriod)
HourPeriodExtensions.IsAfter(HourPeriod, decimal)
HourPeriodExtensions.IsBefore(HourPeriod, HourPeriod)
HourPeriodExtensions.IsBefore(HourPeriod, decimal)
HourPeriodExtensions.IsOverlapping(HourPeriod, HourPeriod)
HourPeriodExtensions.IsWithin(HourPeriod, HourPeriod)
HourPeriodExtensions.IsWithin(HourPeriod, decimal)
HourPeriodExtensions.IsWithinOrAfter(HourPeriod, decimal)
HourPeriodExtensions.IsWithinOrBefore(HourPeriod, decimal)
ConsoleExtensions.WriteProperties(object, bool)
ValueTypeExtensions.GetValueType(object)
ObjectInfo.GetPropertyValue(object, string)
ObjectInfo.GetPropertyValue<T>(object, string, T)
ObjectInfo.ResolvePropertyValue(object, string)
ObjectInfo.SetPropertyValue(object, string, object)
☀
☾
Back to top Generated by DocFX