예제 #1
0
        public void AddSchemaItemTo(SchemaDTO schemaDTO, SchemaItemDTO schemaItemDTOToDupicate)
        {
            var schema     = SchemaFrom(schemaDTO);
            var schemaItem = SchemaItemFrom(schemaItemDTOToDupicate);

            AddCommand(_protocolTask.AddSchemaItemTo(schema, schemaItem));
        }
        public SchemaItemDTO MapFrom(SchemaItem schemaItem)
        {
            var schemaItemDTO = new SchemaItemDTO(schemaItem);

            schemaItemDTO.DoseParameter      = _parameterDTOMapper.MapFrom(schemaItem.Dose, schemaItemDTO, x => x.Dose, x => x.DoseParameter);
            schemaItemDTO.StartTimeParameter = _parameterDTOMapper.MapFrom(schemaItem.StartTime, schemaItemDTO, x => x.StartTime, x => x.StartTimeParameter);
            return(schemaItemDTO);
        }
예제 #3
0
        public void RemoveSchemaItem(SchemaItemDTO schemaItemDTOToDelete)
        {
            var schemaDTO          = schemaItemDTOToDelete.ParentSchema;
            var schema             = SchemaFrom(schemaDTO);
            var schemaItemToDelete = SchemaItemFrom(schemaItemDTOToDelete);

            AddCommand(_protocolTask.RemoveSchemaItemFrom(schemaItemToDelete, schema));
        }
예제 #4
0
 public bool HasDynamicParameters(SchemaItemDTO schemaItemDTO)
 {
     if (schemaItemDTO == null)
     {
         return(false);
     }
     return(_protocolTask.AllDynamicParametersFor(SchemaItemFrom(schemaItemDTO)).Any());
 }
예제 #5
0
        public bool HasDynamicContent(SchemaItemDTO schemaItemDTO)
        {
            if (schemaItemDTO == null)
            {
                return(false);
            }

            return(schemaItemDTO.IsUserDefined || _protocolTask.AllDynamicParametersFor(SchemaItemFrom(schemaItemDTO)).Any());
        }
예제 #6
0
        public IList DynamicParametersFor(SchemaItemDTO schemaItemDTO)
        {
            if (schemaItemDTO == null)
            {
                return(new List <IParameterDTO>());
            }

            return(_protocolTask.AllDynamicParametersFor(SchemaItemFrom(schemaItemDTO)).MapAllUsing(_parameterDTOMapper).ToList());
        }
        protected override void Context()
        {
            base.Context();
            _schemaItem = new SchemaItem {
                ApplicationType = ApplicationTypes.UserDefined, TargetOrgan = "Liv", TargetCompartment = "Cell"
            };

            _schemaItemDTO = new SchemaItemDTO(_schemaItem);
        }
예제 #8
0
        private string schemaItemAggregation(SchemaItemDTO dto)
        {
            var key = $"{dto.ApplicationType}|{dto.StartTime}|{dto.DoseParameter.DisplayUnit}";

            if (dto.NeedsFormulation)
            {
                key = $"{key}|{dto.FormulationKey}";
            }

            return(key);
        }
예제 #9
0
        private string schemaItemAggregation(SchemaItemDTO dto)
        {
            var key = string.Format("{0}|{1}|{2}", dto.ApplicationType, dto.StartTime, dto.DoseParameter.DisplayUnit);

            if (dto.NeedsFormulation)
            {
                key = string.Format("{0}|{1}", key, dto.FormulationKey);
            }

            return(key);
        }
예제 #10
0
        private RepositoryItem formulationRepository(SchemaItemDTO schemaItemDTO)
        {
            if (_formulationRepository == null)
            {
                _formulationRepository = new RepositoryItemMRUEdit();
                _presenter.AllFormulationKeys().Each(key => _formulationRepository.Items.Add(key));
            }
            _formulationRepository.ReadOnly = !schemaItemDTO.NeedsFormulation;
            _formulationRepository.Enabled  = schemaItemDTO.NeedsFormulation;

            return(_formulationRepository);
        }
        protected override void Context()
        {
            base.Context();
            _schemaDTO  = A.Fake <SchemaDTO>();
            _schemaItem = A.Fake <SchemaItem>();
            _schema     = A.Fake <Schema>();

            _allSchemas.Add(_schema);
            A.CallTo(() => _schemaDTO.Schema).Returns(_schema);
            sut.EditProtocol(_advancedProtocol);
            A.CallTo(() => _schema.SchemaItems).Returns(new[] { _schemaItem });
            _schemaItemDTOToDuplicate = new SchemaItemDTO(_schemaItem);
        }
