コード例 #1
0
        public PersonalRiskAssessmentDto MapWithChecklistGeneratorEmployeesAndChecklists(PersonalRiskAssessment entity)
        {
            var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as PersonalRiskAssessmentDto;

            //TODO: PTD - map this properly
            dto.ChecklistGeneratorEmployees = new EmployeeDtoMapper().MapWithNationalityAndContactDetailsAndEmergencyContactDetails(entity.ChecklistGeneratorEmployees.Select(x => x.Employee));
            
            //TODO: PTD - map this properly
            dto.Checklists = new ChecklistDtoMapper().Map(entity.Checklists.Select(x => x.Checklist));
            return dto;
        }
コード例 #2
0
 public FireRiskAssessmentDto MapWithEverything(FireRiskAssessment entity)
 {
     var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as FireRiskAssessmentDto;
     dto.PeopleAtRisk = PeopleAtRiskDtoMapper.Map(entity.PeopleAtRisk.Select(x => x.PeopleAtRisk).ToList());
     dto.FireSafetyControlMeasures = new FireRiskAssessmentControlMeasureDtoMapper().MapWithControlMeasure(entity.FireSafetyControlMeasures);
     dto.FireRiskAssessmentSourcesOfFuel = new FireRiskAssessmentSourceOfFuelDtoMapper().MapWithSourceOfFuel(entity.FireRiskAssessmentSourcesOfFuel);
     dto.FireRiskAssessmentSourcesOfIgnition = new FireRiskAssessmentSourceOfIgnitionDtoMapper().MapWithSourceOfIgnition(entity.FireRiskAssessmentSourcesOfIgnition);
     dto.LatestFireRiskAssessmentChecklist = new FireRiskAssessmentChecklistDtoMapper().MapWithChecklist(entity.LatestFireRiskAssessmentChecklist);
     dto.SignificantFindings = new SignificantFindingsDtoMapper().Map(entity.LatestFireRiskAssessmentChecklist.SignificantFindings.Where(x => x.Deleted == false).ToList());
     return dto;
 }
コード例 #3
0
        public void Given_personal_risk_assessment_and_employee_checklists_isnull_when_mapping_to_DTO_employee_checklists_is_empty_list()
        {
            var riskAss = new PersonalRiskAssessment();
            riskAss.EmployeeChecklists = null;

            var target = new RiskAssessmentDtoMapper();
            var riskAssDto = (PersonalRiskAssessmentDto)target.MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(riskAss);

            Assert.IsNotNull(riskAssDto.EmployeeChecklists);
            Assert.AreEqual(0, riskAssDto.EmployeeChecklists.Count());
        }
コード例 #4
0
        public FireRiskAssessmentDto MapWithFireSafetyControlMeasuresAndPeopleAtRiskAndSourcesOfFuelAndSourcesOfIgnition(FireRiskAssessment entity)
        {
            var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as FireRiskAssessmentDto;

            //TODO: PTD - map this properly
            dto.PeopleAtRisk = PeopleAtRiskDtoMapper.Map(entity.PeopleAtRisk.Select(x => x.PeopleAtRisk).ToList());

            dto.FireSafetyControlMeasures = new FireRiskAssessmentControlMeasureDtoMapper().MapWithControlMeasure(entity.FireSafetyControlMeasures);
            dto.FireRiskAssessmentSourcesOfFuel = new FireRiskAssessmentSourceOfFuelDtoMapper().MapWithSourceOfFuel(entity.FireRiskAssessmentSourcesOfFuel);
            dto.FireRiskAssessmentSourcesOfIgnition = new FireRiskAssessmentSourceOfIgnitionDtoMapper().MapWithSourceOfIgnition(entity.FireRiskAssessmentSourcesOfIgnition);
            return dto;
        }
コード例 #5
0
        public void Given_personal_risk_assessment_with_employee_checklists_when_mapping_to_DTO_employee_checklists_are_mapped()
        {
            var riskAss = new PersonalRiskAssessment();
            riskAss.EmployeeChecklists = new List<EmployeeChecklist>()
                                             {
                                                 new EmployeeChecklist {Id = Guid.NewGuid()}
                                                 , new EmployeeChecklist() {Id = Guid.NewGuid()}
                                             };
            
            var target = new RiskAssessmentDtoMapper();
            var riskAssDto = (PersonalRiskAssessmentDto) target.MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(riskAss);

            Assert.IsNotNull(riskAssDto.EmployeeChecklists);
            Assert.AreEqual(riskAss.EmployeeChecklists.Count, riskAssDto.EmployeeChecklists.Count());
        }
コード例 #6
0
 public PersonalRiskAssessmentDto MapWithEmployeeChecklists(PersonalRiskAssessment entity)
 {
     var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as PersonalRiskAssessmentDto;
     dto.EmployeeChecklists = entity.EmployeeChecklists != null ? new EmployeeChecklistDtoMapper().Map(entity.EmployeeChecklists) : null;
     return dto;
 }
コード例 #7
0
        public virtual IEnumerable<PersonalRiskAssessmentDto> Search(SearchRiskAssessmentsRequest request)
        {
            var riskAssessments = _personalRiskAssessmentRepository.Search(
                request.Title,
                request.CompanyId,
                request.AllowedSiteIds,
                request.CreatedFrom,
                request.CreatedTo,
                request.SiteGroupId,
                request.SiteId,
                request.CurrentUserId,
                request.ShowDeleted,
                request.ShowArchived,
                request.Page,
                request.PageSize,
                request.OrderBy, 
                request.OrderByDirection
                );

            var riskAssessmentDtos = new RiskAssessmentDtoMapper().MapWithSiteAndRiskAssessor(riskAssessments);
            var personalRiskAssessmentDto = riskAssessmentDtos.Select(riskAssessmentDto => riskAssessmentDto as PersonalRiskAssessmentDto);
            return personalRiskAssessmentDto;
        }
コード例 #8
0
 public FireRiskAssessmentDto Map(FireRiskAssessment entity)
 {
     var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as FireRiskAssessmentDto;
     return dto;
 }
コード例 #9
0
 public FireRiskAssessmentDto MapWithSignificantFindings(FireRiskAssessment entity)
 {
     var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as FireRiskAssessmentDto;
     dto.SignificantFindings = new SignificantFindingsDtoMapper().Map(entity.LatestFireRiskAssessmentChecklist.SignificantFindings.Where(x => x.Deleted == false).ToList());
     return dto;
 }
コード例 #10
0
 public FireRiskAssessmentDto MapWithLatestFireRiskAssessmentChecklist(FireRiskAssessment entity)
 {
     var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as FireRiskAssessmentDto;
     dto.LatestFireRiskAssessmentChecklist = new FireRiskAssessmentChecklistDtoMapper().MapWithChecklist(entity.LatestFireRiskAssessmentChecklist);
     return dto;
 }