コード例 #1
0
        private void AddPatientDisability(LookupValueDto lookupValueDto, Patient patient)
        {
            var disability        = _mappingHelper.MapLookupField <Disability> (lookupValueDto);
            var patientDisability = new PatientDisability(disability);

            patient.AddPatientDisability(patientDisability);
        }
コード例 #2
0
        private void AddSpecialInitiative(LookupValueDto specialInitiativeDto, ClinicalCase clinicalCase)
        {
            var specialInitiative             = _mappingHelper.MapLookupField <SpecialInitiative> (specialInitiativeDto);
            var clinicalCaseSpecialInitiative = new ClinicalCaseSpecialInitiative(specialInitiative);

            clinicalCase.AddSpecialInitiative(clinicalCaseSpecialInitiative);
        }
コード例 #3
0
        /// <summary>
        /// Maps a LookupBase derived class to a LookupDto
        /// </summary>
        /// <typeparam name="TLookupBase">The type of the lookup base.</typeparam>
        /// <param name="lookupDto">The lookup dto.</param>
        /// <returns>The mapped lookup.</returns>
        public TLookupBase MapLookupField <TLookupBase> (LookupValueDto lookupDto)
            where TLookupBase : LookupBase
        {
            var result = lookupDto != null?MapLookupObject <TLookupBase> (lookupDto.Key) : null;

            return(result);
        }
コード例 #4
0
        private void AddPatientRace(LookupValueDto raceDto, Patient patient)
        {
            var race        = _mappingHelper.MapLookupField <Race> (raceDto);
            var patientRace = new PatientRace(race);

            patient.AddPatientRace(patientRace);
        }
コード例 #5
0
        /// <summary>Convert from LookupValue DTO to entity</summary>
        /// <param name="dbContext">DB Context to use for attaching entity</param>
        /// <param name="dto">DTO to convert from</param>
        /// <param name="dtoEntities">Used internally to track which dtos have been converted to entites already (to avoid re-converting when circularly referenced)</param>
        /// <returns>Resultant LookupValue entity</returns>
        public static LookupValue FromDto(FACTS.Framework.DAL.DbContext dbContext, LookupValueDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null)
        {
            dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>();
            if (dtoEntities.ContainsKey(dto))
            {
                return((LookupValue)dtoEntities[dto]);
            }

            LookupValue entity = new LookupValue();

            dtoEntities.Add(dto, entity);

            entity.Code           = dto.Code;
            entity.CreateDateTime = dto.CreateDateTime;
            entity.CreateUserId   = dto.CreateUserId;
            entity.Description    = dto.Description;
            entity.Name           = dto.Name;
            entity.Property       = dto.Property;
            entity.UpdateDateTime = dto.UpdateDateTime;
            entity.UpdateUserId   = dto.UpdateUserId;
            entity.Value          = dto.Value;

            entity.LookupCode     = (dto.LookupCode == null) ? null : LookupCode.FromDto(dbContext, dto.LookupCode, dtoEntities);
            entity.LookupProperty = (dto.LookupProperty == null) ? null : LookupProperty.FromDto(dbContext, dto.LookupProperty, dtoEntities);

            if (dbContext != null)
            {
                dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified));
            }

            return(entity);
        }
コード例 #6
0
        private void AddPriorityPopulation(LookupValueDto priorityPopulationDto, ClinicalCase clinicalCase)
        {
            var priorityPopulation             = _mappingHelper.MapLookupField <PriorityPopulation> (priorityPopulationDto);
            var clinicalCasePriorityPopulation = new ClinicalCasePriorityPopulation(priorityPopulation);

            clinicalCase.AddPriorityPopulation(clinicalCasePriorityPopulation);
        }
