Ejemplo n.º 1
0
        /// <summary>
        /// Handles the request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        protected override void HandleRequest(DeleteProgramOfferingRequest request, DeleteProgramOfferingResponse response)
        {
            var programOffering = _programOfferingRepository.GetByKey(request.ProgramOfferingKey);

            if (programOffering != null)
            {
                _programOfferingFactory.DestroyProgramOffering(programOffering);

                if (Success)
                {
                    FlushSession();

                    var programOfferings = _programOfferingRepository.GetProgramOfferingsByLocationKey(request.LocationKey);
                    var dtos             = Mapper.Map <IList <ProgramOffering>, IList <ProgramOfferingDto> > (programOfferings);
                    response.ProgramOfferingDtos = dtos;
                }
            }
        }
        /// <summary>
        /// Handles the request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        protected override void HandleRequest(CreateProgramEnrollmentRequest request, CreateProgramEnrollmentResponse response)
        {
            var programOffering = _programOfferingRepository.GetByKey(request.ProgramOfferingKey);
            var clinicalCase    = _clinicalCaseRepository.GetByKey(request.ClinicalCaseKey);
            var enrollmentDate  = request.EnrollmentDate;
            var enrollingStaff  = _staffRepository.GetByKey(request.EnrollingStaffKey);

            var programEnrollment = _programEnrollmentFactory.CreateProgramEnrollment(
                programOffering, clinicalCase, enrollmentDate, enrollingStaff);

            if (programEnrollment != null)
            {
                programEnrollment.ReviseDaysOnWaitingListCount(request.DaysOnWaitingListCount);
                programEnrollment.ReviseComments(request.CommentsNote);

                if (Success)
                {
                    FlushSession();

                    var dto = Mapper.Map <ProgramEnrollment, ProgramEnrollmentDto> (programEnrollment);
                    response.DataTransferObject = dto;
                }
            }
        }