public UpdateOutput <ConditionDto, long> Update(UpdateInput <ConditionDto, long> input) { throw new NotSupportedException("This method is implemented but it is not safely to use it."); Condition newConditionEntity = input.Entity.MapTo <Condition>(); if (newConditionEntity == null) { throw new CityQuestItemNotFoundException(CityQuestConsts.CityQuestItemNotFoundExceptionMessageBody, "\"Condition\""); } if (!ConditionPolicy.CanUpdateEntity(newConditionEntity)) { throw new CityQuestPolicyException(CityQuestConsts.CQPolicyExceptionUpdateDenied, "\"Condition\""); } ConditionRepository.Includes.Add(r => r.LastModifierUser); ConditionRepository.Includes.Add(r => r.CreatorUser); ConditionRepository.Includes.Add(r => r.ConditionType); ConditionRepository.Update(newConditionEntity); ConditionDto newConditionDto = (ConditionRepository.Get(newConditionEntity.Id)).MapTo <ConditionDto>(); ConditionRepository.Includes.Clear(); return(new UpdateOutput <ConditionDto, long>() { UpdatedEntity = newConditionDto }); }
public RetrieveOutput <ConditionDto, long> Retrieve(RetrieveConditionInput input) { ConditionRepository.Includes.Add(r => r.LastModifierUser); ConditionRepository.Includes.Add(r => r.CreatorUser); ConditionRepository.Includes.Add(r => r.ConditionType); IList <Condition> conditionEntities = ConditionRepository.GetAll() .WhereIf(input.Id != null, r => r.Id == input.Id) .WhereIf(!String.IsNullOrEmpty(input.Name), r => r.Name.ToLower().Contains(input.Name.ToLower())) .ToList(); if (conditionEntities.Count != 1) { throw new CityQuestItemNotFoundException(CityQuestConsts.CityQuestItemNotFoundExceptionMessageBody, "\"Condition\""); } if (!ConditionPolicy.CanRetrieveEntity(conditionEntities.Single())) { throw new CityQuestPolicyException(CityQuestConsts.CQPolicyExceptionRetrieveDenied, "\"Condition\""); } ConditionDto conditionEntity = conditionEntities.Single().MapTo <ConditionDto>(); ConditionRepository.Includes.Clear(); return(new RetrieveOutput <ConditionDto, long>() { RetrievedEntity = conditionEntity }); }
public async Task <IActionResult> AddCondition(ToggleLocator id, [FromBody] ConditionDto condition) { var request = new AddToggleConditionRequest(GetEditor(), id, condition); var response = await _mediator.Send(request); return(Created( $"/toggles/id/{response.ToggleID}/conditions/{response.Condition.ID}", response.Condition )); }
private Condition UpdateConditionEntity(Condition existCondition, ConditionDto newCondition) { existCondition.Description = newCondition.Description; existCondition.ConditionTypeId = newCondition.ConditionTypeId; existCondition.Name = newCondition.Name; existCondition.Order = newCondition.Order; existCondition.Points = newCondition.Points; existCondition.ValueToPass = newCondition.ValueToPass; return(ConditionRepository.Update(existCondition)); }
public async Task <IActionResult> AddCondition(ToggleLocator id, [FromBody] ConditionDto condition) { var request = new AddToggleConditionRequest(GetEditor(), id, condition); var response = await _mediator.Send(request); var uri = Url.Action(nameof(GetCondition), new { id = response.ToggleID, condition = response.AddedConditionID }); return(Created(uri, response)); }
ProductDto createProductDto(ProductWrapper productWrap) { ProductDto content = new ProductDto(); ConditionDto condition = new ConditionDto(); GenreDto genre = new GenreDto(); ProductTypeDto productType = new ProductTypeDto(); content.ConditionId = productWrap.ConditionId; content.GenreId = productWrap.GenreId; content.ProductTypeId = productWrap.ProductTypeId; content.Id = productWrap.Id; content.Name = productWrap.Name; content.ProductOwner = _authenticationUser.UserId; content.SoldCopies = 0; content.Stock = productWrap.Stock; return(content); }
private ProblemDto GetProblemDto(ConditionDto condition) { var problem = new ProblemDto(); if (condition.ProblemCode != null) { problem.ProblemCodeCodedConcept = new CodedConceptDto { CodedConceptCode = condition.ProblemCode.Code, CodeSystemIdentifier = condition.ProblemCode.CodeSystem, DisplayName = condition.ProblemCode.DisplayName, CodeSystemName = condition.ProblemCode.CodeSystemName, }; } if (condition.ProblemStatus != null && !string.IsNullOrEmpty(condition.ProblemStatus.Code)) { var lookup = _codedConceptLookupBaseRepository.GetLookupByCodedConceptCode <ProblemStatus> (condition.ProblemStatus.Code); if (lookup != null) { problem.ProblemStatus = AutoMapper.Mapper.Map <LookupBase, LookupValueDto> (lookup); } } if (condition.ProblemType != null && !string.IsNullOrEmpty(condition.ProblemType.Code)) { var lookup = _codedConceptLookupBaseRepository.GetLookupByCodedConceptCode <ProblemType> (condition.ProblemType.Code); if (lookup != null) { problem.ProblemType = AutoMapper.Mapper.Map <LookupBase, LookupValueDto> (lookup); } } // TODO //Upon to C32DtoFactory, currently, C32dto does not have the following values //AssociatedIndicator,CauseOfDeathIndicator,ClinicalCaseKey,ObservedByStaff,ObservedDate,OnsetEndDate,OnsetStartDate,StatusChangedDate return(problem); }
public CreateOutput <ConditionDto, long> Create(CreateInput <ConditionDto, long> input) { throw new NotSupportedException("This method is implemented but it is not safely to use it."); Condition newConditionEntity = input.Entity.MapTo <Condition>(); if (!ConditionPolicy.CanCreateEntity(newConditionEntity)) { throw new CityQuestPolicyException(CityQuestConsts.CQPolicyExceptionCreateDenied, "\"Condition\""); } ConditionRepository.Includes.Add(r => r.LastModifierUser); ConditionRepository.Includes.Add(r => r.CreatorUser); ConditionRepository.Includes.Add(r => r.ConditionType); ConditionDto newConditionDto = (ConditionRepository.Insert(newConditionEntity)).MapTo <ConditionDto>(); ConditionRepository.Includes.Clear(); return(new CreateOutput <ConditionDto, long>() { CreatedEntity = newConditionDto }); }
private void AddProblem( C32Dto dto, Problem problem, DateTime? diagnosisDate ) { var conditionDto = new ConditionDto (); conditionDto.DiagnosisPriority = 1; if ( diagnosisDate.HasValue ) { // TODO: The problem date should be the DiagnosisDate //conditionDto.ProblemDate = new OperatorDateTimeDto { Date = diagnosisDate.Value.ToString ( "yyyyMMdd" ) }; } else { if ( problem.OnsetDateRange != null && ( problem.OnsetDateRange.StartDate != null || problem.OnsetDateRange.EndDate != null ) ) { // TODO: The problem date should be the DiagnosisDate // conditionDto.ProblemDate = new OperatorDateTimeDto (); // if ( problem.OnsetDateRange.StartDate != null ) // { // conditionDto.ProblemDate.StartDate = new ValueDataTransferObject // { // Value = problem.OnsetDateRange.StartDate.Value.ToString ( "yyyyMMdd" ) // }; // } // if ( problem.OnsetDateRange.EndDate != null ) // { // conditionDto.ProblemDate.EndDate = new ValueDataTransferObject // { // Value = problem.OnsetDateRange.EndDate.Value.ToString ( "yyyyMMdd" ) // }; // } } } if ( problem.ProblemType != null ) { conditionDto.ProblemType = new OriginalTextCodedConceptDto { Code = problem.ProblemType.CodedConceptCode, DisplayName = problem.ProblemType.Name, CodeSystem = problem.ProblemType.CodeSystemIdentifier, CodeSystemName = problem.ProblemType.CodeSystemName }; } if ( problem.ProblemCodeCodedConcept != null ) { conditionDto.ProblemName = problem.ProblemCodeCodedConcept.DisplayName; conditionDto.ProblemCode = new OriginalTextCodedConceptDto { Code = problem.ProblemCodeCodedConcept.CodedConceptCode, CodeSystem = problem.ProblemCodeCodedConcept.CodeSystemIdentifier, DisplayName = problem.ProblemCodeCodedConcept.DisplayName, CodeSystemName = problem.ProblemCodeCodedConcept.CodeSystemName }; } //TODO: Provider problem.ClinicalCase.PerformedByStaff //conditionDto.Provider = new ProviderDto() { ProviderId = new IIDataTransferObject() { Root = "npi", Extension = "npi-extension" } }; //TODO: We don't have Age At Onset //conditionDto.AgeAtOnset = 100; //conditionDto.CauseOfDeath = new CauseOfDeathDto() //{ // ProblemCode = new CodedConceptDataTransferObject() { Code = "195967001", CodeSystem = "2.16.840.1.113883.6.96", DisplayName = "Asthma", CodeSystemName = "SNOMED-CT" }, // TimeOfDeath = new ValueDataTransferObject() { Value = "20101010" }, // AgeAtDeath = 100 //}; if ( problem.ProblemStatus != null ) { conditionDto.ProblemStatus = new OriginalTextCodedConceptDto { Code = problem.ProblemStatus.CodedConceptCode, CodeSystem = problem.ProblemStatus.CodeSystemIdentifier, CodeSystemName = problem.ProblemStatus.CodeSystemName, DisplayName = problem.ProblemStatus.Name }; } if ( dto.Body.Conditions == null ) { dto.Body.Conditions = new List<ConditionDto> (); } dto.Body.Conditions.Add ( conditionDto ); }