/// <summary> /// Посмотреть отчет по конкретному сотруднику, вызов метода происходит из объекта класса Leader /// </summary> private static void Leader_ViewEmployeeReport() { Employee employee = new Employee(); employee = FindEmployeeInFile(); if (employee != null) { FileIOService file; ReportingService repService = new ReportingService(Output.ReportForPeriod(), Input.EnterDateForReport()); List <string> listReport = new List <string>(); switch (employee.Role) { case "руководитель": file = new FileIOService("Список отработанных часов руководителей"); listReport = repService.CreateReport(file.LoadListOfWorkingHoursForSpecificEmployee(employee)); Output.EmployeeListOfHoursWorked(listReport, employee, repService); break; case "сотрудник": file = new FileIOService("Список отработанных часов сотрудников на зарплате"); listReport = repService.CreateReport(file.LoadListOfWorkingHoursForSpecificEmployee(employee)); Output.EmployeeListOfHoursWorked(listReport, employee, repService); break; case "фрилансер": file = new FileIOService("Список отработанных часов внештатных сотрудников"); listReport = repService.CreateReport(file.LoadListOfWorkingHoursForSpecificEmployee(employee)); Output.EmployeeListOfHoursWorked(listReport, employee, repService); break; } } }
/// <summary> /// Посмотреть отчет за период, вызов метода происходит из объекта класса Freelancer. /// </summary> private static void Freelancer_EventViewReport(Freelancer freelancer) { FileIOService file = new FileIOService("Список отработанных часов внештатных сотрудников"); List <string> listReport = new List <string>(); ReportingService repService = new ReportingService(Output.ReportForPeriod(), Input.EnterDateForReport()); Employee employee = new Employee(freelancer.Name, freelancer.Surname, "фрилансер"); listReport = repService.CreateReport(file.LoadListOfWorkingHoursForSpecificEmployee((Employee)freelancer)); Output.EmployeeListOfHoursWorked(listReport, employee, repService); }
/// <summary> /// Посмотреть отчет за период, вызов метода происходит из объекта класса Staff. /// </summary> private static void Staff_EventViewReport(Staff staff) { FileIOService file = new FileIOService("Список отработанных часов сотрудников на зарплате"); List <string> listReport = new List <string>(); ReportingService repService = new ReportingService(Output.ReportForPeriod(), Input.EnterDateForReport()); Employee employee = new Employee(staff.Name, staff.Surname, "сотрудник"); listReport = repService.CreateReport(file.LoadListOfWorkingHoursForSpecificEmployee((Employee)staff)); Output.EmployeeListOfHoursWorked(listReport, employee, repService); }
/// <summary> /// Посмотреть отчет по всем сотрудникам, вызов метода происходит из объекта класса Leader /// </summary> private static void Leader_ViewReportForAllEmployees() { List <Employee> listEmployees = new List <Employee>(); listEmployees = LoadListOfEmployeesFromFile(); FileIOService file; List <string> listHoursWorked = new List <string>();; List <string> listReport = new List <string>(); ReportingService repService = new ReportingService(Output.ReportForPeriod(), Input.EnterDateForReport()); foreach (var employee in listEmployees) { if (employee.Role == "руководитель") { file = new FileIOService("Список отработанных часов руководителей"); listReport = repService.CreateReport(file.LoadListOfWorkingHoursForSpecificEmployee(employee)); Output.EmployeeListOfHoursWorked(listReport, employee, repService); } listReport.Clear(); } foreach (var employee in listEmployees) { if (employee.Role == "сотрудник") { file = new FileIOService("Список отработанных часов сотрудников на зарплате"); listReport = repService.CreateReport(file.LoadListOfWorkingHoursForSpecificEmployee(employee)); Output.EmployeeListOfHoursWorked(listReport, employee, repService); } listReport.Clear(); } foreach (var employee in listEmployees) { if (employee.Role == "фрилансер") { file = new FileIOService("Список отработанных часов внештатных сотрудников"); listReport = repService.CreateReport(file.LoadListOfWorkingHoursForSpecificEmployee(employee)); Output.EmployeeListOfHoursWorked(listReport, employee, repService); } listReport.Clear(); } }