Пример #1
0
        static void Main(string[] args)
        {
            //start with creating some employees:
            Employee lucy = new Employee {
                EmployeeID = 1,
                Name       = "Lucy", Rating = 4
            };
            Employee ricky = new Employee {
                EmployeeID = 2,
                Name       = "Ricky", Rating = 3
            };
            Employee ginger = new Employee {
                EmployeeID = 3,
                Name       = "Ginger", Rating = 5
            };

            //and supervisors:
            Supervisor thurston = new Supervisor {
                EmployeeID = 4,
                Name       = "Thurston", Rating = 4
            };
            Supervisor donna = new Supervisor {
                EmployeeID = 5,
                Name       = "Donna", Rating = 5
            };

            //create their supervisor/employee relationships:
            thurston.AddSubordinate(lucy);
            donna.AddSubordinate(ricky);
            donna.AddSubordinate(ginger);

            Console.WriteLine("Employee can see their performance summary:");
            lucy.PerformanceSummary();

            Console.WriteLine("Supervisors can see their subordinates:");
            donna.PerformanceSummary();

            Console.WriteLine("Subordinate performaces:");
            foreach (Employee employee in donna.ListSubordinates)
            {
                employee.PerformanceSummary();
            }

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Employee ricky =
                new Employee {
                EmployeeID = 1, Name = "ricky", Rating = 3
            };

            Employee mike =
                new Employee {
                EmployeeID = 2, Name = "mike", Rating = 4
            };

            Employee maryann =
                new Employee {
                EmployeeID = 3, Name = "maryann", Rating = 5
            };

            Supervisor ronny =
                new Supervisor {
                EmployeeID = 7, Name = "ronny", Rating = 3
            };

            ronny.AddSubordinate(ricky);
            ronny.AddSubordinate(mike);
            ronny.AddSubordinate(maryann);

            Employee ginger =
                new Employee {
                EmployeeID = 4, Name = "ginger", Rating = 3
            };

            Employee olive =
                new Employee {
                EmployeeID = 5, Name = "olive", Rating = 4
            };

            Employee candy =
                new Employee {
                EmployeeID = 6, Name = "candy", Rating = 5
            };

            Supervisor bobby =
                new Supervisor {
                EmployeeID = 8, Name = "bobby", Rating = 3
            };

            bobby.AddSubordinate(ginger);
            bobby.AddSubordinate(olive);
            bobby.AddSubordinate(candy);

            Console.WriteLine("\n--- Employee can see their Performance " +
                              "Summary --------");
            ricky.PerformanceSummary();

            Console.WriteLine("\n--- Supervisor can also see their " +
                              "subordinates performance summary-----");
            ronny.PerformanceSummary();

            Console.WriteLine("\nSubordinate Performance Record:");
            foreach (Employee employee in ronny.ListSubordinates)
            {
                employee.PerformanceSummary();
            }

            Console.ReadLine();
        }