Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Manager manager = new Manager {
                Name = "engin", Salary = 1000
            };
            Manager manager2 = new Manager {
                Name = "salih", Salary = 900
            };

            Worker worker = new Worker {
                Name = "derin", Salary = 800
            };
            Worker worker2 = new Worker {
                Name = "ali", Salary = 800
            };

            manager.Subordinates.Add(manager2);
            manager2.Subordinates.Add(worker2);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(manager);
            PayrollVisitor          payrollVisitor          = new PayrollVisitor();
            PayRise payRise = new PayRise();

            organisationalStructure.Accept(payrollVisitor);
            organisationalStructure.Accept(payRise);

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Manager ceren = new Manager {
                Name = "Ceren", Salary = 1000
            };
            Manager ezgi = new Manager {
                Name = "Ezgi", Salary = 900
            };

            Worker derin = new Worker {
                Name = "Derin", Salary = 800
            };
            Worker ali = new Worker {
                Name = "Ali", Salary = 800
            };

            ezgi.Subordinates.Add(ceren);
            ceren.Subordinates.Add(derin);
            ceren.Subordinates.Add(ali);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(ezgi);

            PayrollVisitor payrollVisitor = new PayrollVisitor();
            PayRise        payRiseVisitor = new PayRise();

            organisationalStructure.Accept(payRiseVisitor);
            organisationalStructure.Accept(payrollVisitor);

            Console.ReadLine();
        }