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; }
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; }
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()); }
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; }
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()); }
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; }
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; }
public FireRiskAssessmentDto Map(FireRiskAssessment entity) { var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as FireRiskAssessmentDto; return dto; }
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; }
public FireRiskAssessmentDto MapWithLatestFireRiskAssessmentChecklist(FireRiskAssessment entity) { var dto = new RiskAssessmentDtoMapper().MapWithEmployeesAndNonEmployeesAndSiteAndRiskAssessor(entity) as FireRiskAssessmentDto; dto.LatestFireRiskAssessmentChecklist = new FireRiskAssessmentChecklistDtoMapper().MapWithChecklist(entity.LatestFireRiskAssessmentChecklist); return dto; }