internal override void PerformAction() { CountryConfig.SystemRow systemRow = (_senderColumn.Tag as SystemTreeListTag).GetSystemRow(); string newSystemName = systemRow.Name, oldSystemName = systemRow.Name, newSystemYear = systemRow.Year; if (!SystemValidation.GetSystemNameAndYear(_dataConfigFacade != null, ref newSystemName, ref newSystemYear, _senderColumn.TreeList)) { _actionIsCanceled = true; return; } // main action: rename system systemRow.Name = newSystemName; systemRow.Year = newSystemYear; // rename references in database-system-connection (if 'country' isn't an add-on) if (_dataConfigFacade != null) { _dataConfigFacade.RenameSystemInDBSystemConfigRows(systemRow.ID, newSystemName); } // rename references in conditional formatting _countryConfigFacade.RenameSystemInConditionalFormats(oldSystemName, newSystemName); if (_dataConfigFacade != null) { // rename standard-output-files (last parameter (request): ask user if she actually wants this to happen) CopySystemAction.RenameOutputFiles(_countryConfigFacade, systemRow, oldSystemName, true); // change name in global exchange rate file ChangeNameInExchangeRatesConfig(systemRow, oldSystemName); // warn about not-adaptation of AddOn_Applic-policy OptionalWarningsManager.Show(OptionalWarningsManager._renameSystemWarning); } }
internal override void PerformAction() { CountryConfig.SystemRow systemRow = (_senderColumn == null) ? null : (_senderColumn.Tag as SystemTreeListTag).GetSystemRow(); TreeList countryTreeList = (_senderColumn != null) ? _senderColumn.TreeList : null; string systemName = systemRow == null ? string.Empty : systemRow.Name; string systemYear = systemRow == null ? string.Empty : systemRow.Year; if (!SystemValidation.GetSystemNameAndYear(!_isAddOn, ref systemName, ref systemYear, countryTreeList)) { _actionIsCanceled = true; return; } CountryConfig.SystemRow newSystemRow; if (_senderColumn == null) //add very first system { newSystemRow = _countryConfigFacade.AddFirstSystemRow(systemName); } else //add system by copying an existing system { CountryConfig.SystemRow toCopySystemRow = (_senderColumn.Tag as SystemTreeListTag).GetSystemRow(); //copy system itself newSystemRow = CountryConfigFacade.CopySystemRow(systemName, toCopySystemRow); //copy all references of the system with datasets (i.e. new system can be used with same datasets as its template) if (!_isAddOn) { _dataConfigFacade.CopyDBSystemConfigRows(toCopySystemRow, newSystemRow); } //copy system formats _countryConfigFacade.CopySystemFormatting(toCopySystemRow, newSystemRow); //rename output filename of default outputs RenameOutputFiles(_countryConfigFacade, newSystemRow, toCopySystemRow.Name); //adapt exchange-rate in global table //note that the exchange-rate-config is not included in the undo-procedure, thus this will not be undone AddToExchangeRatesTable(systemName, toCopySystemRow); ExtensionAndGroupManager.CopyExtensionAndGroupMemberships(_countryConfigFacade.GetCountryConfig(), newSystemRow.ID, toCopySystemRow.ID); } newSystemRow.Year = systemYear; }