コード例 #7
0
        /// <summary>Convert from LookupValue entity to DTO</summary>
        /// <param name="dbContext">DB Context to use for setting DTO state</param>
        /// <param name="dto">DTO to use if already created instead of creating new one (can be inherited class instead as opposed to base class)</param>
        /// <param name="entityDtos">Used internally to track which entities have been converted to DTO's already (to avoid re-converting when circularly referenced)</param>
        /// <returns>Resultant LookupValue DTO</returns>
        public LookupValueDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, LookupValueDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null)
        {
            entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>();
            if (entityDtos.ContainsKey(this))
            {
                return((LookupValueDto)entityDtos[this]);
            }

            dto = ToDto(dto);
            entityDtos.Add(this, dto);

            System.Data.Entity.Infrastructure.DbEntityEntry <LookupValue> entry = dbContext?.Entry(this);
            dto.IsNew     = (entry?.State == EntityState.Added);
            dto.IsDeleted = (entry?.State == EntityState.Deleted);

            if (entry?.Reference(x => x.LookupCode)?.IsLoaded == true)
            {
                dto.LookupCode = LookupCode?.ToDtoDeep(dbContext, entityDtos: entityDtos);
            }
            if (entry?.Reference(x => x.LookupProperty)?.IsLoaded == true)
            {
                dto.LookupProperty = LookupProperty?.ToDtoDeep(dbContext, entityDtos: entityDtos);
            }

            return(dto);
        }
コード例 #8
0
        private LookupValueDto GetMedicationStatus(StatusCodedConceptDataTransferObject status)
        {
            LookupValueDto result = null;

            MedicationStatus lookup = null;

            if (status != null)
            {
                if (!string.IsNullOrEmpty(status.Status))
                {
                    lookup = _mappingHelper.MapLookupFieldByName <MedicationStatus> (status.Status);
                }
                else if (!string.IsNullOrEmpty(status.DisplayName))
                {
                    lookup = _mappingHelper.MapLookupFieldByName <MedicationStatus> (status.DisplayName);
                }
            }

            if (lookup != null)
            {
                result = AutoMapper.Mapper.Map <LookupBase, LookupValueDto> (lookup);
            }

            return(result);
        }
コード例 #9
0
        private void AddPatientSpecialNeed(LookupValueDto lookupValueDto, Patient patient)
        {
            var specialNeed        = _mappingHelper.MapLookupField <SpecialNeed> (lookupValueDto);
            var patientSpecialNeed = new PatientSpecialNeed(specialNeed);

            patient.AddPatientSpecialNeed(patientSpecialNeed);
        }
コード例 #10
0
 private void ExecuteChangeDisenrollReasonSelection(LookupValueDto disenrollReason)
 {
     if (disenrollReason != null)
     {
         if (disenrollReason.WellKnownName != DisenrollReason.Other)
         {
             ProgramEnrollment.DisenrollOtherReasonNote = null;
         }
     }
 }
コード例 #11
0
 /// <summary>
 /// Executes the document type changed command.
 /// </summary>
 /// <param name="lookupValueDto">The lookup value dto.</param>
 public void ExecuteDocumentTypeChangedCommand(LookupValueDto lookupValueDto)
 {
     if (lookupValueDto.WellKnownName.Equals(WellKnownNames.PatientModule.PatientDocumentType.Other))
     {
         IsOtherTypeReadOnly = false;
     }
     else
     {
         IsOtherTypeReadOnly = true;
         PatientDocumentDto.OtherDocumentTypeName = string.Empty;
     }
 }
コード例 #12
0
ファイル: LookupValueDtoHelper.cs プロジェクト: girish66/REM
        /// <summary>
        /// Gets the specified key.
        /// </summary>
        /// <typeparam name="TLookup">The type of the lookup.</typeparam>
        /// <param name="key">The key to get.</param>
        /// <returns>A <see cref="Rem.Infrastructure.Service.DataTransferObject.LookupValueDto"/></returns>
        public LookupValueDto Get <TLookup> (long key) where TLookup : LookupBase
        {
            LookupValueDto dto = null;

            var lookupObject = _lookupValueRepository.GetLookupByKey <TLookup> (key);

            if (lookupObject != null)
            {
                dto = Mapper.Map <TLookup, LookupValueDto> (lookupObject);
            }

            return(dto);
        }
コード例 #13
0
 /// <summary>
 /// Executes the document type changed command.
 /// </summary>
 /// <param name="lookupValueDto">The lookup value dto.</param>
 public void ExecuteDocumentTypeChangedCommand(LookupValueDto lookupValueDto)
 {
     if (lookupValueDto != null && lookupValueDto.WellKnownName == PatientDocumentType.Other)
     {
         IsOtherTypeReadOnly = false;
     }
     else
     {
         IsOtherTypeReadOnly = true;
         if (SelectedDocument != null)
         {
             SelectedDocument.OtherDocumentTypeName = string.Empty;
         }
     }
 }
