Class HourPeriod
An immutable hour period between the start and end time
Inherited Members
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
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
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
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 |