/// <summary> /// Wrapper en Category, Choice og/eller Detail til et kald sammen med Patients CPR-nr og en Status kode på kaldet(Afventende, Udført, Fortrudt) /// </summary> /// <param name="cprnr">CPR-nr for Patient</param> /// <param name="status">Status kode(Active, Completed, Canceled) på kaldet</param> /// <param name="categoryEntity">Kategorien</param> /// <param name="choiceEntity">Valget</param> /// <param name="detailEntity">Tilebør</param> /// <returns>Returner et objekt der anses som et kald, klar til at blive sendt afsted til Web API</returns> public static CallEntity WrapCall(String cprnr, CallUtil.StatusCode status, CategoryEntity categoryEntity, ChoiceEntity choiceEntity=null, DetailEntity detailEntity=null) { var callEntity = new CallEntity(); /* Non-nullable values */ //callEntity._id = Guid.NewGuid().ToString(); callEntity.PatientCPR = cprnr; callEntity.Status = (int)status; callEntity.Category = categoryEntity.Name; /* Nullable values*/ /* if (categoryEntity.Picture != null) { callEntity.Picture = categoryEntity.Picture; } */ if (choiceEntity != null) { callEntity.Choice = choiceEntity.Name; } /* Nullable values*/ if (detailEntity != null) { callEntity.Detail = detailEntity.Name; } return callEntity; }
public DetailSource(DetailEntity[] details, int choiceIndexPath, DetailViewController vc) { Details = details; ChoiceIndexPathRow = choiceIndexPath; if (vc != null) { this.vc = vc; } }
public List<CategoryEntity> GetCategoriesTESTDATA() { // TEST DATA var categoryEntities = new List<CategoryEntity>(); // CATEGORY -> CHOICES -> DETAILS var d1 = new DetailEntity() { DetailId = Guid.NewGuid().ToString(), Name = "Mælk", }; var d2 = new DetailEntity() { DetailId = Guid.NewGuid().ToString(), Name = "Sukker" }; var d3 = new DetailEntity() { DetailId = Guid.NewGuid().ToString(), Name = "Sort kaffe" }; var d4 = new DetailEntity() { DetailId = Guid.NewGuid().ToString(), Name = "Sukkerfri" }; var d5 = new DetailEntity() { DetailId = Guid.NewGuid().ToString(), Name = "Tun og æg" }; var d6= new DetailEntity() { DetailId = Guid.NewGuid().ToString(), Name = "Skinke og ost" }; var ch1 = new ChoiceEntity() { ChoiceId = Guid.NewGuid().ToString(), Name = "Kaffe", Details = new List<DetailEntity> { d1, d2, d3 } // 1-M }; var ch2 = new ChoiceEntity() { ChoiceId = Guid.NewGuid().ToString(), Name = "Cola", Details = new List<DetailEntity> { d2, d4 } // 1-M }; d1.Choices = new List<ChoiceEntity> {ch1}; d2.Choices = new List<ChoiceEntity> { ch1, ch2 }; // M-M d3.Choices = new List<ChoiceEntity> { ch1 }; d4.Choices = new List<ChoiceEntity> { ch2 }; var ch3 = new ChoiceEntity() { ChoiceId = Guid.NewGuid().ToString(), Name = "Sandwich", Details = new List<DetailEntity> { d5, d6 } }; d5.Choices = new List<ChoiceEntity> { ch3 }; d6.Choices = new List<ChoiceEntity> { ch3 }; var cat1 = new CategoryEntity() { CategoryId = Guid.NewGuid().ToString(), Name = "Mad/Drikke", //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg", Choices = new List<ChoiceEntity> {ch1, ch2, ch3} }; ch1.CategoryId = cat1.CategoryId; ch2.CategoryId = cat1.CategoryId; categoryEntities.Add(cat1); // CATEGORY -> CHOICES var ch4 = new ChoiceEntity() { ChoiceId = Guid.NewGuid().ToString(), Name = "Morfin" }; var ch5 = new ChoiceEntity() { ChoiceId = Guid.NewGuid().ToString(), Name = "Panodil" }; var cat2 = new CategoryEntity() { CategoryId = Guid.NewGuid().ToString(), Name = "Smertestillende", //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg", Choices = new List<ChoiceEntity> { ch4, ch5 } }; ch2.CategoryId = cat2.CategoryId; categoryEntities.Add(cat2); // CATEGORY -> OBS EMPTY CHOICE var cat3 = new CategoryEntity() { CategoryId = Guid.NewGuid().ToString(), Name = "Toilet", //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg", }; ch3.CategoryId = cat3.CategoryId; categoryEntities.Add(cat3); return categoryEntities; }
public void SendingCallJSONCategoryChoiceDetail_JSONConverted() { // Arrange var testString = "Test"; var detail = new DetailEntity() { DetailId = Guid.NewGuid().ToString(), Name = "Mælk", }; var choice = new ChoiceEntity() { ChoiceId = Guid.NewGuid().ToString(), Name = "Kaffe", Details = new List<DetailEntity> { detail } }; var category = new CategoryEntity() { CategoryId = Guid.NewGuid().ToString(), Name = "Dinmor", //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg", Choices = new List<ChoiceEntity> { choice } }; CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, category, choice, detail); try { //Act PatientCall call = new PatientCall(); var callId = call.MakeCall(callEntity); Assert.IsTrue(!String.IsNullOrEmpty(callId)); } catch (Exception ex) { Assert.Fail("Status Code not OK " + ex.Message); } }