예제 #12
0
        public string DescriptionFor(SchemaItemDTO schemaItemDTO)
        {
            if (schemaItemDTO == null)
            {
                return(string.Empty);
            }

            return
                (PKSimConstants.UI.SchemaItemDescription(
                     schemaItemDTO.ApplicationType.DisplayName,
                     schemaItemDTO.FormulationKey, ParameterMessages.DisplayValueFor(schemaItemDTO.DoseParameter.Parameter),
                     ParameterMessages.DisplayValueFor(schemaItemDTO.StartTimeParameter.Parameter)));
        }
 protected override void Context()
 {
     base.Context();
     _schema        = A.Fake <Schema>();
     _schemaDTO     = A.Fake <SchemaDTO>();
     _schemaItemDTO = DomainHelperForSpecs.SchemaItemDTO(ApplicationTypes.Intravenous);
     _schemaItem    = _schemaItemDTO.SchemaItem;
     A.CallTo(() => _schemaDTO.Schema).Returns(_schema);
     A.CallTo(() => _advancedProtocol.Contains(_schema)).Returns(true);
     _allSchemas.Add(_schema);
     A.CallTo(() => _schemaDTOMapper.MapFrom(_schema)).Returns(_schemaDTO);
     A.CallTo(() => _schemaItemDTOMapper.MapFrom(_schemaItem)).Returns(_schemaItemDTO);
     sut.EditProtocol(_advancedProtocol);
 }
 protected override void Context()
 {
     base.Context();
     _schemaDTO  = A.Fake <SchemaDTO>();
     _schemaItem = A.Fake <SchemaItem>();
     _schema     = A.Fake <Schema>();
     _deleteSchemaItemCommand            = A.Fake <IPKSimCommand>();
     _schemaItemDTOToDelete              = DomainHelperForSpecs.SchemaItemDTO(ApplicationTypes.Intravenous);
     _schemaItemDTOToDelete.ParentSchema = _schemaDTO;
     _schemaItemToDelete = _schemaItemDTOToDelete.SchemaItem;
     A.CallTo(() => _schemaDTO.Schema).Returns(_schema);
     A.CallTo(() => _schema.SchemaItems).Returns(new[] { _schemaItem, _schemaItemToDelete });
     A.CallTo(() => _protocolTask.RemoveSchemaItemFrom(_schemaItemToDelete, _schema)).Returns(_deleteSchemaItemCommand);
 }
예제 #15
0
        public static SchemaItemDTO SchemaItemDTO(ApplicationType applicationType, Unit doseDisplayUnit = null, double?doseValue = null, double?startTimeValue = null)
        {
            var schemaItemDTO = new SchemaItemDTO(new SchemaItem {
                ApplicationType = applicationType
            });

            schemaItemDTO.DoseParameter      = new ParameterDTO(ConstantParameterWithValue(doseValue.GetValueOrDefault(1)).WithName(CoreConstants.Parameter.INPUT_DOSE));
            schemaItemDTO.StartTimeParameter = new ParameterDTO(ConstantParameterWithValue(startTimeValue.GetValueOrDefault(0)).WithName(Constants.Parameters.START_TIME));

            if (doseDisplayUnit != null)
            {
                schemaItemDTO.DoseParameter.Parameter.DisplayUnit = doseDisplayUnit;
            }

            return(schemaItemDTO);
        }
예제 #16
0
        public IList DynamicContentFor(SchemaItemDTO schemaItemDTO)
        {
            if (schemaItemDTO == null)
            {
                return(new List <IParameterDTO>());
            }

            if (schemaItemDTO.IsUserDefined)
            {
                return new List <SchemaItemTargetDTO>
                       {
                           new SchemaItemTargetDTO(PKSimConstants.UI.TargetOrgan, schemaItemDTO, x => x.TargetOrgan),
                           new SchemaItemTargetDTO(PKSimConstants.UI.TargetCompartment, schemaItemDTO, x => x.TargetCompartment),
                       }
            }
            ;

            return(_protocolTask.AllDynamicParametersFor(SchemaItemFrom(schemaItemDTO)).MapAllUsing(_parameterDTOMapper).ToList());
        }
