Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
        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; }
        }
Exemple #5
0
 public void Execute()
 {
     try
     {
         //[Route("/{Context}/{Version}/{ContractNumber}/PatientMedSupp/Patient/{PatientId}/Delete", "DELETE")]
         string pnUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientMedSupp/Patient/{4}/Delete",
                                                             DDMedicationUrl,
                                                             "NG",
                                                             request.Version,
                                                             request.ContractNumber,
                                                             request.Id), request.UserId);
         DeleteMedSuppsByPatientIdDataResponse pnDDResponse = client.Delete <DeleteMedSuppsByPatientIdDataResponse>(pnUrl);
         if (pnDDResponse != null && pnDDResponse.Success)
         {
             deletedIds = pnDDResponse.DeletedIds;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("AD: PatientMedSuppsCommand Execute::" + ex.Message, ex.InnerException);
     }
 }