public EmployeeCollectionStatus GetStatus(IEnumerable <Employee> employees, Domain.Entity.LearningCalendar.Topic topic)
        {
            var collectionStatus = new EmployeeCollectionStatus();

            foreach (Employee employee in employees)
            {
                var employeeStatus = _employeeTopicProgressStatusStrategy.GetStatus(employee, topic);
                switch (employeeStatus)
                {
                case Status.NotPlanned:
                    collectionStatus.OtherEmployees.Add(employee);
                    break;

                case Status.Planned:
                    collectionStatus.PlannedEmployees.Add(employee);
                    break;

                case Status.Learned:
                    collectionStatus.LearnedEmployees.Add(employee);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            AddTotalStatus(collectionStatus);

            return(collectionStatus);
        }
コード例 #2
0
        private GetTopicDetailsOperationResponse.Employee MapEmployee(Domain.Entity.LearningCalendar.Employee employee, Domain.Entity.LearningCalendar.Topic topic)
        {
            var status = _employeeTopicProgressStatusStrategy.GetStatus(employee, topic);

            return(new GetTopicDetailsOperationResponse.Employee
            {
                Id = employee.Id,
                FullName = employee.FullName,
                ProgressStatus = ProgressStatusMapper.MapStatus(status)
            });
        }
        private GetEmployeeTopicTreeOperationResponse.Topic MapTopic(
            Domain.Entity.LearningCalendar.Topic root,
            Domain.Entity.LearningCalendar.Employee employee)
        {
            var children = root.SubTopics
                           .Select(topic => MapTopic(topic, employee))
                           .ToList();

            var status = _employeeTopicProgressStatusStrategy.GetStatus(employee, root);

            return(new GetEmployeeTopicTreeOperationResponse.Topic
            {
                Id = root.Id,
                ParentId = root.ParentTopicId,
                Subject = root.Subject,
                Description = root.Description,
                Children = children,
                Status = ProgressStatusMapper.MapStatus(status)
            });
        }