Exemple #1
0
        protected void GetImportStartValuesMacroCommand(TBuildingBlock startValuesBuildingBlock, IEnumerable <ImportedQuantityDTO> startValues, BulkUpdateMacroCommand macroCommand)
        {
            startValues.Each(startValueDTO =>
            {
                var startValue = startValuesBuildingBlock[startValueDTO.Path];

                if (startValue == null)
                {
                    macroCommand.Add(GenerateAddCommand(startValuesBuildingBlock, _dtoToQuantityToParameterStartValueMapper.MapFrom(startValueDTO)));
                }
                else
                {
                    if (ShouldFormulaBeOverridden(startValueDTO, startValue))
                    {
                        macroCommand.Add(GetChangeStartValueFormulaCommand(startValuesBuildingBlock, startValue: startValue, newFormula: null, oldFormula: startValue.Formula));
                    }

                    macroCommand.Add(GetUpdateStartValueInBuildingBlockCommand(startValuesBuildingBlock, startValueDTO));
                }
            });
        }
Exemple #2
0
        public override void TransferImportedQuantities()
        {
            var macroCommand = new BulkUpdateMacroCommand
            {
                Description = AppConstants.Commands.ImportMultipleParameters,
                CommandType = AppConstants.Commands.EditCommand,
                ObjectType  = ObjectTypes.Parameter
            };

            _quantityDTOs.Each(dto => macroCommand.Add(_quantityTask.SetQuantityBaseValue(dto.Path.TryResolve <IParameter>(_simulation.Model.Root), dto.QuantityInBaseUnit, _simulation)));

            AddCommand(macroCommand);
        }