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(); }
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(); }
//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(); }
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 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(); }
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(); }
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(); }
static void Main(string[] args) { Manager muhsin = new Manager() { Name = "Muhsin", Salary = 1000 }; Manager ahmet = new Manager() { Name = "Ahmet", Salary = 1000 }; Worker selin = new Worker() { Name = "Selin", Salary = 800 }; Worker ufuk = new Worker() { Name = "Ufuk", Salary = 800 }; muhsin.SubOrdinates.Add(selin); ahmet.SubOrdinates.Add(ufuk); OrganitionalStructure organitionalStructure = new OrganitionalStructure(muhsin); PayrollVisitor payrollVisitor = new PayrollVisitor(); PayriseVisitor payriseVisitor = new PayriseVisitor(); organitionalStructure.Accept(payrollVisitor); organitionalStructure.Accept(payriseVisitor); }
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(); }