Ejemplo n.º 1
0
        public static void CreateBank()
        {
            BankService bankService = new BankService();
            Bank        bank        = new Bank();

            bank.Name = "Ankkalinnan pankki";
            bank.Bic  = "BICABCDEFG";
            bankService.CreateBank(bank);
        }
Ejemplo n.º 2
0
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            _accountType = comboaccount.SelectionBoxItem.ToString();
            int number = 0;

            number = Convert.ToInt32(amountbox.Text.ToString());


            if (radiodeposit.IsChecked == true)//duplicate
            {
                BankService.Deposit(number, _accountType);
                RefreshOutput();
            }

            if (radiowithdraw.IsChecked == true)//duplicate
            {
                int balance = _accountType == "Saving Account" ? BankService.SavingsBalance : BankService.CurrentBalance;
                if (Convert.ToInt32(number) > balance)
                {
                    MessageBox.Show("Your account balance is not enough", _accountType);
                }
                else
                {
                    BankService.Withdraw(number, _accountType);
                    RefreshOutput();
                }
            }

            if (radiotransfer.IsChecked == true)//duplicate
            {
                int balance = _accountType == "Saving Account" ? BankService.SavingsBalance : BankService.CurrentBalance;
                if (Convert.ToInt32(number) > balance)
                {
                    MessageBox.Show("Your {0} balance is not enough", _accountType);
                }
                else
                {
                    BankService.Transfer(number, _accountType);
                    RefreshOutput();
                }
            }

            if (radiofd.IsChecked == true)
            {
                if (radioFdDeposit.IsChecked == true)
                {
                    if (Convert.ToInt32(number) > BankService.SavingsBalance)
                    {
                        MessageBox.Show("Your savings balance is not enough.");
                    }
                    else
                    {
                        BankService.savingFD(number, "FdDeposit");
                        RefreshOutput();
                    }
                }

                else if (radioFdWithdraw.IsChecked == true)
                {
                    if (Convert.ToInt32(number) > BankService.FdBalance)
                    {
                        MessageBox.Show("Your FD balance is not enough.");
                    }
                    else
                    {
                        BankService.savingFD(number, "FdWithdraw");
                        RefreshOutput();
                    }
                }
            }
        }