예제 #1
0
        public DeleteMedSuppsByPatientIdDataResponse DeletePatientMedSupps(DeleteMedSuppsByPatientIdDataRequest request)
        {
            DeleteMedSuppsByPatientIdDataResponse response = new DeleteMedSuppsByPatientIdDataResponse();
            var repo = StubRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp);

            repo.Delete(request);
            response.DeletedIds = new List <string> {
                request.Id
            };
            response.Success = true;
            return(response);
        }
예제 #2
0
        public void DeletePatientMedSupps_Test()
        {
            DeleteMedSuppsByPatientIdDataRequest request = new DeleteMedSuppsByPatientIdDataRequest
            {
                Context        = context,
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version,
                PatientId      = "54bdde96fe7a5b27384a9b76",
                Id             = "54c2bd30d433271e40fb9f11"
            };
            DeleteMedSuppsByPatientIdDataResponse response = cm.DeletePatientMedSupps(request);

            Assert.IsTrue(response.DeletedIds.Count == 1);
        }
예제 #3
0
        public DeleteMedSuppsByPatientIdDataResponse Delete(DeleteMedSuppsByPatientIdDataRequest request)
        {
            DeleteMedSuppsByPatientIdDataResponse response = new DeleteMedSuppsByPatientIdDataResponse {
                Version = request.Version
            };

            try
            {
                RequireUserId(request);
                response = Manager.DeletePatientMedSupps(request);
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
예제 #4
0
        public DeleteMedSuppsByPatientIdDataResponse DeletePatientMedSupps(DeleteMedSuppsByPatientIdDataRequest request)
        {
            DeleteMedSuppsByPatientIdDataResponse response = null;

            try
            {
                response = new DeleteMedSuppsByPatientIdDataResponse();

                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp);
                GetPatientMedSuppsDataRequest getAllPatientMedSuppsDataRequest = new GetPatientMedSuppsDataRequest
                {
                    Context        = request.Context,
                    ContractNumber = request.ContractNumber,
                    PatientId      = request.PatientId,
                    UserId         = request.UserId,
                    Version        = request.Version
                };
                List <PatientMedSuppData> patientMedSupps = repo.FindByPatientId(getAllPatientMedSuppsDataRequest) as List <PatientMedSuppData>;
                List <string>             deletedIds      = null;
                if (patientMedSupps != null)
                {
                    deletedIds = new List <string>();
                    patientMedSupps.ForEach(u =>
                    {
                        DeletePatientMedSuppDataRequest deletePMSDataRequest = new DeletePatientMedSuppDataRequest
                        {
                            Context        = request.Context,
                            ContractNumber = request.ContractNumber,
                            Id             = u.Id,
                            UserId         = request.UserId,
                            Version        = request.Version
                        };
                        repo.Delete(deletePMSDataRequest);
                        deletedIds.Add(deletePMSDataRequest.Id);
                    });
                    response.DeletedIds = deletedIds;
                }
                response.Success = true;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }