Example #1
0
        static void Main(string[] args)
        {
            var accountNumbers = new List <string>
            {
                "CITI-456",
                "NATIONAL-987",
                "CHASE-222"
            };

            for (int i = 0; i < accountNumbers.Count; i++)
            {
                try
                {
                    CreditUnionFactory creditUnionFactory = CreditUnionFactoryProvider.GetCreditUnionFactory(accountNumbers[i]);
                    var loan    = creditUnionFactory.CreateLoanAccount();
                    var savings = creditUnionFactory.CreateSavingsAccount();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
        static void Main(string[] args)
        {
            List <string> accntNumbers = new List <string> {
                "CITI-456",
                "NATIONAL-987",
                "CHASE-222"
            };

            for (int i = 0; i < accntNumbers.Count; i++)
            {
                CreditUnionFactory anAbstractFactory = CreditUnionFactoryProvider.GetCreditUnionFactory(accntNumbers[i]);
                if (anAbstractFactory == null)
                {
                    Console.WriteLine("Sorry. This credit union w/ account number" +
                                      " ' {0} ' is invalid.", (accntNumbers[i]));
                }
                else
                {
                    ILoanAccount    loan    = anAbstractFactory.CreateLoanAccount();
                    ISavingsAccount savings = anAbstractFactory.CreateSavingsAccount();
                }
            }
            Console.ReadLine();
        }