protected override double CalculationSuccessor(Employee entity, DateTime period)
        {
            var answer = GetBonusByWorkExperience(period, entity.DateOfEmployment, entity.BaseRate,
                                                  ParametersCalculation.BonusPersentByWorkExperienceByYear, ParametersCalculation.MaxBonusPersentByWorkExperience);
            //в стак собирем всех потомков
            var stack     = new Stack <Employee>(GetWorkers(entity));
            var processed = new HashSet <Employee>();

            while (stack.Any())
            {
                var worker = stack.Pop();
                if (processed.Contains(worker))
                {
                    continue;
                }
                answer += (Head.Calculation(worker, period) * ParametersCalculation.BonusPersentForWorkers) / 100;
                processed.Add(worker);
                GetWorkers(worker).ToList().ForEach(stack.Push);
            }

            return(answer);
        }
 protected override double CalculationSuccessor(Employee entity, DateTime period)
 {
     return(GetBonusByWorkExperience(period, entity.DateOfEmployment, entity.BaseRate, ParametersCalculation.BonusPersentByWorkExperienceByYear, ParametersCalculation.MaxBonusPersentByWorkExperience)
            + GetWorkers(entity).Sum(work => (Head.Calculation(work, period) * ParametersCalculation.BonusPersentForWorkers) / 100));
 }