static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Start this program with a filename argument. Typically testdata.csv."); } ReadCustomerFile(args); ConsentReceiver receiver = new ConsentReceiver(); receiver.ConsentResponseReceived += Receiver_ConsentResponseReceived; RequestConsents(receiver); WaitForResponses(); WriteResults(); }
private static void RequestConsents(ConsentReceiver receiver) { var banks = new Dictionary <string, BankClient>(); foreach (var customer in customers .Where(c => c.ValidFrom.Year > 2010 && !string.IsNullOrEmpty(c.ClerkId) && c.ConsentInsurance)) { if (!banks.ContainsKey(customer.BankId)) { banks.Add(customer.BankId, new BankClient(customer.BankId, URLS.MakeURL(customer.BankId))); receiver.ListenFor(customer.BankId); } var bank = banks[customer.BankId]; customer.ConsentBank = false; Console.WriteLine("Asking {0} for customer {1} bank consent", bank.Url, customer.CustomerId); banks[customer.BankId].RequestConsent(customer.CustomerId); } }