Can you make a Dictionary (with Key String
, and value Int
) that maps together the string and the value?
Read the Excel sheet one row at a time, to build your Dictionary.
Then use the dictionary to set the proper variables.
Then afterwards your dictionary looks like:
KEY VALUE
============================|========
change_bank_details_policy |11459676
change_DD_date_policy |11441975
and after the Dictionary is built, you can simply do:
change_bank_details_policy = my_dictionary["change_bank_details_policy"];
I think the outline would look like:
Dictionary<String, UInt32> myDict = new Dictionary<String, UInt32>();
object isRow = currentWorksheet.Cells[i, 1].Value;
while (isRow != null)
{
myDict.Add(isRow.ToString().Trim(), currentWorksheet.Cells[i,2].Value);
// Go get the next Row.... details are up to you.
}
change_bank_details_policy = myDict["change_bank_details_policy"]; // Look up this key in the dictionary to get this integer....
change_DD_date_policy = myDict["change_DD_date_policy"];
// [... repeat 40 more times ... but no If statements ]