예제 #1
0
        /// <summary>
        /// Initializes bank service.
        /// </summary>
        /// <param name="bankService">
        /// Bank service to initialize.
        /// </param>
        private static void Init(BankService bankService)
        {
            BankAccount account1 = new BaseBankAccount(1, "Eduard Adasko");

            account1 = new BaseBonus(account1);
            account1 = new HolidayBonus(account1);

            BankAccount account2 = new GoldBankAccount(2, "Polina Ushakova");

            account2 = new HolidayBonus(account2);

            bankService.AddAccount(account1);
            bankService.AddAccount(account2);
        }
예제 #2
0
        public int AddCreditCard(int customerNumber)
        {
            BankService       service    = new BankService();
            CreditCardAccount creditCard = new CreditCardAccount();

            return(service.AddAccount(customerNumber, creditCard));
        }
예제 #3
0
        public int AddDeposit(int customerNumber, int term, decimal amount)
        {
            BankService        service = new BankService();
            CertificateDeposit deposit = new CertificateDeposit
            {
                Term      = term,
                Principal = amount
            };

            return(service.AddAccount(customerNumber, deposit));
        }
예제 #4
0
        public int AddLoan(int customerNumber, int term, decimal amount)
        {
            BankService service = new BankService();
            LoanAccount loan    = new LoanAccount
            {
                Term = term,
                OriginalLoanAmount = amount
            };

            return(service.AddAccount(customerNumber, loan));
        }
        public ActionResult Index(RegistrationVM vm)
        {
            if (ModelState.IsValid)
            {
                BankService _bankService = BankService.GetInstance();
                _bankService.AddAccount(new BankAccount {
                    AccountNo = vm.AccountNo, Name = vm.Name, Balance = vm.Balance, Password = vm.Password, DateCreated = DateTime.Now
                });

                return(RedirectToAction("Index", "Registration"));
            }
            return(View(vm));
        }
예제 #6
0
        static void Main(string[] args)
        {
            var service = new BankService(FileStorage.Instance);
            var account = new BankAccount(1, "first name 1", "last name 1",
                                          1, typeof(DefaultBonusSystem), AccountType.Gold, true);

            service.AddAccount(account);

            service.Save();

            service.RemoveAccount(account);

            service.Load();

            Console.WriteLine(service[0].FirstName);
            Console.WriteLine(service[0].BonusSystemType.ToString());
            Console.WriteLine("----------------------------------");

            var account1 = new BankAccount(2, "first name 2", "last name 2",
                                           2, typeof(DefaultBonusSystem), AccountType.Platinum, true);

            service.AddAccount(account1);
            service.Save();

            Console.WriteLine(service[1].BonusPoints);
            Console.WriteLine(service[1].Balance);
            Console.WriteLine("----------------------------------");

            service[1].Deposit(12);

            Console.WriteLine(service[1].BonusPoints);
            Console.WriteLine(service[1].Balance);
            Console.WriteLine("----------------------------------");

            service.Save();
        }