public void CreatePatientDonorRequestsRelation(int patientRequestId, int donorRequestId)
        {
            var patientRequest = _patientRequestsRepository.GetById(patientRequestId);

            if (patientRequest == null)
            {
                throw new ArgumentException(nameof(patientRequestId));
            }

            var donorRequest = _donorRequestsRepository.GetById(donorRequestId);

            if (donorRequest == null)
            {
                throw new ArgumentException(nameof(donorRequestId));
            }

            var relation = new RequestsRelation()
            {
                PatientRequestId = patientRequestId,
                DonorRequestId   = donorRequestId,
                IsActive         = true
            };

            patientRequest.Status = PatientRequestStatuses.AwaitingForTransplanting;
            donorRequest.Status   = DonorRequestStatuses.NeedToScheduleTimeForOrganRetrieving;

            _donorRequestsRepository.Update(donorRequest);
            _patientRequestsRepository.Update(patientRequest);
            _requestsRelationsRepository.Add(relation);

            //TODO: send email to clinic/patient/donor that query status has been changed
        }
예제 #2
0
        public void ChangePatientRequestStatus(int patientRequestId, PatientRequestStatuses status)
        {
            var patientOrganQuery = _patientRequestsRepository.GetById(patientRequestId);

            if (patientOrganQuery == null)
            {
                throw new ArgumentException(nameof(patientRequestId));
            }

            if (!Enum.IsDefined(typeof(PatientRequestPriority), patientOrganQuery.Priority))
            {
                patientOrganQuery.Priority = PatientRequestPriority.Normal;
            }

            patientOrganQuery.Status = status;

            _patientRequestsRepository.Update(patientOrganQuery);

            //TODO: send email to clinic that query status has been changed
        }