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 personnel) { DepartmentId = departmentId; Year = year; Month = month; Personnel = personnel; Goals = new Dictionary(); foreach (var person in personnel) { Goals[person.EmployeeId] = new PerProductGoal(); } } public int DepartmentId { get; } public int Year { get; } public int Month { get; } public ICollection Personnel { get; } public ICollection GoalAudit { get; set; } public IDictionary Goals { get; } public void ApplyAll(ICollection findDepartmentGoals) { GoalAudit = findDepartmentGoals; foreach (var goal in findDepartmentGoals) { if (Goals.Keys.Contains(goal.EmployeeId)) { Goals[goal.EmployeeId].ProductGoals[goal.Product] = goal.Value; } } } }