コード例 #14
0
        protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, LookupValueDto dto, LookupValue entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities)
        {
            entity.Code           = dto.Code;
            entity.CreateDateTime = dto.CreateDateTime;
            entity.CreateUserId   = dto.CreateUserId;
            entity.Description    = dto.Description;
            entity.Name           = dto.Name;
            entity.Property       = dto.Property;
            entity.UpdateDateTime = dto.UpdateDateTime;
            entity.UpdateNumber   = dto.UpdateNumber;
            entity.UpdateProcess  = dto.UpdateProcess;
            entity.UpdateUserId   = dto.UpdateUserId;
            entity.Value          = dto.Value;

            entity.LookupCode     = (dto.LookupCode == null) ? null : LookupCode.FromDto(dbContext, dto.LookupCode, dtoEntities);
            entity.LookupProperty = (dto.LookupProperty == null) ? null : LookupProperty.FromDto(dbContext, dto.LookupProperty, dtoEntities);
        }
コード例 #15
0
        /// <summary>Convert from LookupValue entity to DTO w/o checking entity state or entity navigation</summary>
        /// <param name="dto">DTO to use if already created instead of creating new one (can be inherited class instead as opposed to base class)</param>
        /// <returns>Resultant LookupValue DTO</returns>
        public LookupValueDto ToDto(LookupValueDto dto = null)
        {
            dto       = dto ?? new LookupValueDto();
            dto.IsNew = false;

            dto.Code           = Code;
            dto.CreateDateTime = CreateDateTime;
            dto.CreateUserId   = CreateUserId;
            dto.Description    = Description;
            dto.Name           = Name;
            dto.Property       = Property;
            dto.UpdateDateTime = UpdateDateTime;
            dto.UpdateUserId   = UpdateUserId;
            dto.Value          = Value;

            return(dto);
        }
コード例 #16
0
        private void ExecuteStatusChangedCommand(LookupValueDto visitStatus)
        {
            var visitStatusUpdateDto = new VisitStatusUpdateDto
            {
                VisitKey       = EditingDto.Key,
                VisitStatus    = visitStatus,
                UpdateDateTime = DateTime.Now
            };

            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher();

            requestDispatcher.Add(new UpdateVisitStatusRequest {
                VisitStatusUpdateDto = visitStatusUpdateDto
            });
            IsLoading = true;
            requestDispatcher.ProcessRequests(HandleUpdateVisitStatusCompleted, HandleUpdateVisitStatusException);
        }
コード例 #17
0
        public PatientAccessHistoryViewModel(
            IAsyncRequestDispatcherFactory asyncRequestDispatcherFactory,
            IUserDialogService userDialogService,
            IAccessControlManager accessControlManager,
            ICommandFactory commandFactory)
            : base(accessControlManager, commandFactory)
        {
            _asyncRequestDispatcherFactory = asyncRequestDispatcherFactory;
            _userDialogService             = userDialogService;

            var commandFactoryHelper = CommandFactoryHelper.CreateHelper(this, commandFactory);

            SearchCommand = commandFactoryHelper.BuildDelegateCommand(() => SearchCommand, ExecuteSearch);

            ResetCommand = commandFactoryHelper.BuildDelegateCommand(() => ResetCommand, ExecuteReset);

            _defaultAccessType = new LookupValueDto {
                Name = "None"
            };
            _accessType = _defaultAccessType;

            PageSizeList = new List <int> {
                100, 125, 150, 175, 200
            };
            _pageSize       = 100;
            _totalItemCount = 0;
            _pageIndex      = 0;

            var lookupValueNames  = new[] { PatientAccessEventType };
            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher();

            foreach (var lookupValueName in lookupValueNames)
            {
                requestDispatcher.AddLookupValuesRequest(lookupValueName);
            }
            IsLoading = true;
            requestDispatcher.ProcessRequests(HandleGetLookupvaluesCompleted, HandleGetLookupValuesException);

            _defaultGroupingDescription  = new CustomPropertyGroupDescription(string.Empty, "None");
            _groupingDescriptions        = new ObservableCollection <CustomPropertyGroupDescription> ();
            _selectedGroupingDescription = _defaultGroupingDescription;
            _groupingDescriptions.Add(_selectedGroupingDescription);

            InitializeGroupingDescriptions();
        }
