Exemplo n.º 1
0
 public void Execute()
 {
     try
     {
         // [Route("/{Context}/{Version}/{ContractNumber}/Program/{Id}/Delete", "DELETE")]
         string ppUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Program/{4}/Delete",
                                                             DDProgramServiceUrl,
                                                             "NG",
                                                             request.Version,
                                                             request.ContractNumber,
                                                             request.Id), request.UserId);
         DeletePatientProgramDataResponse ppDDResponse = client.Delete <DeletePatientProgramDataResponse>(ppUrl);
         if (ppDDResponse != null)
         {
             DeletedPatientProgram pp = ppDDResponse.DeletedPatientProgram;
             deletedPatientPrograms = new List <DeletedPatientProgram>()
             {
                 pp
             };
             if (!ppDDResponse.Success)
             {
                 Undo();
                 throw new Exception("Error occurred during AppDomain: PatientProgramCommand Execute method");
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception("AD: PatientProgramCommand Execute::" + ex.Message, ex.InnerException);
     }
 }
Exemplo n.º 2
0
        public DeletePatientProgramDataResponse DeletePatientProgram(DeletePatientProgramDataRequest request)
        {
            DeletePatientProgramDataResponse response = null;
            bool success = false;

            try
            {
                response = new DeletePatientProgramDataResponse();
                IProgramRepository ppRepo = Factory.GetRepository(request, RepositoryType.PatientProgram);

                MEPatientProgram      mePP = ppRepo.FindByID(request.Id) as MEPatientProgram;
                DeletedPatientProgram deletedPatientProgram = null;

                if (mePP != null)
                {
                    if (delete(mePP, request, ppRepo, out deletedPatientProgram))
                    {
                        success = true;
                    }
                }
                else
                {
                    success = true;
                }
                response.DeletedPatientProgram = deletedPatientProgram;
                response.Success = success;
                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public void DeletePatientProgram_Test()
        {
            double      version        = 1.0;
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            string      programId      = "53d0349bd6a4850d589d67b1";
            string      userId         = "000000000000000000000000";
            string      ddUrl          = "http://localhost:8888/Program";
            IRestClient client         = new JsonServiceClient();

            //[Route("/{Context}/{Version}/{ContractNumber}/Program/{Id}/Delete", "DELETE")]
            string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Program/{4}/Delete",
                                                              ddUrl,
                                                              context,
                                                              version,
                                                              contractNumber,
                                                              programId), userId);
            DeletePatientProgramDataResponse response = client.Delete <DeletePatientProgramDataResponse>(url);

            Assert.IsNotNull(response);
        }
Exemplo n.º 4
0
        public DeletePatientProgramDataResponse Delete(DeletePatientProgramDataRequest request)
        {
            DeletePatientProgramDataResponse response = new DeletePatientProgramDataResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("ProgramDD:PatientProgramDelete()::Unauthorized Access");
                }

                response         = ProgramDataManager.DeletePatientProgram(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }