Show / Hide Table of Contents

Class PeriodValueExtensions

PeriodValue extension methods

Inheritance
object
PeriodValueExtensions
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 PeriodValueExtensions

Methods

GetDurations(IEnumerable<PeriodValue>)

Extract all date period durations

Declaration
public static IEnumerable<TimeSpan> GetDurations(this IEnumerable<PeriodValue> values)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
Returns
Type Description
IEnumerable<TimeSpan>

A list containing all date period durations

GetPeriod(IEnumerable<PeriodValue>)

Get the date period over all values, from the earliest start to the latest end

Declaration
public static DatePeriod GetPeriod(this IEnumerable<PeriodValue> values)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
Returns
Type Description
DatePeriod

The overall period, anytime in case of an empty source

GetPeriodEnd(IEnumerable<PeriodValue>)

Get the latest end date

Declaration
public static DateTime? GetPeriodEnd(this IEnumerable<PeriodValue> values)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
Returns
Type Description
DateTime?

The latest end date

GetPeriodEnds(IEnumerable<PeriodValue>)

Extract all date end dates

Declaration
public static IEnumerable<DateTime> GetPeriodEnds(this IEnumerable<PeriodValue> values)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
Returns
Type Description
IEnumerable<DateTime>

A date period end dates

GetPeriodStart(IEnumerable<PeriodValue>)

Get the earliest start date

Declaration
public static DateTime? GetPeriodStart(this IEnumerable<PeriodValue> values)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
Returns
Type Description
DateTime?

The earliest start date

GetPeriodStarts(IEnumerable<PeriodValue>)

Extract all date start dates

Declaration
public static IEnumerable<DateTime> GetPeriodStarts(this IEnumerable<PeriodValue> values)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
Returns
Type Description
IEnumerable<DateTime>

A date period start dates

GetPeriods(IEnumerable<PeriodValue>)

Extract all date periods

Declaration
public static IEnumerable<DatePeriod> GetPeriods(this IEnumerable<PeriodValue> values)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
Returns
Type Description
IEnumerable<DatePeriod>

A list containing all date periods

ToDateTime(PeriodValue)

Convert case period value to date time/>

Declaration
public static DateTime ToDateTime(this PeriodValue periodValue)
Parameters
Type Name Description
PeriodValue periodValue
Returns
Type Description
DateTime

ToDecimal(PeriodValue)

Convert case period value to decimal/>

Declaration
public static decimal ToDecimal(this PeriodValue periodValue)
Parameters
Type Name Description
PeriodValue periodValue
Returns
Type Description
decimal

ToDecimal(PeriodValue, DecimalRounding)

Convert case period value to decimal

Declaration
public static decimal ToDecimal(this PeriodValue periodValue, DecimalRounding rounding)
Parameters
Type Name Description
PeriodValue periodValue
DecimalRounding rounding

The rounding type

Returns
Type Description
decimal

ToInt(PeriodValue)

Convert case period value to int/>

Declaration
public static int ToInt(this PeriodValue periodValue)
Parameters
Type Name Description
PeriodValue periodValue
Returns
Type Description
int

ToNullableDateTime(PeriodValue)

Convert case period value to nullable date time/>

Declaration
public static DateTime? ToNullableDateTime(this PeriodValue periodValue)
Parameters
Type Name Description
PeriodValue periodValue
Returns
Type Description
DateTime?

ToNullableDecimal(PeriodValue)

Convert case period value to nullable decimal/>

Declaration
public static decimal? ToNullableDecimal(this PeriodValue periodValue)
Parameters
Type Name Description
PeriodValue periodValue
Returns
Type Description
decimal?

ToNullableDecimal(PeriodValue, DecimalRounding)

Convert case period value to nullable decimal/>

Declaration
public static decimal? ToNullableDecimal(this PeriodValue periodValue, DecimalRounding rounding)
Parameters
Type Name Description
PeriodValue periodValue
DecimalRounding rounding

The rounding type

Returns
Type Description
decimal?

ToNullableInt(PeriodValue)

Convert case period value to nullable int/>

Declaration
public static int? ToNullableInt(this PeriodValue periodValue)
Parameters
Type Name Description
PeriodValue periodValue
Returns
Type Description
int?

ToString(PeriodValue)

Convert case period value to string/>

Declaration
public static string ToString(this PeriodValue periodValue)
Parameters
Type Name Description
PeriodValue periodValue
Returns
Type Description
string

TotalDaysByValue(IEnumerable<PeriodValue>)

Total days considering the value as factor

Declaration
public static decimal TotalDaysByValue(this IEnumerable<PeriodValue> values)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
Returns
Type Description
decimal

Total days by value as factor

TotalDaysByValue(IEnumerable<PeriodValue>, bool)

Total days considering the value as factor

Declaration
public static decimal TotalDaysByValue(this IEnumerable<PeriodValue> values, bool includeEndDay)
Parameters
Type Name Description
IEnumerable<PeriodValue> values
bool includeEndDay

Include the end day

Returns
Type Description
decimal

Total days by value as factor

TotalDuration(IEnumerable<PeriodValue>)

Summarize the total duration from all date period durations

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

Total duration from all periods, an empty time span on empty collection

ValueAs(PeriodValue, Type)

Convert case period value to custom type

Declaration
public static object ValueAs(this PeriodValue periodValue, Type type)
Parameters
Type Name Description
PeriodValue periodValue
Type type

Target type

Returns
Type Description
object

Accumulated total duration

ValueAs<T>(PeriodValue, T)

Convert case period value to custom type

Declaration
public static T ValueAs<T>(this PeriodValue periodValue, T defaultValue = default)
Parameters
Type Name Description
PeriodValue periodValue
T defaultValue

The default value

Returns
Type Description
T

Accumulated total duration

Type Parameters
Name Description
T
☀
☾
Back to top Generated by DocFX