public Departament(string name, Chief chief) { if (name == String.Empty || departamentNames.Contains(name)) { name = $"Departament_{defIndexName}"; } Name = name; departamentNames.Add(name); Chief = chief; workers = new List <IWorker>(); ownDepartaments = new List <Departament>(); defIndexName++; departaments.Add(this); chief.CalculateSalary(); }
public void AddWorker(Worker worker) { Workers.Add(worker); Chief.CalculateSalary(); }