/// <summary> /// Creates the keyed dto. /// </summary> /// <param name="key">The key to create.</param> /// <returns>A <see cref="Rem.Ria.PatientModule.Web.Common.ProgramEnrollmentDto"/></returns> public ProgramEnrollmentDto CreateKeyedDto(long key) { var problem = _programEnrollmentRepository.GetByKey(key); var dto = Mapper.Map <ProgramEnrollment, ProgramEnrollmentDto> (problem); return(dto); }
/// <summary> /// Handles the request. /// </summary> /// <param name="request">The request.</param> /// <param name="response">The response.</param> protected override void HandleRequest(GetProgramEnrollmentByKeyRequest request, GetProgramEnrollmentByKeyResponse response) { var programEnrollment = _prgramEnrollmentRepository.GetByKey(request.ProgramEnrollmentKey); if (programEnrollment != null) { var dto = Mapper.Map <ProgramEnrollment, ProgramEnrollmentDto> (programEnrollment); response.DataTransferObject = dto; } }
/// <summary> /// Handles the request. /// </summary> /// <param name="request">The request.</param> /// <param name="response">The response.</param> protected override void HandleRequest(DisenrollProgramEnrollmentRequest request, DisenrollProgramEnrollmentResponse response) { var programEnrollment = _programEnrollmentRepository.GetByKey(request.ProgramEnrollmentKey); var disenrollReason = _lookupValueRepository.GetLookupByKey <DisenrollReason> (request.DisenrollReasonKey); programEnrollment.Disenroll(request.DisenrollmentDate, disenrollReason, request.DisenrollOtherReasonNote); if (Success) { FlushSession(); // TODO: check if programEnrollment last updated date up-to-date after flush session // do we need get from DB again? var dto = Mapper.Map <ProgramEnrollment, ProgramEnrollmentDto> (programEnrollment); response.DataTransferObject = dto; } }
/// <summary> /// Handles the request. /// </summary> /// <param name="request">The request.</param> /// <param name="response">The response.</param> protected override void HandleRequest(ReviseProgramEnrollmentRequest request, ReviseProgramEnrollmentResponse response) { var programEnrollment = _programEnrollmentRepository.GetByKey(request.ProgramEnrollmentKey); var enrollingStaff = _staffRepository.GetByKey(request.EnrollingStaffKey); programEnrollment.ReviseEnrollmentDate(request.EnrollmentDate); programEnrollment.ReviseEnrollingStaff(enrollingStaff); programEnrollment.ReviseComments(request.CommentsNote); programEnrollment.ReviseDaysOnWaitingListCount(request.DaysOnWaitingListCount); if (Success) { FlushSession(); var dto = Mapper.Map <ProgramEnrollment, ProgramEnrollmentDto> (programEnrollment); response.DataTransferObject = dto; } }
/// <summary> /// Handles the request. /// </summary> /// <param name="request">The request.</param> /// <param name="response">The response.</param> protected override void HandleRequest(DeleteProgramEnrollmentRequest request, DeleteProgramEnrollmentResponse response) { var programEnrollment = _programEnrollmentRepository.GetByKey(request.ProgramEnrollmentKey); if (programEnrollment != null) { _programEnrollmentFactory.DestroyProgramEnrollment(programEnrollment); if (Success) { FlushSession(); var programEnrollments = _programEnrollmentRepository.GetProgramEnrollmentsByClinicalCase(programEnrollment.ClinicalCase.Key); var dtos = Mapper.Map <IList <ProgramEnrollment>, IList <ProgramEnrollmentDto> > (programEnrollments); response.ProgramEnrollmentDtos = dtos; } } }