Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. public override void Input0_ProcessInputRow(Input0Buffer Row)
  2. {
  3.  
  4. Row.ProcessFlag = false; // Processing is set to false by default - we only want to process rows if they are valid
  5. string alphaRegex = @"[a-zA-Z]"; // regex to check if contains alpha characters
  6.  
  7. // Check if the row is the header column (ToCurrency value) or the exchange rate value
  8. // If the value contains alpha characters we know it is either the ToCurrency name
  9. if ((Regex.IsMatch(Row.Amount, alphaRegex)) && String.IsNullOrEmpty(Row.ExchangeRateType))
  10. {
  11.  
  12. // If the dictionary list does not currently have a key for this currency, add it
  13. // NOTE: the key is the column name of the Excel file (ex: F3) and the value is the currency (ex: JPY)
  14. if (!list.ContainsKey(Row.ToCurrencyColumn))
  15. {
  16. list.Add(Row.ToCurrencyColumn, Row.Amount);
  17. }
  18.  
  19. }
  20.  
  21. // After processing the dictionary values (the first set of rows), we now process the amounts
  22. // Perform a lookup to the dictionary list by passing in the ToCurrenyColumn (ex: F3) and get the ToCurrency name (ex: JPY)
  23. if (list.ContainsKey(Row.ToCurrencyColumn))
  24. {
  25. Row.ToCurrency = list[Row.ToCurrencyColumn];
  26. Row.ProcessFlag = true;
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement