Example #1
0
        public BankService(Holder.Holder holder)
        {
            if (holder.Equals(null))
            {
                throw new ArgumentException("Holder can't be null!");
            }

            _holder = holder;
        }
Example #2
0
        private void CheckNumbers(decimal sum, BankAccount.BankAccount bankAccount, Holder.Holder holder)
        {
            if (sum <= 0)
            {
                throw new ArgumentException("Sum can't be less or equal zero!");
            }

            if (holder.Equals(null))
            {
                throw new ArgumentException("Holder can't be null!");
            }

            CheckAccount(bankAccount);
        }
Example #3
0
        public static void Main(string[] args)
        {
            Holder.Holder holder1 = Holder.HolderFactory.Create("Mikita", "Bobryk", "Victorovich", "*****@*****.**");
            Holder.Holder holder2 = Holder.HolderFactory.Create("Nikolay", "Bobrov", "Vladimirovich", "*****@*****.**");

            BankService.BankService bankService = new BankService.BankService(holder1);

            bankService.CreateAccount(new AcoountFactories.BaseAccountFactory());

            bankService.CreateAccount(new AcoountFactories.GoldAccountFactory());

            foreach (var temp in holder1.AccountsId)
            {
                Console.WriteLine(temp.ToString());
            }

            Console.WriteLine();

            foreach (var temp in holder1.AccountsId)
            {
                bankService.Deposit(temp, 400);
            }

            bankService.DeleteAccount(holder1.AccountsId[0]);

            foreach (var temp in holder1.AccountsId)
            {
                bankService.Withdraw(temp, 500);
            }

            foreach (var temp in holder1.AccountsId)
            {
                Console.WriteLine(temp.ToString());
            }

            bankService = new BankService.BankService(holder2);

            bankService.CreateAccount(new AcoountFactories.PlatinumAccountFactory());

            bankService.CreateAccount(new AcoountFactories.SilverAccountFactory());

            foreach (var temp in holder2.AccountsId)
            {
                Console.WriteLine(temp.ToString());
            }

            Console.WriteLine();

            foreach (var temp in holder2.AccountsId)
            {
                bankService.Deposit(temp, 400);
            }

            bankService.DeleteAccount(holder2.AccountsId[0]);

            foreach (var temp in holder2.AccountsId)
            {
                bankService.Withdraw(temp, 500);
            }

            foreach (var temp in holder2.AccountsId)
            {
                Console.WriteLine(temp.ToString());
            }

            Console.ReadKey();
        }