コード例 #1
0
        static void Main(string[] args)
        {
            //bütün hiyerarşi sistemini yazdıktan sonra buraya geçiyoruz

            Employee yusuf = new Employee {
                Name = "Yusuf Sertbolat"
            };                                                          //öncelikle employee'leri çağırıyoruz
            Employee recep = new Employee {
                Name = "Recep Sertbolat"
            };

            yusuf.AddSubordinate(recep); // alt çalışan ekleme işlemi

            Employee kadir = new Employee {
                Name = "Kadir Sertbolat"
            };

            yusuf.AddSubordinate(kadir);

            Contractor sadık = new Contractor {
                Name = "Sadık Özkan"
            };                                                        //kadir alt çalışanına bir alt çalışan eklemek için

            kadir.AddSubordinate(sadık);

            Employee rabia = new Employee {
                Name = "Rabia Sertbolat"
            };

            yusuf.AddSubordinate(rabia);

            //bunların hepsi hiyerarşik model içindi şimdi isa alt satırlarda ekrana çizeceğiz
            Console.WriteLine(yusuf.Name);      //kendi ismimiz görünmesi için
            foreach (Employee manager in yusuf) //yöneticinin alt çalışanlarının görünmesi için
            {
                Console.WriteLine("  {0}", manager.Name);
                foreach (IPerson employee in manager) //eğer alt çalışana alt çalışan eklemeseydik Employee yazabilirdik ama eklediğimiz için IPerson dememiz daha uygun olur
                {
                    Console.WriteLine("    {0}", employee.Name);
                }
            }

            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ezgiakar/DesignPatterns
        static void Main(string[] args)
        {
            Employee olcay = new Employee {
                Name = "Olcay Akar"
            };
            Employee berat = new Employee {
                Name = "Berat Akar"
            };

            olcay.AddSubordinat(berat);

            Employee berkay = new Employee {
                Name = "Berkay Akar"
            };

            olcay.AddSubordinat(berkay);

            Employee ilknur = new Employee {
                Name = "İlknur Akar"
            };
            Contractor ali = new Contractor {
                Name = "Ali"
            };

            berkay.AddSubordinat(ali);



            berkay.AddSubordinat(ilknur);


            Console.WriteLine(olcay.Name);

            foreach (Employee manager in olcay)
            {
                Console.WriteLine("  {0}", manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("    {0}", employee.Name);
                }
            }

            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Employee engin = new Employee {
                Name = "Engin Demiroğ"
            };
            Employee salih = new Employee {
                Name = "Salih Demiroğ"
            };



            engin.AddSubOrdinate(salih);

            Employee derin = new Employee {
                Name = "Derin Demiroğ"
            };

            engin.AddSubOrdinate(derin);

            Contractor ali = new Contractor {
                Name = "Ali"
            };

            derin.AddSubOrdinate(ali);

            Employee ahmet = new Employee {
                Name = "ahmet Demiroğ"
            };

            salih.AddSubOrdinate(ahmet);


            Console.WriteLine(engin.Name);
            foreach (Employee manager in engin)
            {
                Console.WriteLine("  {0}", manager.Name);

                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("    {0}", employee.Name);
                }
            }
            Console.ReadLine();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: cmlbrnc/DesignPatterns
        static void Main(string[] args)
        {
            Employe cemil = new Employe
            {
                Name = "Cemil"
            };
            Employe taner = new Employe
            {
                Name = "taner"
            };

            cemil.AddSubordinate(taner);
            Employe talip = new Employe
            {
                Name = "Talib"
            };

            taner.AddSubordinate(talip);

            Employe ahmet = new Employe
            {
                Name = "Ahmet"
            };

            Contractor mert = new Contractor {
                Name = "ali"
            };

            taner.AddSubordinate(mert);

            cemil.AddSubordinate(ahmet);
            Console.WriteLine("{0}", cemil.Name);
            foreach (Employe manager in cemil)
            {
                Console.WriteLine("  {0}", manager.Name);
                foreach (IPerson employe in manager)
                {
                    Console.WriteLine("    {0}", employe.Name);
                }
            }

            Console.ReadLine();
        }
コード例 #5
0
        static void Main(string[] args)
        {
            Employee ahmet = new Employee {
                Name = "Ahmet Yılmaz"
            };

            Employee burak = new Employee {
                Name = "Burak Aktaş"
            };

            ahmet.AddSubordinate(burak);

            Employee berkay = new Employee {
                Name = "Berkay Yılmaz"
            };

            ahmet.AddSubordinate(berkay);

            Contractor görkem = new Contractor {
                Name = "Görkem"
            };

            berkay.AddSubordinate(görkem);

            Employee tuğra = new Employee {
                Name = "Tuğra Dönmez"
            };

            burak.AddSubordinate(tuğra);

            Console.WriteLine(ahmet.Name);

            foreach (Employee manager in ahmet)
            {
                Console.WriteLine("  {0}", manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("    {0}", employee.Name);
                }
            }

            Console.ReadLine();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Employee gokay = new Employee {
                Name = "Gökay"
            };

            Employee gokhan = new Employee {
                Name = "Gökhan"
            };

            gokay.AddSubordinate(gokhan);

            Employee kaan = new Employee {
                Name = "Kaan"
            };

            gokay.AddSubordinate(kaan);

            Contractor ali = new Contractor {
                Name = "Ali"
            };

            kaan.AddSubordinate(ali);

            Employee ahmet = new Employee {
                Name = "Ahmet"
            };

            gokhan.AddSubordinate(ahmet);

            Console.WriteLine(gokay.Name);
            foreach (Employee manager in gokay)
            {
                Console.WriteLine("  {0}", manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("    {0}", employee.Name);
                }
            }

            Console.ReadLine();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: hamitdogan17/DesignPatters
        static void Main(string[] args)
        {
            Employee employee1 = new Employee {
                Name = "Hamit Doğan"
            };
            Employee employee2 = new Employee {
                Name = "Fatih Doğan"
            };

            employee1.AddSubordinate(employee2);

            Employee recep = new Employee {
                Name = "Recep"
            };

            employee1.AddSubordinate(recep);

            Contractor serif = new Contractor {
                Name = "Serif"
            };

            recep.AddSubordinate(serif);

            Employee ahmet = new Employee {
                Name = "Yunus"
            };

            employee2.AddSubordinate(ahmet);

            Console.WriteLine(employee1.Name);
            foreach (Employee manager in employee1)
            {
                Console.WriteLine("   {0}", manager.Name);

                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("    {0}", employee.Name);
                }
            }

            Console.ReadLine();
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: bbalkn/DesignPatterns
        static void Main(string[] args)
        {
            Employee umut = new Employee {
                Name = "Umut Sepetci"
            };

            Employee arif = new Employee {
                Name = "Arif Sepetci"
            };

            umut.AddSubordinate(arif);

            Employee ahmet = new Employee {
                Name = "Ahmet Yıldız"
            };

            umut.AddSubordinate(ahmet);

            Employee mert = new Employee {
                Name = "Mert Şavkar"
            };

            arif.AddSubordinate(mert);

            Contractor berkan = new Contractor {
                Name = "Berkan Balkan"
            };

            ahmet.AddSubordinate(berkan);
            Console.WriteLine(umut.Name);
            foreach (Employee manager in umut)
            {
                Console.WriteLine(" {0}", manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("   {0}", employee.Name);
                }
            }

            Console.ReadLine();
        }
コード例 #9
0
        static void Main(string[] args)
        {
            Employee alikaan = new Employee()
            {
                Name = "Ali Kaan", Title = "Senior Software Engineer"
            };

            Employee merve = new Employee()
            {
                Name = "Merve", Title = "Junior Software Developer"
            };

            Employee duru = new Employee {
                Name = "Duru", Title = "Inter Developer"
            };

            Employee ender = new Employee {
                Name = "Ender", Title = "Inter Developer"
            };

            Contractor yesim = new Contractor {
                Name = "Yesim", Title = "Outsource Person"
            };

            duru.AddSubordinate(yesim);

            alikaan.AddSubordinate(merve);
            alikaan.AddSubordinate(duru);
            merve.AddSubordinate(ender);

            Console.WriteLine("{0} - {1}", alikaan.Name, alikaan.Title);
            foreach (Employee manager in alikaan)
            {
                Console.WriteLine("  {0} - {1}", manager.Name, manager.Title);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("    {0} - {1}", employee.Name, employee.Title);
                }
            }
            Console.ReadLine();
        }
コード例 #10
0
        static void Main(string[] args)
        {
            //bir kurumda çalışanlar ve çalışanların hiyerarşisini modellemede kullanılır.
            Employee fmv = new Employee {
                Name = "Fatih Varlı"
            };
            Employee zeynep = new Employee {
                Name = "Zeynep Varlı"
            };

            fmv.AddSubordinate(zeynep);//fatih için bir alt çalışan ekledik

            Employee irem = new Employee {
                Name = "İrem Varlı"
            };

            fmv.AddSubordinate(irem);

            Contractor derin = new Contractor {
                Name = "Derin"
            };

            irem.AddSubordinate(derin);

            Employee ali = new Employee {
                Name = "Ali Varlı"
            };

            zeynep.AddSubordinate(ali);
            Console.WriteLine(fmv.Name);
            foreach (Employee manager in fmv)
            {
                Console.WriteLine("  {0}", manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("    {0}", employee.Name);
                }
            }

            Console.ReadLine();
        }
コード例 #11
0
        static void Main(string[] args)
        {
            Employee manager1 = new Employee()
            {
                Name = "Yönetici1"
            };
            Employee employee1 = new Employee()
            {
                Name = "Çalışan1"
            };
            Employee employee2 = new Employee()
            {
                Name = "Çalışan2"
            };
            Employee employee3 = new Employee()
            {
                Name = "Çalışan3"
            };
            Contractor contractor1 = new Contractor()
            {
                Name = "Dışçalışan1"
            };

            manager1.AddSubordinate(employee1);
            manager1.AddSubordinate(employee2);
            employee1.AddSubordinate(employee3);
            employee2.AddSubordinate(contractor1);

            Console.WriteLine(manager1.Name);
            foreach (Employee manager in manager1)
            {
                Console.WriteLine("\t" + manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("\t\t" + employee.Name);
                }
            }

            Console.ReadKey();
        }
コード例 #12
0
        public static void Main(string[] args)
        {
            Employee emre = new Employee {
                Name = "Emre Karahan"
            };
            Employee badish = new Employee {
                Name = "Badiş Karahan"
            };
            Employee kokik = new Employee {
                Name = "Kökik Yaman"
            };
            Employee ahmet = new Employee {
                Name = "Ahmet"
            };
            Employee s2k = new Employee {
                Name = "S2k"
            };

            emre.AddSubOrdinate(badish);
            emre.AddSubOrdinate(kokik);
            badish.AddSubOrdinate(ahmet);
            ahmet.AddSubOrdinate(s2k);

            Contractor ali = new Contractor {
                Name = "Ali"
            };

            badish.AddSubOrdinate(ali);

            Console.WriteLine("-" + emre.Name);
            foreach (Employee manager in emre)
            {
                Console.WriteLine("--{0}", manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("---{0}", employee.Name);
                }
            }
        }
コード例 #13
0
        static void Main(string[] args)
        {
            Employee muhsin = new Employee
            {
                Name = "Muhsin Yolcu"
            };
            Employee ahmet = new Employee
            {
                Name = "Ahmet Yıldıran"
            };
            Employee ayse = new Employee
            {
                Name = "Ayse Yolcu"
            };
            Employee selin = new Employee
            {
                Name = "Selin Yolcu"
            };
            Contractor ali = new Contractor {
                Name = "Ali Ci"
            };

            ahmet.AddSubordinate(ali);

            muhsin.AddSubordinate(ahmet);
            muhsin.AddSubordinate(ayse);
            ayse.AddSubordinate(selin);

            Console.WriteLine(muhsin.Name);
            foreach (Employee manager in muhsin)
            {
                Console.WriteLine("     *{0}", manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("        *{0}", employee.Name);
                }
            }
            Console.ReadLine();
        }
コード例 #14
0
 {  // nesneler arası hiyararji ve istenilen zaman ulaşabilme
     static void Main(string[] args)
     {
         Employee okan = new Employee() { Name = "okan erdemir" };
         Employee salih = new Employee() { Name = "salih uçan" };
         okan.AddSubordinate(salih);
         Employee derin = new Employee() { Name = "derin uçan" };
         okan.AddSubordinate(derin);
         Contractor ali = new Contractor() { Name = "ali" };
         derin.AddSubordinate(ali);
         Employee ahmet = new Employee() { Name = "ahmet uçan" };
         salih.AddSubordinate(ahmet);
         Console.WriteLine(okan.Name);
         foreach (Employee manager in okan)
         {
             Console.WriteLine("  " + manager.Name);
             foreach (IPerson employee in manager)
             {
                 Console.WriteLine("    " + employee.Name);
             }
         }
         Console.ReadLine();
     }
コード例 #15
0
        static void Main(string[] args)
        {
            Employee caglar = new Employee {
                Name = "Caglar Durmus"
            };
            Employee songul = new Employee {
                Name = "Songul Sahin"
            };
            Employee ali = new Employee {
                Name = "ali"
            };
            Employee ahmet = new Employee {
                Name = "ahmet"
            };

            caglar.AddSubordinate(songul);
            caglar.AddSubordinate(ali);
            songul.AddSubordinate(ahmet);

            Contractor seyma = new Contractor {
                Name = "seyma"
            };

            songul.AddSubordinate(seyma);

            Console.WriteLine(caglar.Name);
            foreach (Employee manager in caglar)
            {
                Console.WriteLine("  {0}", manager.Name);
                foreach (IPerson employee in manager)
                {
                    Console.WriteLine("   {0}", employee.Name);
                }
            }

            Console.ReadLine();
        }