Beispiel #1
0
        public Entities.Distribution Execute(Request request)
        {
            var distribution = new Entities.Distribution(request.AvailableValue);
            var employees    = _findEmployeesRule.Execute();

            foreach (var employee in employees)
            {
                var calculationInfluence = _calculationInfluenceRule.Execute(employee);
                var participation        = _calculateParticipationRule.Execute(employee, calculationInfluence);
                distribution.Participations.Add(participation);
                distribution.TotalDistributed += participation.Value;

                if (distribution.TotalDistributed > request.AvailableValue)
                {
                    throw new InsufficientAvailableValueException();
                }
            }

            return(distribution);
        }
 public Response(Entities.Distribution distribution)
 {
     Distribution = distribution;
 }