demo20230512/Models/ExtensionMethods/WorkHourExtension.cs

120 lines
4.3 KiB
C#
Raw Permalink Normal View History

2023-05-12 10:20:28 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Weee.Models.ExtensionMethods
{
public static class WorkHourExtension
{
public static decimal GetTotalDirectWorkerNumber(this ICollection<WorkHour> workHours)
{
decimal totalDirectWorkerNumber = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Direct))
{
totalDirectWorkerNumber += workHour.WorkerNumber;
}
return totalDirectWorkerNumber;
}
public static decimal GetTotalDirectWorkDay(this ICollection<WorkHour> workHours)
{
decimal totalDirectWorkDay = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Direct))
{
totalDirectWorkDay += workHour.WorkDay;
}
return totalDirectWorkDay;
}
public static decimal GetTotalDirectAverageHourPerDay(this ICollection<WorkHour> workHours)
{
decimal totalDirectAverageHourPerDay = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Direct))
{
totalDirectAverageHourPerDay += workHour.AverageHourPerDay;
}
return totalDirectAverageHourPerDay;
}
public static decimal GetTotalDirectProportionWorkHour(this ICollection<WorkHour> workHours)
{
decimal totalDirectProportionWorkHour = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Direct))
{
totalDirectProportionWorkHour += workHour.AverageHourPerDay / 8;
}
return totalDirectProportionWorkHour;
}
public static decimal GetTotalDirectWorkHours(this ICollection<WorkHour> workHours)
{
decimal totalDirectWorkHours = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Direct))
{
totalDirectWorkHours += workHour.WorkerNumber * workHour.WorkDay * workHour.AverageHourPerDay;
}
return totalDirectWorkHours;
}
public static decimal GetTotalIndirectWorkerNumber(this ICollection<WorkHour> workHours)
{
decimal totalIndirectWorkerNumber = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Indirect))
{
totalIndirectWorkerNumber += workHour.WorkerNumber;
}
return totalIndirectWorkerNumber;
}
public static decimal GetTotalIndirectWorkDay(this ICollection<WorkHour> workHours)
{
decimal totalIndirectWorkDay = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Indirect))
{
totalIndirectWorkDay += workHour.WorkDay;
}
return totalIndirectWorkDay;
}
public static decimal GetTotalIndirectAverageHourPerDay(this ICollection<WorkHour> workHours)
{
decimal totalIndirectAverageHourPerDay = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Indirect))
{
totalIndirectAverageHourPerDay += workHour.AverageHourPerDay;
}
return totalIndirectAverageHourPerDay;
}
public static decimal GetTotalIndirectProportionWorkHour(this ICollection<WorkHour> workHours)
{
decimal totalIndirectProportionWorkHour = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Indirect))
{
totalIndirectProportionWorkHour += workHour.AverageHourPerDay / 8;
}
return totalIndirectProportionWorkHour;
}
public static decimal GetTotalIndirectWorkHours(this ICollection<WorkHour> workHours)
{
decimal totalIndirectWorkHours = 0;
foreach (var workHour in workHours.Where(x => x.Type == WorkHour.WorkHourType.Indirect))
{
totalIndirectWorkHours += workHour.WorkerNumber * workHour.WorkDay * workHour.AverageHourPerDay;
}
return totalIndirectWorkHours;
}
}
}