Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override void Input0_ProcessInputRow(Input0Buffer Row)
- {
- Row.ProcessFlag = false; // Processing is set to false by default - we only want to process rows if they are valid
- string alphaRegex = @"[a-zA-Z]"; // regex to check if contains alpha characters
- // Check if the row is the header column (ToCurrency value) or the exchange rate value
- // If the value contains alpha characters we know it is either the ToCurrency name
- if ((Regex.IsMatch(Row.Amount, alphaRegex)) && String.IsNullOrEmpty(Row.ExchangeRateType))
- {
- // If the dictionary list does not currently have a key for this currency, add it
- // NOTE: the key is the column name of the Excel file (ex: F3) and the value is the currency (ex: JPY)
- if (!list.ContainsKey(Row.ToCurrencyColumn))
- {
- list.Add(Row.ToCurrencyColumn, Row.Amount);
- }
- }
- // After processing the dictionary values (the first set of rows), we now process the amounts
- // Perform a lookup to the dictionary list by passing in the ToCurrenyColumn (ex: F3) and get the ToCurrency name (ex: JPY)
- if (list.ContainsKey(Row.ToCurrencyColumn))
- {
- Row.ToCurrency = list[Row.ToCurrencyColumn];
- Row.ProcessFlag = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement