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

View Source

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

View Source

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

View 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

View Source

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

View Source

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

View Source

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

View Source

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

View Source

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

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

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

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

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

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

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

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

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

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

View Source

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

View Source

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

View Source

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

View Source

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