public AssignContactsToCohortPatientViewDataResponse Put(AssignContactsToCohortPatientViewDataRequest request) { var response = new AssignContactsToCohortPatientViewDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientDD:AssignContactsToCohortPatientViewDataRequest()::Unauthorized Access"); } var managerResponse = PatientManager.AssignContactsToCohortPatientView(request); response.IsSuccessful = managerResponse.IsSuccessful; response.Version = request.Version; } catch (Exception ex) { response.IsSuccessful = false; CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); var aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Helpers.LogException(int.Parse(aseProcessID), ex); } return(response); }
public PutPatientDataResponse Put(PutPatientDataRequest request) { PutPatientDataResponse response = new PutPatientDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientDD:Put()::Unauthorized Access"); } response = PatientManager.InsertPatient(request); response.Version = request.Version; //throw new Exception("Just a test error"); } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Helpers.LogException(int.Parse(aseProcessID), ex); } return(response); }
public GetPatientSystemsResponse Get(GetPatientSystemsRequest request) { GetPatientSystemsResponse response = new GetPatientSystemsResponse(); ValidateTokenResponse result = null; try { if (base.Request != null) { request.Token = base.Request.Headers["Token"] as string; } result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber); if (result.UserId.Trim() != string.Empty) { ServiceContext.UserId = result.UserId; response.PatientSystems = PatientSystemManager.GetPatientSystems(ServiceContext, request.PatientId); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { PatientSystemManager.LogException(ex); } } finally { if (result != null) { List <string> patientIds = null; if (response.PatientSystems != null) { patientIds = response.PatientSystems.Select(x => x.PatientId).ToList(); } string browser = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType; string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress; AuditUtil.LogAuditData(request, result.SQLUserId, patientIds, browser, hostAddress, request.GetType().Name); } } return(response); }
public DeletePatientSystemsResponse Delete(DeletePatientSystemsRequest request) { DeletePatientSystemsResponse response = new DeletePatientSystemsResponse(); ValidateTokenResponse result = null; try { if (base.Request != null) { request.Token = base.Request.Headers["Token"] as string; } result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber); if (result.UserId.Trim() != string.Empty) { request.UserId = result.UserId; PatientSystemManager.DeletePatientSystems(request); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { PatientSystemManager.LogException(ex); } } finally { if (result != null) { string browser = (base.Request != null) ? base.Request.UserAgent : unknownBrowserType; string hostAddress = (base.Request != null) ? base.Request.UserHostAddress : unknownUserHostAddress; AuditUtil.LogAuditData(request, result.SQLUserId, null, browser, hostAddress, request.GetType().Name); } } return(response); }
public GetAllActiveProgramsResponse Get(GetAllActiveProgramsRequest request) { GetAllActiveProgramsResponse response = new GetAllActiveProgramsResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("ProgramDD:Get()::Unauthorized Access"); } response = ProgramDataManager.GetAllActiveContractPrograms(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); }
public DeleteCohortPatientViewDataResponse Delete(DeleteCohortPatientViewDataRequest request) { DeleteCohortPatientViewDataResponse response = new DeleteCohortPatientViewDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientDD:DeleteCohortPatientView()::Unauthorized Access"); } response = PatientManager.DeleteCohortPatientViewByPatientId(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); }