예제 #1
0
        public ISchedule LoadSchedule(int id)
        {
            // Get basic information about schedule
            ISchedulePresentationData schedule = GetScheduleFromId(id);
            ISchedule output = new ScheduleModel(schedule.Id, schedule.Name, schedule.StartingDay, schedule.LastDay);

            // Get list of employees (without available working options for now)
            List <WorkingPlan> plans = GetWorkingPlans();
            List <IEmployeePresentationData> employeeData = GetEmployees();
            List <IEmployee> employeesWithoutWorkingPlan  = common.GetEmployeesWithoutWorkingPlan(plans, employeeData, output);

            // Fill in the list of employees with available options
            List <IEmployee> employees = new List <IEmployee>();
            List <WorkingOptionOfEmployee> workingOptionOfEmployees = GetWorkingOptionOfEmployees();
            List <IWorkingOption>          workingOptions           = GetWorkingOptions();

            common.FillEmployeesWithWorkingOptions(employees, employeesWithoutWorkingPlan, workingOptionOfEmployees, workingOptions, output);

            // Add each employee to output schedule
            employees.ForEach(e => output.AddEmployee(e));

            // Get working plan for each employee
            common.GetWorkingPlanForEmployees(employees, plans, output);
            return(output);
        }