Example #1
0
        static void Main(string[] args)
        {
            Manager gorkem = new Manager {
                Name = "Görkem", Salary = 1000
            };
            Manager gizem = new Manager {
                Name = "Gizem", Salary = 1200
            };

            Manager berk = new Manager {
                Name = "Berk", Salary = 750
            };
            Manager duru = new Manager {
                Name = "Duru", Salary = 550
            };

            gorkem.Subordinates.Add(gizem);
            gizem.Subordinates.Add(berk);
            berk.Subordinates.Add(duru);


            OrganisationalStructure organisationalStructure = new OrganisationalStructure(gorkem);

            PayrollVisitor payrollVisitor = new PayrollVisitor();
            PayriseVisitor payriseVisitor = new PayriseVisitor();

            organisationalStructure.Accept(payrollVisitor);
            organisationalStructure.Accept(payriseVisitor);

            Console.ReadLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            //Ziyaretçi Tasarım Deseni
            //Örn : Şirketteki bütün hiyerarşiye bi ödeme yapılması (maaş artışı)
            //Yöneticiye %20 zam , Çalışana %10 gibi

            Manager manager = new Manager {
                Name = "Berkay", Salary = 4000
            };
            Manager manager2 = new Manager {
                Name = "Mehmet", Salary = 3500
            };

            Worker worker = new Worker {
                Name = "Ahmet", Salary = 2000
            };
            Worker worker2 = new Worker {
                Name = "Ali", Salary = 2300
            };

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

            OrganizationalStructure organizationalStructure = new OrganizationalStructure(manager);

            PayrollVisitor  payrollVisitor  = new PayrollVisitor();
            PayRaiseVisitor payRaiseVisitor = new PayRaiseVisitor();

            //Organizasyon Yapımıza Visitor'ımızı ekliyoruz
            organizationalStructure.Accept(payrollVisitor);
            organizationalStructure.Accept(payRaiseVisitor);

            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            Manager apo = new Manager {
                Name = "Furkan", Salary = 1000
            };
            Manager ali = new Manager {
                Name = "Ali", Salary = 1000
            };
            Manager ilker = new Manager {
                Name = "İlker", Salary = 1000
            };

            Worker john = new Worker {
                Name = "john", Salary = 900
            };
            Worker jack = new Worker {
                Name = "jack", Salary = 900
            };
            Worker rock = new Worker {
                Name = "Rock", Salary = 800
            };

            ali.Subordints.Add(john);
            ilker.Subordints.Add(jack);
            ilker.Subordints.Add(rock);

            OrganisationStructure organisationStructure = new OrganisationStructure(apo);

            PayrollVisitor payrollVisitor = new PayrollVisitor();
            Payrise        payrise        = new Payrise();

            organisationStructure.GetAccept(payrollVisitor);
            organisationStructure.GetAccept(payrise);

            Console.ReadLine();
        }