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; }