/// <summary> /// Processes the single aggregate. /// </summary> /// <param name="dto">The dto to process.</param> /// <param name="staff">The staff.</param> /// <returns>A <see cref="System.Boolean"/></returns> protected override bool ProcessSingleAggregate(StaffSystemRolesDto dto, Staff staff) { var mappingResult = true; mappingResult &= new AggregateNodeLookupCollectionMapper <StaffSystemRoleDto, Staff, StaffSystemRole> ( dto.TaskGroupRoles, staff, staff.SystemRoles) .MapAddedItem(AddTaskGroupSystemRole) .MapRemovedItem(RemoveTaskGroupSystemRole) .FindCollectionEntity((pr, key) => staff.SystemRoles.FirstOrDefault(r => r.Key == key)) .Map(); mappingResult &= new AggregateNodeLookupCollectionMapper <StaffSystemRoleDto, Staff, StaffSystemRole> ( dto.TaskRoles, staff, staff.SystemRoles) .MapAddedItem(AddTaskSystemRole) .MapRemovedItem(RemoveTaskSystemRole) .FindCollectionEntity((pr, key) => staff.SystemRoles.FirstOrDefault(r => r.Key == key)) .Map(); if (dto.JobFunctionRole != null && dto.JobFunctionRole.SystemRole.Key > 0) { var systemRole = Session.Load <SystemRole> (dto.JobFunctionRole.SystemRole.Key); staff.ReviseJobFunctionRole(systemRole); } else { staff.RemoveJobFunctionRole(); } return(mappingResult); }
/// <summary> /// Processes the single aggregate. /// </summary> /// <param name="patientOtherConsiderationsDto">The patient other considerations dto.</param> /// <param name="patient">The patient.</param> /// <returns>A <see cref="System.Boolean"/></returns> protected override bool ProcessSingleAggregate(PatientOtherConsiderationsDto patientOtherConsiderationsDto, Patient patient) { var language = _mappingHelper.MapLookupField <Language> (patientOtherConsiderationsDto.Language); var smokingStatus = _mappingHelper.MapLookupField <SmokingStatus> (patientOtherConsiderationsDto.SmokingStatus); patient.ReviseLanguage(new PatientLanguage(language, patientOtherConsiderationsDto.InterpreterNeededIndicator)); patient.ReviseSmokingStatus(smokingStatus); patient.ReviseNotes(patientOtherConsiderationsDto.Note); patient.RevisePaperRecord(patientOtherConsiderationsDto.PaperFileIndicator); // Process Disabilities var patientDisabilityResult = new AggregateNodeLookupCollectionMapper <LookupValueDto, Patient, PatientDisability> ( patientOtherConsiderationsDto.Disabilities, patient, patient.Disabilities) .MapAddedItem(AddPatientDisability) .MapRemovedItem((raceDto, localPatient, patientDisability) => localPatient.RemovePatientDisabilility(patientDisability)) .FindCollectionEntity((pr, key) => patient.Disabilities.FirstOrDefault(r => r.Disability.Key == key)) .Map(); // Process Special Needs var patientSpecialNeedResult = new AggregateNodeLookupCollectionMapper <LookupValueDto, Patient, PatientSpecialNeed> ( patientOtherConsiderationsDto.SpecialNeeds, patient, patient.SpecialNeeds) .MapAddedItem(AddPatientSpecialNeed) .MapRemovedItem((raceDto, localPatient, patientSpecialNeed) => localPatient.RemovePatientSpecialNeed(patientSpecialNeed)) .FindCollectionEntity((pr, key) => patient.SpecialNeeds.FirstOrDefault(r => r.SpecialNeed.Key == key)) .Map(); return(patientDisabilityResult && patientSpecialNeedResult); }
private bool MapSpecialInitiatives(ClinicalCaseProfileDto dto, ClinicalCase clinicalCase) { var specialInitiativeResult = new AggregateNodeLookupCollectionMapper <LookupValueDto, ClinicalCase, ClinicalCaseSpecialInitiative> ( dto.SpecialInitiatives, clinicalCase, clinicalCase.SpecialInitiatives) .MapAddedItem(AddSpecialInitiative) .MapRemovedItem( (specialInitiativeDto, localClinicalCase, specialInitiative) => localClinicalCase.RemoveSpecialInitiative(specialInitiative)) .FindCollectionEntity((pr, key) => clinicalCase.SpecialInitiatives.FirstOrDefault(r => r.SpecialInitiative.Key == key)) .Map(); return(specialInitiativeResult); }
private bool MapPriorityPopulations(ClinicalCaseProfileDto dto, ClinicalCase clinicalCase) { var priorityPopulationResult = new AggregateNodeLookupCollectionMapper <LookupValueDto, ClinicalCase, ClinicalCasePriorityPopulation> ( dto.PriorityPopulations, clinicalCase, clinicalCase.PriorityPopulations) .MapAddedItem(AddPriorityPopulation) .MapRemovedItem( (priorityPopulationDto, localClinicalCase, priorityPopulation) => localClinicalCase.RemovePriorityPopulation(priorityPopulation)) .FindCollectionEntity((pr, key) => clinicalCase.PriorityPopulations.FirstOrDefault(r => r.PriorityPopulation.Key == key)) .Map(); return(priorityPopulationResult); }
/// <summary> /// Processes the single aggregate. /// </summary> /// <param name="patientRaceAndEthnicityDto">The patient race and ethnicity dto.</param> /// <param name="patient">The patient.</param> /// <returns>A <see cref="System.Boolean"/></returns> protected override bool ProcessSingleAggregate(PatientRaceAndEthnicityDto patientRaceAndEthnicityDto, Patient patient) { var patientRaceResult = new AggregateNodeLookupCollectionMapper <LookupValueDto, Patient, PatientRace> ( patientRaceAndEthnicityDto.Races, patient, patient.Races) .MapAddedItem(AddPatientRace) .MapRemovedItem((raceDto, localPatient, patientRace) => localPatient.RemovePatientRace(patientRace)) .FindCollectionEntity((pr, key) => patient.Races.FirstOrDefault(r => r.Race.Key == key)) .Map(); var race = _mappingHelper.MapLookupField <Race> (patientRaceAndEthnicityDto.PrimaryRace); patient.SetPrimaryRace(race); var ethnicity = _mappingHelper.MapLookupField <Ethnicity> (patientRaceAndEthnicityDto.Ethnicity); var detailedEthnicity = _mappingHelper.MapLookupField <DetailedEthnicity> (patientRaceAndEthnicityDto.DetailedEthnicity); patient.ReviseEthnicity(new PatientEthnicity(ethnicity, detailedEthnicity)); return(patientRaceResult); }