private void ChangeNameInExchangeRatesConfig(CountryConfig.SystemRow systemRow, string oldSystemName)
        {
            ExchangeRatesConfigFacade excf = EM_AppContext.Instance.GetExchangeRatesConfigFacade(false); if (excf == null)
            {
                return;
            }
            bool anyChange = false;

            foreach (ExchangeRatesConfig.ExchangeRatesRow exchangeRate in
                     from er in excf.GetExchangeRates() where er.Country.ToLower() == systemRow.CountryRow.ShortName.ToLower() &&
                     ExchangeRate.ValidForToList(er.ValidFor).Contains(oldSystemName.ToLower()) select er)
            {
                if (!anyChange && UserInfoHandler.GetInfo("Do you want to update the system name in the global exchange rate table?" + Environment.NewLine + Environment.NewLine +
                                                          "Note that, if no exchange rate is found for a system name, the exchange rate is assumed to be 1.", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                exchangeRate.ValidFor = ExchangeRate.RemoveFromValidFor(exchangeRate.ValidFor, oldSystemName);
                exchangeRate.ValidFor = ExchangeRate.AddToValidFor(exchangeRate.ValidFor, systemRow.Name); anyChange = true;
            }
            if (anyChange)
            {
                excf.WriteXML();
            }
        }
        internal static void ShowExchangeRatesDialog()
        {
            ExchangeRatesConfigFacade excf = EM_AppContext.Instance.GetExchangeRatesConfigFacade(true); // true: create if not existent yet
            List <ExchangeRatesConfig.ExchangeRatesRow> exRates = null;

            if (excf != null)
            {
                exRates = excf.GetExchangeRates();
            }

            ExchangeRatesForm exRatesForm = new ExchangeRatesForm(exRates);

            if (exRatesForm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            if (excf != null && excf.RefreshExchangeRates(exRatesForm.updatedExRates))
            {
                excf.WriteXML();
            }
        }
        void AddToExchangeRatesTable(string systemName, CountryConfig.SystemRow toCopySystemRow)
        {
            ExchangeRatesConfigFacade excf = EM_AppContext.Instance.GetExchangeRatesConfigFacade(false); if (excf == null)
            {
                return;
            }
            bool found = false;

            foreach (ExchangeRatesConfig.ExchangeRatesRow exchangeRate in excf.GetExchangeRates())
            {
                if (exchangeRate.Country.ToLower() != toCopySystemRow.CountryRow.ShortName.ToLower() ||
                    !ExchangeRate.ValidForToList(exchangeRate.ValidFor).Contains(toCopySystemRow.Name.ToLower()))
                {
                    continue;
                }
                exchangeRate.ValidFor = ExchangeRate.AddToValidFor(exchangeRate.ValidFor, systemName); found = true; break;
            }
            if (found)
            {
                excf.WriteXML();
            }
        }