Files
linqpad/CI Testing Stuff/Payroll Opportunity Metric.linq

79 lines
3.5 KiB
C#

<Query Kind="Program" />
void Main()
{
var pom = new PayrollOpportunityMetric
{
BaselineMonth01Dollars = 1.0m,
ActualMonth03Dollars = 1.0m,
CommittedMonth06Dollars = 1.0m
};
pom.BaselineDollars().Dump();
pom.ActualDollars().Dump();
pom.CommittedDollars().Dump();
}
// Define other methods and classes here
public class PayrollOpportunityMetric
{
public decimal BaselineMonth01Dollars { get; set; } = 0.0m;
public decimal BaselineMonth02Dollars { get; set; } = 0.0m;
public decimal BaselineMonth03Dollars { get; set; } = 0.0m;
public decimal BaselineMonth04Dollars { get; set; } = 0.0m;
public decimal BaselineMonth05Dollars { get; set; } = 0.0m;
public decimal BaselineMonth06Dollars { get; set; } = 0.0m;
public decimal BaselineMonth07Dollars { get; set; } = 0.0m;
public decimal BaselineMonth08Dollars { get; set; } = 0.0m;
public decimal BaselineMonth09Dollars { get; set; } = 0.0m;
public decimal BaselineMonth10Dollars { get; set; } = 0.0m;
public decimal BaselineMonth11Dollars { get; set; } = 0.0m;
public decimal BaselineMonth12Dollars { get; set; } = 0.0m;
public decimal ActualMonth01Dollars { get; set; } = 0.0m;
public decimal ActualMonth02Dollars { get; set; } = 0.0m;
public decimal ActualMonth03Dollars { get; set; } = 0.0m;
public decimal ActualMonth04Dollars { get; set; } = 0.0m;
public decimal ActualMonth05Dollars { get; set; } = 0.0m;
public decimal ActualMonth06Dollars { get; set; } = 0.0m;
public decimal ActualMonth07Dollars { get; set; } = 0.0m;
public decimal ActualMonth08Dollars { get; set; } = 0.0m;
public decimal ActualMonth09Dollars { get; set; } = 0.0m;
public decimal ActualMonth10Dollars { get; set; } = 0.0m;
public decimal ActualMonth11Dollars { get; set; } = 0.0m;
public decimal ActualMonth12Dollars { get; set; } = 0.0m;
public decimal CommittedMonth01Dollars { get; set; } = 0.0m;
public decimal CommittedMonth02Dollars { get; set; } = 0.0m;
public decimal CommittedMonth03Dollars { get; set; } = 0.0m;
public decimal CommittedMonth04Dollars { get; set; } = 0.0m;
public decimal CommittedMonth05Dollars { get; set; } = 0.0m;
public decimal CommittedMonth06Dollars { get; set; } = 0.0m;
public decimal CommittedMonth07Dollars { get; set; } = 0.0m;
public decimal CommittedMonth08Dollars { get; set; } = 0.0m;
public decimal CommittedMonth09Dollars { get; set; } = 0.0m;
public decimal CommittedMonth10Dollars { get; set; } = 0.0m;
public decimal CommittedMonth11Dollars { get; set; } = 0.0m;
public decimal CommittedMonth12Dollars { get; set; } = 0.0m;
}
public static class PayrollOpportunityMetricExtensions
{
public static IEnumerable<decimal> BaselineDollars(this PayrollOpportunityMetric pom) =>
typeof(PayrollOpportunityMetric)
.GetProperties(BindingFlags.Instance | BindingFlags.Public)
.Where(p => p.Name.StartsWith("BaselineMonth") && p.Name.EndsWith("Dollars"))
.Select(dp => (decimal) dp.GetValue(pom, null));
public static IEnumerable<decimal> ActualDollars(this PayrollOpportunityMetric pom) =>
typeof(PayrollOpportunityMetric)
.GetProperties(BindingFlags.Instance | BindingFlags.Public)
.Where(p => p.Name.StartsWith("ActualMonth") && p.Name.EndsWith("Dollars"))
.Select(dp => (decimal)dp.GetValue(pom, null));
public static IEnumerable<decimal> CommittedDollars(this PayrollOpportunityMetric pom) =>
typeof(PayrollOpportunityMetric)
.GetProperties(BindingFlags.Instance | BindingFlags.Public)
.Where(p => p.Name.StartsWith("CommittedMonth") && p.Name.EndsWith("Dollars"))
.Select(dp => (decimal)dp.GetValue(pom, null));
}