public static PatientConfig PatientConfigurationToPatientConfigurationView(PatientConfiguration lPatientConfiguration) { if (lPatientConfiguration == null) { return(null); } PatientConfig lPatientConfigurationView = new PatientConfig() { PatientId = lPatientConfiguration.PatientId.ToString(), SetupId = lPatientConfiguration.SetupId, EquipmentType = lPatientConfiguration.EquipmentType, DeviceConfiguration = lPatientConfiguration.DeviceConfiguration, PatientSide = lPatientConfiguration.PatientSide, CurrentFlexion = lPatientConfiguration.CurrentFlexion, CurrentExtension = lPatientConfiguration.CurrentExtension, CurrentRestPosition = lPatientConfiguration.CurrentRestPosition, CreatedDate = lPatientConfiguration.CreatedDate, UpdatedDate = lPatientConfiguration.UpdatedDate, RxId = lPatientConfiguration.RxId, InstallerId = lPatientConfiguration.InstallerId, PatientFirstName = lPatientConfiguration.PatientFirstName, UserMode = lPatientConfiguration.UserMode }; return(lPatientConfigurationView); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { // Geographic Entities ContinentConfig.SetEntityBuilder(modelBuilder.Entity <Continent>()); CountryConfig.SetEntityBuilder(modelBuilder.Entity <Country>()); RegionConfig.SetEntityBuilder(modelBuilder.Entity <Region>()); // Administrative Entities AdminConfig.SetEntityBuilder(modelBuilder.Entity <Admin>()); EventConfig.SetEntityBuilder(modelBuilder.Entity <Event>()); // Measures Entities SanitaryMeasureConfig.SetEntityBuilder(modelBuilder.Entity <SanitaryMeasure>()); ContainmentMeasureConfig.SetEntityBuilder(modelBuilder.Entity <ContainmentMeasure>()); CmByCountry.SetEntityBuilder(modelBuilder.Entity <CountryContainmentMeasures>()); SmByCountry.SetEntityBuilder(modelBuilder.Entity <CountrySanitaryMeasures>()); // Hospital Entities HospitalConfig.SetEntityBuilder(modelBuilder.Entity <Hospital>()); HEmployeeConfig.SetEntityBuilder(modelBuilder.Entity <HospitalEmployee>()); MedicationConfig.SetEntityBuilder(modelBuilder.Entity <Medication>()); // Person Entities PatientConfig.SetEntityBuilder(modelBuilder.Entity <Patient>()); P_MedicationConfig.SetEntityBuilder(modelBuilder.Entity <PatientMedications>()); Pt_PathologyConfig.SetEntityBuilder(modelBuilder.Entity <PatientPathologies>()); PersonConfig.SetEntityBuilder(modelBuilder.Entity <ContactedPerson>()); Ps_PathologyConfig.SetEntityBuilder(modelBuilder.Entity <PersonPathologies>()); ContactsByPatientConfig.SetEntityBuilder(modelBuilder.Entity <PersonsContactedByPatient>()); // Not related Entities PathologiesConfig.SetEntityBuilder(modelBuilder.Entity <Pathology>()); Pharm_CompanyConfig.SetEntityBuilder(modelBuilder.Entity <PharmaceuticalCompany>()); StatusConfig.SetEntityBuilder(modelBuilder.Entity <PatientStatus>()); // Views and Stored Procedures modelBuilder.Entity <PatientView>().HasNoKey().ToView(null); modelBuilder.Entity <ExportPatient>().HasNoKey().ToView(null); modelBuilder.Entity <CasesView>().HasNoKey().ToView(null); modelBuilder.Entity <ReportView>().HasNoKey().ToView(null); modelBuilder.Entity <MeasureView>().HasNoKey().ToView(null); modelBuilder.Entity <MedicationView>().HasNoKey().ToView(null); modelBuilder.Entity <PatientMedicationView>().HasNoKey().ToView(null); modelBuilder.Entity <PathologyView>().HasNoKey().ToView(null); modelBuilder.Entity <ContactView>().HasNoKey().ToView(null); }
public async Task PutPatientConfigUnauthorised() { // arrange TestClient testClient = new TestClient(); const string endpoint = "config/put/?id=testpatient"; const HttpStatusCode expectedStatusCode = HttpStatusCode.Unauthorized; testClient.AddHeader("ApiKey", "testcarer_nopatients"); PatientConfig patientConfig = new PatientConfig(); string requestBody = JsonConvert.SerializeObject(patientConfig); const string expectedResponseBody = "You are not assigned to this patient."; // act HttpResponseMessage response = await testClient.PutRequest(endpoint, body : requestBody); HttpStatusCode actualStatusCode = response.StatusCode; string actualResponseBody = await response.Content.ReadAsStringAsync(); // assert Assert.Equal(expectedStatusCode, actualStatusCode); Assert.Equal(expectedResponseBody, actualResponseBody); }
public async Task PutPatientConfigOkRequest() { // arrange TestClient testClient = new TestClient(); const string endpoint = "config/put/?id=testpatient"; const HttpStatusCode expectedStatusCode = HttpStatusCode.OK; PatientConfig patientConfig = new PatientConfig(); patientConfig.Id = "testpatient"; string requestBody = JsonConvert.SerializeObject(patientConfig); testClient.AddHeader("ApiKey", "testcarer"); const string expectedResponseBody = "Updated patient successfully."; // act HttpResponseMessage response = await testClient.PutRequest(endpoint, body : requestBody); HttpStatusCode actualStatusCode = response.StatusCode; string actualResponseBody = await response.Content.ReadAsStringAsync(); // assert Assert.Equal(expectedStatusCode, actualStatusCode); Assert.Equal(expectedResponseBody, actualResponseBody); }
public async Task GetPatientConfigOkRequest() { // arrange TestClient testClient = new TestClient(); const string endpoint = "config/get/?id=testpatient"; const HttpStatusCode expectedStatusCode = HttpStatusCode.OK; PatientConfig patientConfig = new PatientConfig(); string test = JsonConvert.SerializeObject(patientConfig); testClient.AddHeader("ApiKey", "testcarer"); // act HttpResponseMessage response = await testClient.GetRequest(endpoint); HttpStatusCode actualStatusCode = response.StatusCode; string responseBody = await response.Content.ReadAsStringAsync(); PatientConfig actualPatientConfig = JsonConvert.DeserializeObject <PatientConfig>(responseBody); // assert Assert.Equal(expectedStatusCode, actualStatusCode); Assert.Equal("testpatient", actualPatientConfig.Id); Assert.Equal(patientConfig.EnabledFeatures, actualPatientConfig.EnabledFeatures); }
public static PatientConfiguration PatientConfigurationViewToPatientConfiguration(PatientConfig lPatientConfiguration) { if (lPatientConfiguration == null) { return(null); } PatientConfiguration pPatientConfiguration = new PatientConfiguration() { PatientId = Convert.ToInt32(lPatientConfiguration.PatientId), SetupId = lPatientConfiguration.SetupId, EquipmentType = lPatientConfiguration.EquipmentType, DeviceConfiguration = lPatientConfiguration.DeviceConfiguration, PatientSide = lPatientConfiguration.PatientSide, CurrentFlexion = lPatientConfiguration.CurrentFlexion, CurrentExtension = lPatientConfiguration.CurrentExtension, CurrentRestPosition = lPatientConfiguration.CurrentRestPosition, CreatedDate = lPatientConfiguration.CreatedDate, UpdatedDate = lPatientConfiguration.UpdatedDate, RxId = lPatientConfiguration.RxId, InstallerId = lPatientConfiguration.InstallerId, PatientFirstName = lPatientConfiguration.PatientFirstName, UserMode = lPatientConfiguration.UserMode }; return(pPatientConfiguration); }