Beispiel #1
0
        static void Main(string[] args)
        {
            Manager gokay = new Manager {
                Name = "Gökay", Salary = 1000
            };
            Manager gokhan = new Manager {
                Name = "Gökhan", Salary = 900
            };

            Worker kaan = new Worker {
                Name = "Kaan", Salary = 800
            };
            Worker ali = new Worker {
                Name = "Ali", Salary = 800
            };

            gokay.Subordinates.Add(gokhan);
            gokhan.Subordinates.Add(kaan);
            gokhan.Subordinates.Add(ali);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(gokay);

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

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

            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Manager ali = new Manager {
                Name = "Ali", Salary = 1000
            };
            Manager orhan = new Manager {
                Name = "Orhan", Salary = 900
            };
            Worker ishak = new Worker {
                Name = "İshak", Salary = 800
            };
            Worker arif = new Worker {
                Name = "Arif", Salary = 800
            };

            ali.Subordinates.Add(orhan);
            orhan.Subordinates.Add(ishak);
            orhan.Subordinates.Add(arif);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(ali);

            PaymentVisitor    paymentVisitor    = new PaymentVisitor();
            SalaryRiseVisitor salaryRiseVisitor = new SalaryRiseVisitor();

            organisationalStructure.Accept(paymentVisitor);
            organisationalStructure.Accept(salaryRiseVisitor);

            Console.ReadLine();
        }
Beispiel #3
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();
        }
