39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using LCU.Library.Internal.IncentiveApiModels.Entities;
|
|
|
|
namespace LCU.API.Internal.Operations.IncentiveApi.Models;
|
|
|
|
public class PersonnelGoals
|
|
{
|
|
public PersonnelGoals(int departmentId, int year, int month, ICollection<AppUser> personnel)
|
|
{
|
|
DepartmentId = departmentId;
|
|
Year = year;
|
|
Month = month;
|
|
Personnel = personnel;
|
|
Goals = new Dictionary<string, PerProductGoal>();
|
|
foreach (var person in personnel)
|
|
{
|
|
Goals[person.EmployeeId] = new PerProductGoal();
|
|
}
|
|
}
|
|
|
|
public int DepartmentId { get; }
|
|
public int Year { get; }
|
|
public int Month { get; }
|
|
public ICollection<AppUser> Personnel { get; }
|
|
public ICollection<Goal> GoalAudit { get; set; }
|
|
public IDictionary<string, PerProductGoal> Goals { get; }
|
|
|
|
public void ApplyAll(ICollection<Goal> findDepartmentGoals)
|
|
{
|
|
GoalAudit = findDepartmentGoals;
|
|
foreach (var goal in findDepartmentGoals)
|
|
{
|
|
if (Goals.Keys.Contains(goal.EmployeeId))
|
|
{
|
|
Goals[goal.EmployeeId].ProductGoals[goal.Product] = goal.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|