public void InsertPatientSystems_Test() { List <DTO.PatientSystem> list = new List <DTO.PatientSystem>(); list.Add(new DTO.PatientSystem { PatientId = "5325dacad6a4850adcbba756", Value = " 79876 ", StatusId = 1, Primary = false, SystemId = "559e8c70d4332320bc076f4f", DataSource = "Engage" }); list.Add(new DTO.PatientSystem { PatientId = "5325dacad6a4850adcbba756", Value = " fkjhsdkfjhsdkfhksdjfhskdfyhsdfhjfhjkdddddddddddddddddddddddddduyyyyyyyyyyyyyyyyyyyhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiioooooooooossssssssssssss ", StatusId = 2, Primary = false, SystemId = "559e8c70d4332320bc076f4e", DataSource = "Import" }); InsertPatientSystemsRequest request = new InsertPatientSystemsRequest { ContractNumber = contractNumber, UserId = userId, Version = version, Token = token, PatientId = "5325dacad6a4850adcbba756", PatientSystems = list }; JsonServiceClient.HttpWebRequestFilter = x => x.Headers.Add(string.Format("{0}: {1}", "Token", token)); //[Route("/{Version}/{ContractNumber}/Patient/{PatientId}/PatientSystems", "POST")] InsertPatientSystemsResponse response = client.Post <InsertPatientSystemsResponse>(string.Format("{0}/{1}/{2}/Patient/{3}/PatientSystems", url, version, contractNumber, request.PatientId), request as object); Assert.IsNotNull(response); }
public InsertPatientSystemsResponse Post(InsertPatientSystemsRequest request) { InsertPatientSystemsResponse response = new InsertPatientSystemsResponse(); 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; ServiceContext.Tag = request.PatientSystems; response.PatientSystems = PatientSystemManager.InsertPatientSystems(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) { 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); }