Beispiel #4
0
        //bir şirketin maaş artışı ve ödeme işlemlerini visitor deseni ile baz alan sistem kurmak için şunları yapacağız
        static void Main(string[] args)
        {
            //ana kısımda

            Manager yusuf = new Manager {
                Name = "Yusuf", Salary = 1000
            };                                                             //yöneticileri tanımladık
            Manager kadir = new Manager {
                Name = "Kadir", Salary = 950
            };

            Worker rabia = new Worker {
                Name = "Rabia", Salary = 500
            };                                                          //işçileri tanımladık
            Worker recep = new Worker {
                Name = "Recep", Salary = 650
            };

            yusuf.Subordinates.Add(kadir); //alt çalışanları tanımladık
            kadir.Subordinates.Add(rabia);
            kadir.Subordinates.Add(recep);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(yusuf); //ödeme ve maaş sistemini tanımladık
            PayrollVisitor          payrollVisitor          = new PayrollVisitor();
            PayriseVisitor          payriseVisitor          = new PayriseVisitor();

            organisationalStructure.Accept(payrollVisitor); //maaş ve ödemeleri arttırmayı onayladık
            organisationalStructure.Accept(payriseVisitor);

            Console.ReadLine();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Manager ahmet = new Manager {
                Name = "Ahmet", Salary = 1000
            };
            Manager burak = new Manager {
                Name = "Burak", Salary = 900
            };

            Worker tuğra = new Worker {
                Name = "Tuğra", Salary = 800
            };
            Worker berkay = new Worker {
                Name = "berkay", Salary = 800
            };

            ahmet.Subordinates.Add(burak);
            burak.Subordinates.Add(tuğra);
            burak.Subordinates.Add(berkay);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(ahmet);

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

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

            Console.ReadLine();
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            Manager engin = new Manager {
                Name = "Engin", Salary = 1000
            };
            Manager salih = new Manager {
                Name = "Salih", Salary = 900
            };

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

            engin.Subordinates.Add(salih);
            salih.Subordinates.Add(derin);
            salih.Subordinates.Add(ali);



            OrganisationalStructure organisationalStructure = new OrganisationalStructure(engin);

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

            organisationalStructure.Accept(payrollVisitor);
            organisationalStructure.Accept(payriseVisitor);
            Console.ReadLine();
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            Manager managerF = new Manager {
                Name = "Furkan", Salary = 1000
            };
            Manager managerS = new Manager {
                Name = "Salih", Salary = 900
            };
            Worker ali = new Worker {
                Name = "Ali", Salary = 600
            };
            Worker ayse = new Worker {
                Name = "Ayşe", Salary = 500
            };

            managerF.Subordinates.Add(managerS);
            managerS.Subordinates.Add(ali);
            managerS.Subordinates.Add(ayse);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(managerF);
            PayrolVisitor           payrolVisitor           = new PayrolVisitor();
            PayriseVisitor          payriseVisitor          = new PayriseVisitor();

            organisationalStructure.Accept(payriseVisitor);
            organisationalStructure.Accept(payrolVisitor);

            Console.ReadLine();
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            Manager ugur = new Manager {
                Name = "Uğur", Salary = 2000
            };
            Manager yusuf = new Manager {
                Name = "yusuf", Salary = 2000
            };

            Worker leyla = new Worker {
                Name = "Leyla", Salary = 1500
            };
            Worker kamil = new Worker {
                Name = "Kamil", Salary = 1500
            };

            ugur.subordi.Add(yusuf);
            ugur.subordi.Add(leyla);
            yusuf.subordi.Add(kamil);

            OrganisationalStructure org            = new OrganisationalStructure(ugur);
            PayrollVisitor          payrollVisitor = new PayrollVisitor();
            PayriseVisitor          payriseVisitor = new PayriseVisitor();

            org.Accept(payrollVisitor);
            org.Accept(payriseVisitor);
        }
        static void Main(string[] args)
        {
            Manager eray = new Manager {
                Name = "Eray", Salary = 1000
            };
            Manager hakan = new Manager {
                Name = "Hakan", Salary = 1100
            };

            Calisan semih = new Calisan {
                Name = "Semih", Salary = 800
            };
            Calisan mustafa = new Calisan {
                Name = "Mustafa", Salary = 800
            };

            eray.employeeBases.Add(hakan);
            hakan.employeeBases.Add(semih);
            hakan.employeeBases.Add(mustafa);

            OrganisationalStructure organisational = new OrganisationalStructure(eray);

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

            organisational.Accept(payrollVisitor);
            organisational.Accept(payriseVisitor);
            Console.ReadLine();
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            Worker emre = new Worker {
                Name = "Emre", Salary = 3500
            };
            Worker emin = new Worker {
                Name = "Emin", Salary = 3200
            };

            Manager yasin = new Manager()
            {
                Name = "Müdür Yasin", Salary = 8000
            };
            Manager kerim = new Manager()
            {
                Name = "Müdür Kerim", Salary = 8100
            };

            yasin.Subordinates.Add(kerim);
            kerim.Subordinates.Add(emre);
            kerim.Subordinates.Add(emin);

            OrganisationalStructure structure = new OrganisationalStructure(yasin);

            PayallVisitor   payallVisitor   = new PayallVisitor();
            PayriselVisitor payriselVisitor = new PayriselVisitor();

            structure.Accept(payallVisitor);
            structure.Accept(payriselVisitor);

            Console.ReadLine();
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            Manager umut = new Manager {
                Name = "Umut", Salary = 1100
            };
            Manager arif = new Manager {
                Name = "Arif", Salary = 800
            };

            Worker ahmet = new Worker {
                Name = "Ahmet", Salary = 600
            };
            Worker mehmet = new Worker {
                Name = "Mehmet", Salary = 600
            };

            umut.Subordinates.Add(arif);
            arif.Subordinates.Add(ahmet);
            arif.Subordinates.Add(mehmet);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(umut);

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

            organisationalStructure.Accept(payrollVisitor);
            organisationalStructure.Accept(payrise);

            Console.ReadLine();
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            //ziyaretçi desene
            // birbirine benzeyen veya hiyerarşik nesnelerin birbirine benzeyen metodlarının biri üzerinden çağrılmasıdır
            Manager managerFatih = new Manager {
                Name = "Fatih", Salary = 1000
            };
            Manager managerEngin = new Manager {
                Name = "Engin", Salary = 900
            };

            Worker workerSalih = new Worker {
                Name = "Salih", Salary = 800
            };
            Worker workerAli = new Worker {
                Name = "Ali", Salary = 700
            };

            managerFatih.Subordinates.Add(managerEngin);
            managerEngin.Subordinates.Add(workerSalih);
            managerEngin.Subordinates.Add(workerAli);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(managerFatih);
            PayrolVisitor           payrolVisitor           = new PayrolVisitor();
            PayRiseVisitor          payRiseVisitor          = new PayRiseVisitor();

            organisationalStructure.Accept(payrolVisitor);
            organisationalStructure.Accept(payRiseVisitor);

            Console.ReadLine();
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            Manager sefa = new Manager {
                Name = "Sefa", Salary = 1000
            };
            Manager irem = new Manager {
                Name = "İrem", Salary = 1000
            };

            Worker Ozi = new Worker {
                Name = "Ozi", Salary = 450
            };
            Worker Kemal = new Worker {
                Name = "Kemal", Salary = 760
            };

            sefa.Subordinates.Add(irem);
            irem.Subordinates.Add(Ozi);
            irem.Subordinates.Add(Kemal);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(sefa);

            PayrolVisitor  payrolVisitor  = new PayrolVisitor();
            PayriseVisitor payriseVisitor = new PayriseVisitor();

            organisationalStructure.Accept(payrolVisitor);
            organisationalStructure.Accept(payriseVisitor);

            Console.ReadLine();
        }
