Dictionary <string, string> SyncGlobalExRatesIn(string countryShortName, CountryConfig.SystemDataTable systemTable) { Dictionary <string, string> diffRates = new Dictionary <string, string>(); ExchangeRatesConfigFacade excf = EM_AppContext.Instance.GetExchangeRatesConfigFacade(false); List <ExchangeRatesConfig.ExchangeRatesRow> globalExRates = (excf != null) ? excf.GetExchangeRates(countryShortName) : new List <ExchangeRatesConfig.ExchangeRatesRow>(); // List<ExchangeRatesConfig.ExchangeRatesRow> globalExRates = new List<ExchangeRatesConfig.ExchangeRatesRow>(); if (globalExRates.Count == 0) { return(diffRates); } foreach (CountryConfig.SystemRow systemRow in systemTable.Rows) { string globalExRate = DEFAULT_EXCHANGE_RATE; // default value for missing exchange rates foreach (ExchangeRatesConfig.ExchangeRatesRow ger in globalExRates) { List <string> vF = ExchangeRate.ValidForToList(ger.ValidFor); if (vF.Contains(systemRow.Name.ToLower())) { globalExRate = ExchangeRate.DefaultRate(ger).ToString(); break; } } diffRates.Add(systemRow.Name.ToLower(), globalExRate); } return(diffRates); }
internal ConfigureSystemsForm(string countryShortName, CountryConfig.SystemDataTable systemTable) { InitializeComponent(); lblCountry.Text = countryShortName; colCurrencyOutput.Items.Add(DefPar.Value.EURO); colCurrencyOutput.Items.Add(DefPar.Value.NATIONAL); colCurrencyParameters.Items.Add(DefPar.Value.EURO); colCurrencyParameters.Items.Add(DefPar.Value.NATIONAL); Dictionary <string, string> globalRates = SyncGlobalExRatesIn(countryShortName, systemTable); foreach (CountryConfig.SystemRow systemRow in systemTable.Rows) { //add available incomelists to combo-box for HeadDefInc, i.e. the combo contains all incomelists not just the one for the system, as there is only one definition of combo-content for all systems List <CountryConfig.ParameterRow> ilNameParameterRows = null; CountryConfigFacade.GetDefFunctionInformation(systemRow, ref ilNameParameterRows, DefFun.DefIl, DefPar.DefIl.Name); foreach (CountryConfig.ParameterRow ilNameParameterRow in ilNameParameterRows) { if (!colHeadDefInc.Items.Contains(ilNameParameterRow.Value)) //avoid multiple input of incomelist { colHeadDefInc.Items.Add(ilNameParameterRow.Value); } } if (!colHeadDefInc.Items.Contains(systemRow.HeadDefInc)) { colHeadDefInc.Items.Add(systemRow.HeadDefInc); //if currently set HeadDefInc is not a valid incomelist still add it, otherwise the grid shows error messages } string currencyOutput = (systemRow.CurrencyOutput.ToLower() == DefPar.Value.NATIONAL.ToLower()) ? DefPar.Value.NATIONAL : DefPar.Value.EURO; string currencyParam = (systemRow.CurrencyParam.ToLower() == DefPar.Value.NATIONAL.ToLower()) ? DefPar.Value.NATIONAL : DefPar.Value.EURO; bool isPrivate = (systemRow.Private.ToLower() == DefPar.Value.YES) ? true : false; string exRate = globalRates.ContainsKey(systemRow.Name.ToLower()) ? globalRates[systemRow.Name.ToLower()] : DEFAULT_EXCHANGE_RATE; int index = dgvSystems.Rows.Add(systemRow.Name, exRate, systemRow.Year, currencyParam, currencyOutput, isPrivate, systemRow.HeadDefInc, systemRow.Comment); dgvSystems.Rows[index].Tag = systemRow; } }
internal ConfigSystemsAction(string countryShortName, CountryConfig.SystemDataTable systemDataTable) { _countryShortName = countryShortName; _systemDataTable = systemDataTable; }