Пример #1
0
        public static void Main()
        {
            Employee peter =
                new Employee {
                EmployeeID = 1, Name = "peter", Rating = 3
            };

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

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

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

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

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

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

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

            michael.AddSubordinate(peter);
            michael.AddSubordinate(george);
            michael.AddSubordinate(john);

            justin.AddSubordinate(adam);
            justin.AddSubordinate(martin);
            justin.AddSubordinate(jenny);

            Console.WriteLine($"{Environment.NewLine}--- Employee can see their Performance " + "Summary --------");
            peter.PerformanceSummary();

            Console.WriteLine($"{Environment.NewLine}--- Supervisor can also see their " + "subordinates performance summary-----");
            michael.PerformanceSummary();

            Console.WriteLine($"{Environment.NewLine}Subordinate Performance Record:");

            foreach (IEmployee employee in michael.ListSubordinates)
            {
                employee.PerformanceSummary();
            }
        }
        static void Main(string[] args)
        {
            try
            {
                Employee fulano = new Employee {
                    EmployeeID = 1, Name = "Fulano", Rating = 3
                };
                Employee cicrano = new Employee {
                    EmployeeID = 2, Name = "Cricrano", Rating = 4
                };
                Employee bertolano = new Employee {
                    EmployeeID = 3, Name = "Bertolano", Rating = 5
                };

                Employee ryu = new Employee {
                    EmployeeID = 1, Name = "Ryu", Rating = 3
                };
                Employee ken = new Employee {
                    EmployeeID = 2, Name = "Ken", Rating = 4
                };

                Supervisor chefao_1 = new Supervisor {
                    EmployeeID = 7, Name = "Chefão 1", Rating = 3
                };
                Supervisor chefao_2 = new Supervisor {
                    EmployeeID = 7, Name = "Chefão 2", Rating = 3
                };

                chefao_1.AddSubordinate(fulano);
                chefao_1.AddSubordinate(cicrano);
                chefao_1.AddSubordinate(bertolano);

                chefao_2.AddSubordinate(ryu);
                chefao_2.AddSubordinate(ken);

                Console.WriteLine("--- Employes  --------");
                fulano.PerformanceSummary();
                cicrano.PerformanceSummary();
                bertolano.PerformanceSummary();

                ryu.PerformanceSummary();
                ken.PerformanceSummary();

                Console.WriteLine("--- Superwiser and yours employes -----");

                chefao_1.PerformanceSummary();

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

                chefao_2.PerformanceSummary();

                Console.WriteLine("Subordinate s:");
                foreach (Employee employee in chefao_2.ListSubordinates)
                {
                    employee.PerformanceSummary();
                }
            }
            finally
            {
                Console.ReadKey();
            }
        }
Пример #3
0
        static void Main()
        {
            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
            };

            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 ronny =
                new Supervisor {
                EmployeeID = 7, Name = "ronny", Rating = 3
            };

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

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

            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();
        }
        static void Main()
        {
            Employee employee1 = new Employee()
            {
                EmployeeId   = 1,
                EmployeeName = "Adam",
                Rating       = 4
            };

            Employee employee2 = new Employee()
            {
                EmployeeId   = 1,
                EmployeeName = "Bill",
                Rating       = 5
            };

            Employee employee3 = new Employee()
            {
                EmployeeId   = 1,
                EmployeeName = "David",
                Rating       = 5
            };

            Supervisor supervisor1 = new Supervisor()
            {
                EmployeeId   = 3,
                EmployeeName = "Chris",
                Rating       = 3
            };

            Supervisor supervisor2 = new Supervisor()
            {
                EmployeeId   = 4,
                EmployeeName = "Elan",
                Rating       = 5
            };

            supervisor1.AddSubordinates(employee1);
            supervisor1.AddSubordinates(employee2);
            supervisor2.AddSubordinates(employee3);

            List <Supervisor> supervisors = new List <Supervisor>();

            supervisors.Add(supervisor1);
            supervisors.Add(supervisor2);

            foreach (Supervisor supervisor in supervisors)
            {
                Console.WriteLine("Performance Summary of Supervisor");
                supervisor.PerformanceReview();

                Console.WriteLine($"{Environment.NewLine}Performance Summary of Employees");
                foreach (Employee employee in supervisor.employees)
                {
                    employee.PerformanceReview();
                }
                Console.WriteLine();
            }

            Console.Read();
        }