예제 #17
0
 private void setApplicationType(SchemaItemDTO dto, ApplicationType newApplicationType)
 {
     OnEvent(() => _presenter.SetApplicationType(dto, newApplicationType));
 }
        public void should_return_true_if_the_schema_item_represented_a_user_defined_application()
        {
            var schemaItemDTO = new SchemaItemDTO(_userDefinedSchemaItem);

            sut.HasDynamicContent(schemaItemDTO).ShouldBeTrue();
        }
예제 #19
0
 private void updateApplicationParameter(GridViewBinder <SchemaItemDTO> binder, SchemaItemDTO dto)
 {
     refreshMasterRow(binder.GridView, binder.RowHandleFor(dto));
 }
예제 #20
0
 protected override void Because()
 {
     _schemaItemDTO = sut.MapFrom(_schemaItem);
 }
예제 #21
0
        private void schemaItemButtonRepositoryButtonClick(object sender, ButtonPressedEventArgs e, SchemaItemDTO schemaItemDTO)
        {
            var editor      = (ButtonEdit)sender;
            var buttonIndex = editor.Properties.Buttons.IndexOf(e.Button);

            if (buttonIndex == 0)
            {
                _presenter.AddSchemaItemTo(schemaItemDTO.ParentSchema, schemaItemDTO);
            }
            else
            {
                //before removing: collapse
                int rowHandle = _gridProtocolBinder.RowHandleFor(schemaItemDTO.ParentSchema);
                refreshMasterRow(_gridProtocolBinder.GridView, rowHandle);
                _presenter.RemoveSchemaItem(schemaItemDTO);
                _gridProtocolBinder.GridView.ExpandMasterRow(rowHandle);
            }
        }
예제 #22
0
 public void SetFormulationType(SchemaItemDTO schemaItemDTO, string newFormulationType)
 {
     AddCommand(_protocolTask.SetFormulationType(SchemaItemFrom(schemaItemDTO), newFormulationType));
 }
예제 #23
0
 protected SchemaItem SchemaItemFrom(SchemaItemDTO schemaItemDTO)
 {
     return(schemaItemDTO.SchemaItem);
 }
        public void should_return_true_if_the_schema_item_has_dynamic_parameters()
        {
            var schemaItemDTO = new SchemaItemDTO(_schemaItemWithParameters);

            sut.HasDynamicContent(schemaItemDTO).ShouldBeTrue();
        }
예제 #25
0
 public void SetApplicationType(SchemaItemDTO schemaItemDTO, ApplicationType newApplicationType)
 {
     AddCommand(_protocolTask.SetApplicationType(SchemaItemFrom(schemaItemDTO), newApplicationType));
 }
        public void should_return_false_if_the_schema_item_does_not_have_dynamic_parameters()
        {
            var schemaItemDTO = new SchemaItemDTO(_schemaItemWithoutParameters);

            sut.HasDynamicContent(schemaItemDTO).ShouldBeFalse();
        }
 protected override void Context()
 {
     base.Context();
     _schemaItemDTO = new SchemaItemDTO(_schemaItem);
 }
예제 #28
0
        private static string createDataGroupingNameFor(bool hasOnlyOneDoseUnit, Compound compound, SchemaItemDTO schemaItemDTO)
        {
            var baseName = schemaItemDTO.DisplayName;

            if (!string.IsNullOrEmpty(compound.Name))
            {
                baseName = CoreConstants.CompositeNameFor(baseName, compound.Name);
            }

            return(hasOnlyOneDoseUnit ? baseName : Constants.NameWithUnitFor(baseName, schemaItemDTO.DoseParameter.DisplayUnit));
        }
예제 #29
0
 public void SetApplicationType(SchemaItemDTO schemaItemDTO, ApplicationType newApplicationType)
 {
     SetApplicationType(newApplicationType, SchemaItemFrom(schemaItemDTO));
 }
예제 #30
0
 protected SchemaItem SchemaItemFrom(SchemaItemDTO schemaItemDTO) => schemaItemDTO.SchemaItem;