31 lines
804 B
C#
31 lines
804 B
C#
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
|
|
|
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
|
|
|
public class DepartmentGoals
|
|
{
|
|
public DepartmentGoals(int departmentId, int year)
|
|
{
|
|
DepartmentId = departmentId;
|
|
Year = year;
|
|
|
|
MonthlyGoals = new PerProductGoal[12];
|
|
for (var month = 0; month < 12; month++)
|
|
{
|
|
MonthlyGoals[month] = new PerProductGoal();
|
|
}
|
|
}
|
|
|
|
public int DepartmentId { get; }
|
|
public int Year { get; }
|
|
public PerProductGoal[] MonthlyGoals { get; }
|
|
|
|
public void ApplyAll(ICollection<Goal> findDepartmentGoals)
|
|
{
|
|
foreach (var goal in findDepartmentGoals)
|
|
{
|
|
MonthlyGoals[goal.StartDate.Month-1].ProductGoals[goal.Product] = goal.Value;
|
|
}
|
|
}
|
|
}
|