Ejemplo n.º 1
0
        private void RecurseRecalculation(IWorkPlace place)
        {
            var children = place.Children;
            var superior = place.Superior;

            if (place.Children.Any())
            {
                foreach (var child in children)
                {
                    if (child as IWorkPlace != null)
                    {
                        RecurseRecalculation(child as IWorkPlace);
                    }
                }
            }

            int superiorSalary = 0;

            if (place is Departament)
            {
                superiorSalary = (int)(children.Aggregate(0, (salarySum, x) => salarySum + (x as Employee).Salary) * 0.15);
            }

            if (place is Institution)
            {
                superiorSalary = children.Aggregate(0, (salarySum, x) => salarySum + (x as IWorkPlace).Superior.Salary);
            }
            superior.Salary = superiorSalary > 1300 ? superiorSalary : 1300;
        }
Ejemplo n.º 2
0
 public WorkerInWorkPlace(IWorker pWorker, IWorkPlace pWorkPlace)
 {
     Worker    = pWorker;
     WorkPlace = pWorkPlace;
 }
Ejemplo n.º 3
0
 public void Edit(IWorkPlace worker)
 {
     throw new System.NotImplementedException();
 }