Пример #1
0
 public void DeleteEmployee(string idToDelete)
 {
     if (MasterBank.currentBank.bankStaffList.Count > 0)
     {
         BankStaff bankStaffToDelete = MasterBank.currentBank.bankStaffList.FirstOrDefault(staff => staff.BankStaffId == idToDelete);
         if (bankStaffToDelete != null)
         {
             MasterBank.currentBank.bankStaffList.Remove(bankStaffToDelete);
         }
     }
     MasterBank.SaveCurrentState();
 }
        public void AddCurrencyExchangeRate(string currency, double rate)
        {
            CurrencyExchangeRate currencyExchangeRate = new CurrencyExchangeRate {
                Currency = currency, Rate = rate
            };

            if (MasterBank.currentBank.CurrencyExchangeList.Contains(currencyExchangeRate))
            {
            }
            else
            {
                MasterBank.currentBank.CurrencyExchangeList.Add(currencyExchangeRate);
            }
            MasterBank.SaveCurrentState();
        }
Пример #3
0
 public bool DeleteAccount(string accountHolderId)
 {
     if (MasterBank.currentBank.accountHolders.Count > 0)
     {
         AccountHolder accountHolder = MasterBank.currentBank.accountHolders.FirstOrDefault(accHolder => accHolder.AccountHolderId == accountHolderId);
         Account       account       = MasterBank.currentBank.accounts.FirstOrDefault(acc => acc.AccountHolderId == accountHolderId);
         if (account != null)
         {
             MasterBank.currentBank.accountHolders.Remove(accountHolder);
             MasterBank.currentBank.accounts.Remove(account);
             MasterBank.SaveCurrentState();
             return(true);
         }
         return(false);
     }
     return(false);
 }
Пример #4
0
        public void UpdateAccount(AccountHolder accountHolder)
        {
            int index = -1;

            foreach (AccountHolder accountData in MasterBank.currentBank.accountHolders)
            {
                if (accountData.AccountHolderId == accountHolder.AccountHolderId)
                {
                    index = MasterBank.currentBank.accountHolders.IndexOf(accountData);
                }
                else
                {
                    throw new Exception("ID NOT FOUND");
                }
            }
            MasterBank.currentBank.accountHolders.Insert(index, accountHolder);
            MasterBank.SaveCurrentState();
            MasterBank.currentBank.accountHolders.RemoveAt(index);
        }
Пример #5
0
        public void UpdateEmployee(BankStaff bankStaff)
        {
            int index = -1;

            foreach (BankStaff employee in MasterBank.currentBank.bankStaffList)
            {
                if (employee.BankStaffId == bankStaff.BankStaffId)
                {
                    index = MasterBank.currentBank.bankStaffList.IndexOf(employee);
                }
                else
                {
                }
            }
            if (index != -1)
            {
                MasterBank.currentBank.bankStaffList.RemoveAt(index);
                MasterBank.currentBank.bankStaffList.Insert(index, bankStaff);
                MasterBank.SaveCurrentState();
            }
        }
Пример #6
0
 public void AddAccount(AccountHolder accountHolder, Account account)
 {
     MasterBank.currentBank.accounts.Add(account);
     MasterBank.currentBank.accountHolders.Add(accountHolder);
     MasterBank.SaveCurrentState();
 }
 public void AddServiceCharge()
 {
     MasterBank.SaveCurrentState();
 }
Пример #8
0
 public void AddEmployee(BankStaff bankStaff)
 {
     MasterBank.currentBank.bankStaffList.Add(bankStaff);
     MasterBank.SaveCurrentState();
 }