Пример #1
0
        static void Main(string[] args)
        {
            Employee employee = new Employee();

            while (true)
            {
                Output.Greeting();

                employee = FindEmployeeInFile();

                if (employee.Role != null)
                {
                    Output.SurnameAndRole(employee.Surname, employee.Role);

                    switch (employee.Role)
                    {
                    case "руководитель":
                        Leader leader = new Leader(employee);
                        leader.EventAddEmployeeToFile         += Leader_AddEmployeeToFile;
                        leader.EventViewReportForAllEmployees += Leader_ViewReportForAllEmployees;
                        leader.EventViewEmployeeReport        += Leader_ViewEmployeeReport;
                        leader.EventAddWorkHours += Leader_AddWorkHours;
                        leader.EventExit         += Leader_Exit;
                        leader.ActionsOfLeader(Output.MenuForLeader());
                        break;

                    case "сотрудник":
                        Staff staff = new Staff(employee);
                        staff.EventAddWorkHours += Staff_EventAddWorkHours;
                        staff.EventViewReport   += Staff_EventViewReport;
                        staff.EventExit         += Staff_EventExit;
                        staff.ActionsOfStaff(Output.MenuForStaff());
                        break;

                    case "фрилансер":
                        Freelancer freelancer = new Freelancer(employee);
                        freelancer.EventAddWorkHours += Freelancer_EventAddWorkHours;
                        freelancer.EventViewReport   += Freelancer_EventViewReport;
                        freelancer.EventExit         += Freelancer_EventExit;
                        freelancer.ActionsOfFreelancer(Output.MenuForFreelancer());
                        break;
                    }
                }
            }
        }