private void collectRemoveCommands(TStartValueDTO elementToRemove, BulkUpdateMacroCommand collector) { var startValue = StartValueFrom(elementToRemove); if (_buildingBlock.Contains(startValue)) { collector.AddCommand(_startValuesTask.RemoveStartValueFromBuildingBlockCommand(startValue, _buildingBlock)); } }
private MoBiMacroCommand createExtendMacroCommand(TBuildingBlock buildingBlockToExtend) { var moBiMacroCommand = new BulkUpdateMacroCommand { CommandType = AppConstants.Commands.ExtendCommand, Description = AppConstants.Commands.ExtendDescription, ObjectType = _interactionTaskContext.GetTypeFor(buildingBlockToExtend) }; return(moBiMacroCommand); }
protected MoBiMacroCommand CreateMergeMacroCommand(TBuildingBlock targetBuildingBlock) { var moBiMacroCommand = new BulkUpdateMacroCommand { CommandType = AppConstants.Commands.MergeCommand, Description = AppConstants.Commands.MergeBuildingBlocks, ObjectType = _interactionTaskContext.GetTypeFor(targetBuildingBlock) }; return(moBiMacroCommand); }
public override IMoBiCommand ImportStartValuesToBuildingBlock(IMoleculeStartValuesBuildingBlock startValuesBuildingBlock, IEnumerable <ImportedQuantityDTO> startValues) { var macroCommand = new BulkUpdateMacroCommand { CommandType = AppConstants.Commands.ImportCommand, Description = AppConstants.Commands.ImportMoleculeStartValues, ObjectType = ObjectTypes.MoleculeStartValue }; GetImportStartValuesMacroCommand(startValuesBuildingBlock, startValues, macroCommand); return(macroCommand.Run(Context)); }
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); }
private void bulkRemove(IReadOnlyList <TStartValueDTO> startValuesToRemove) { var macroCommand = new BulkUpdateMacroCommand(); startValuesToRemove.Each(value => collectRemoveCommands(value, macroCommand)); macroCommand.CommandType = AppConstants.Commands.DeleteCommand; macroCommand.ObjectType = new ObjectTypeResolver().TypeFor <TStartValue>(); macroCommand.Description = AppConstants.Commands.RemoveMultipleStartValues; AddCommand(macroCommand.Run(_context)); _startValueDTOs.RemoveRange(startValuesToRemove); }
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)); } }); }