コード例 #18
0
ファイル: VisitViewModel.cs プロジェクト: girish66/REM
        private void ExecuteStatusUpdatedCommand(LookupValueDto visitStatus)
        {
            if (visitStatus != null && visitStatus.WellKnownName != _visit.VisitStatus.WellKnownName)
            {
                var visitStatusUpdateDto = new VisitStatusUpdateDto
                {
                    VisitKey       = Visit.Key,
                    VisitStatus    = visitStatus,
                    UpdateDateTime = DateTime.Now
                };

                var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher();
                requestDispatcher.Add(new UpdateVisitStatusRequest {
                    VisitStatusUpdateDto = visitStatusUpdateDto
                });
                IsLoading = true;
                requestDispatcher.ProcessRequests(HandleUpdateVisitStatusCompleted, HandleUpdateVisitStatusException);
            }
        }
コード例 #19
0
        /// <summary>Convert from LookupValue DTO to entity</summary>
        /// <param name="dbContext">DB Context to use for attaching entity</param>
        /// <param name="dto">DTO to convert from</param>
        /// <param name="dtoEntities">Used internally to track which dtos have been converted to entites already (to avoid re-converting when circularly referenced)</param>
        /// <returns>Resultant LookupValue entity</returns>
        public static LookupValue FromDto(FACTS.Framework.DAL.DbContext dbContext, LookupValueDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null)
        {
            dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>();
            if (dtoEntities.ContainsKey(dto))
            {
                return((LookupValue)dtoEntities[dto]);
            }

            LookupValue entity = new LookupValue();

            dtoEntities.Add(dto, entity);
            FromDtoSet(dbContext, dto, entity, dtoEntities);

            if (dbContext != null)
            {
                dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified));
            }

            return(entity);
        }
コード例 #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProblemDto"/> class.
        /// </summary>
        /// <param name="problemDto">The problem dto.</param>
        public ProblemDto(ProblemDto problemDto)
            : base(problemDto)
        {
            _clinicalCaseKey = problemDto._clinicalCaseKey;

            if (problemDto._problemStatus != null)
            {
                _problemStatus = new LookupValueDto();
                var diagnosisStatus = problemDto._problemStatus;
                _problemStatus.WellKnownName = diagnosisStatus.WellKnownName;
                _problemStatus.Key           = diagnosisStatus.Key;
                _problemStatus.Name          = diagnosisStatus.Name;
            }

            if (problemDto._problemCodeCodedConcept != null)
            {
                _problemCodeCodedConcept = new CodedConceptDto();
                var problemCode = problemDto._problemCodeCodedConcept;
                _problemCodeCodedConcept.CodedConceptCode = problemCode.CodedConceptCode;
                _problemCodeCodedConcept.Key = problemCode.Key;
                _problemCodeCodedConcept.CodeSystemIdentifier    = problemCode.CodeSystemIdentifier;
                _problemCodeCodedConcept.CodeSystemName          = problemCode.CodeSystemName;
                _problemCodeCodedConcept.CodeSystemVersionNumber = problemCode.CodeSystemVersionNumber;
                _problemCodeCodedConcept.DisplayName             = problemCode.DisplayName;
                _problemCodeCodedConcept.NullFlavorIndicator     = problemCode.NullFlavorIndicator;
            }

            if (problemDto._problemType != null)
            {
                _problemType = new LookupValueDto();
                var diagnosisType = problemDto._problemType;
                _problemType.WellKnownName = diagnosisType.WellKnownName;
                _problemType.Key           = diagnosisType.Key;
                _problemType.Name          = diagnosisType.Name;
            }
        }
コード例 #21
0
ファイル: VisitViewModel.cs プロジェクト: girish66/REM
 private bool CanExecuteStatusUpdatedCommand(LookupValueDto visitStatus)
 {
     return(_visit != null);
 }
コード例 #22
0
 private void ExecuteClearCommand()
 {
     NewAgencyName = null;
     NewAgencyType = null;
 }