コード例 #1
0
ファイル: Program.cs プロジェクト: itstallie/c_sharp_hw
        static void Main(string[] args)
        {
            Corporate   parkwood  = new Corporate("Parkwood Entertainment");
            Subunit     marketing = new Subunit(1, "Marketing");
            Subunit     arts      = new Subunit(2, "Artists & Repertoire");
            Subunit     brands    = new Subunit(3, "Brands");
            Subunit     smed      = new Subunit(4, "Social media marketing");
            Subunit     tv        = new Subunit(5, "TV marketing");
            WhiteCollar bey       = new WhiteCollar("Beyonce", "Knowles", "CEO", "4/09/1981", true);
            WhiteCollar jlo       = new WhiteCollar("Jennifer", "Lopez", "Singer", "24/07/1969", false);
            WhiteCollar emgad     = new WhiteCollar("Emin", "Gadzhiev", "Marketing specialist", "22/01/2000", false);

            marketing.AddSubUnit(smed);
            marketing.AddSubUnit(tv);
            arts.AddEmployee(bey);
            arts.AddEmployee(jlo);
            smed.AddEmployee(emgad);
            emgad.SetHead();
            parkwood.AddDepartments(marketing);
            parkwood.AddDepartments(arts);
            parkwood.AddDepartments(brands);

            Console.WriteLine(parkwood.CorpName + " Hierarachy");

            foreach (Subunit subunit in parkwood.Departments)
            {
                PrintUnitInfo(subunit, 3);
            }
            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: itstallie/c_sharp_hw
 public static void PrintUnitInfo(Subunit subun, int indent)
 {
     Console.Write(new String(' ', indent));
     Console.WriteLine(subun.UnitName);
     indent++;
     foreach (Subunit depart in subun.SubUnits)
     {
         PrintUnitInfo(depart, indent);
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: itstallie/c_sharp_hw
 public void AddDepartments(Subunit depname)
 {
     Departments.Add(depname);
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: itstallie/c_sharp_hw
 public void AddSubUnit(Subunit sunitname)
 {
     SubUnits.Add(sunitname);
 }