public DeletePatientUserByPatientIdDataResponse DeletePatientUserByPatientId(DeletePatientUserByPatientIdDataRequest request) { DeletePatientUserByPatientIdDataResponse response = null; try { response = new DeletePatientUserByPatientIdDataResponse(); IPatientRepository patientUserRepo = Factory.GetRepository(request, RepositoryType.PatientUser); List <PatientUserData> puData = patientUserRepo.FindPatientUsersByPatientId(request.PatientId); List <string> deletedIds = null; if (puData != null) { deletedIds = new List <string>(); puData.ForEach(u => { request.Id = u.Id; patientUserRepo.Delete(request); deletedIds.Add(request.Id); }); response.DeletedIds = deletedIds; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }
public void DeletePatientUser_Test() { //[Route("/{Context}/{Version}/{ContractNumber}/PatientUser/Patient/{PatientId}/Delete", "DELETE")] string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientUser/Patient/{4}/Delete", ddUrl, context, version, contractNumber, patientId), userId); DeletePatientUserByPatientIdDataResponse response = client.Delete <DeletePatientUserByPatientIdDataResponse>(url); Assert.IsNotNull(response); }
public void Execute() { try { //[Route("/{Context}/{Version}/{ContractNumber}/PatientUser/Patient/{PatientId}/Delete", "DELETE")] string patientUserUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientUser/Patient/{4}/Delete", DDPatientServiceURL, "NG", request.Version, request.ContractNumber, request.Id), request.UserId); DeletePatientUserByPatientIdDataResponse patientUserDDResponse = client.Delete <DeletePatientUserByPatientIdDataResponse>(patientUserUrl); if (patientUserDDResponse != null && patientUserDDResponse.Success) { deletedIds = patientUserDDResponse.DeletedIds; } } catch (Exception ex) { throw new Exception("AD: PatientUserCommand Execute::" + ex.Message, ex.InnerException); } }
public DeletePatientUserByPatientIdDataResponse Delete(DeletePatientUserByPatientIdDataRequest request) { DeletePatientUserByPatientIdDataResponse response = new DeletePatientUserByPatientIdDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientDD:PatientUserDelete()::Unauthorized Access"); } response = PatientManager.DeletePatientUserByPatientId(request); response.Version = request.Version; } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Helpers.LogException(int.Parse(aseProcessID), ex); } return(response); }