Beispiel #14
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();
        }
        static void Main(string[] args)
        {
            Manager bob = new Manager();

            bob.Name          = "Bob";
            bob.MonthlySalary = 5000;

            Manager sue = new Manager();

            sue.Name          = "Sue";
            sue.MonthlySalary = 4000;

            Worker jim = new Worker();

            jim.Name          = "Jim";
            jim.MonthlySalary = 2000;

            Worker tom = new Worker();

            tom.Name          = "Tom";
            tom.MonthlySalary = 1800;

            Worker mel = new Worker();

            mel.Name          = "Mel";
            mel.MonthlySalary = 1900;

            bob.Subordinates.Add(sue);
            bob.Subordinates.Add(jim);
            sue.Subordinates.Add(tom);
            sue.Subordinates.Add(mel);

            OrganisationalStructure org = new OrganisationalStructure(bob);

            PayrollVisitor payroll = new PayrollVisitor();
            PayriseVisitor payrise = new PayriseVisitor(0.05);

            org.Accept(payroll);
            org.Accept(payrise);
            org.Accept(payroll);

            Console.WriteLine("Total pay increase = {0}.", payrise.TotalIncrease);

            Console.Read();
        }
        static void Main(string[] args)
        {
            Manager ahmet = new Manager
            {
                Name   = "Ahmet",
                Salary = 1000
            };
            Manager aygn = new Manager
            {
                Name   = "Aygün",
                Salary = 1100
            };
            Manager can = new Manager
            {
                Name   = "can",
                Salary = 900
            };
            Worker leyla = new Worker
            {
                Name   = "Leyla",
                Salary = 800
            };
            Worker ali = new Worker
            {
                Name   = "Ali",
                Salary = 800
            };

            ahmet.Subordinates.Add(can);
            can.Subordinates.Add(aygn);
            aygn.Subordinates.Add(leyla);
            aygn.Subordinates.Add(ali);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(ahmet);
            PayrollVisitor          payrollVisitor          = new PayrollVisitor();
            PayriseVisitor          payriseVisitor          = new PayriseVisitor();

            organisationalStructure.Accept(payrollVisitor);
            organisationalStructure.Accept(payriseVisitor);
            Console.ReadKey();
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            /*Genel olarak birbirine benziyen ve hiyerarşi nesnelerin aynı methodunun biri üzerinden çağırılması.*/

            Manager manager1 = new Manager {
                Name = "okan", Salary = 1000
            };
            Manager manager2 = new Manager {
                Name = "cenk", Salary = 900
            };
            Worker worker = new Worker {
                Name = "Eleman", Salary = 500
            };
            Worker worker1 = new Worker {
                Name = "Eleman1", Salary = 500
            };
            Worker worker2 = new Worker {
                Name = "Eleman2", Salary = 500
            };

            manager1.Subordinates.Add(worker);
            manager1.Subordinates.Add(worker1);
            manager2.Subordinates.Add(worker2);

            OrganisationalStructure organisationalStructure = new OrganisationalStructure(manager1);

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

            organisationalStructure.Accept(payrollVisitor);
            organisationalStructure.Accept(payrise);



            Console.ReadLine();
        }