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

View Source

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
View Source

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

View Source

Duration

The period duration

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

End

The period end time

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

Hours

The period hours

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

IsEmpty

Test if period is empty

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

IsMoment

Test if start and end are equal

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

Start

The period start time

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

Methods

View Source

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)
View Source

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
View Source

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
View Source

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
View Source

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
View Source

GetEndDate(DateTime)

Get end date

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

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()
View Source

GetStartDate(DateTime)

Get start date

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

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

View Source

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

View Source

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)
  • View Source
☀
☾
Back to top Generated by DocFX