Esempio n. 1
0
        static void Main(string[] args)
        {
            List <string> accountNumbers = new List <string>
            {
                "ING",
                "PKO",
                "Alior"
            };

            for (int i = 0; i < accountNumbers.Count; i++)
            {
                AccountAbstractFactory abstractFactory = AccountFactoryProvider.GetAccountAbstractFactory(accountNumbers[i]);

                if (abstractFactory == null)
                {
                    Console.WriteLine("Przepraszamy. To konta " +
                                      " '{0}' jest niepoprawne.", (accountNumbers[i]));
                }
                else
                {
                    abstractFactory.CreateLoanAccount();
                    abstractFactory.CreateSavingsAccount();
                }
            }
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main()
        {
            List <string> accountTypes = new List <string>()
            {
                "P", "R"
            };

            foreach (string accountType in accountTypes)
            {
                AccountFactory accountFactory = AccountFactoryProvider.GetAccountFactory(accountType);
                accountFactory.CreateSavingsAccount();
                accountFactory.CreateLoanAccount();
            }

            Console.Read();
        }