예제 #1
0
        public static IAccount GetAccount(int account)
        {
            var accounts = ReadFileData.GetAllAccounts();

            var creditAccount = accounts.FirstOrDefault(a => a.Id == account);

            return(creditAccount);
        }
        public static Dictionary <string, string> GetStatistics()
        {
            var statistics = new Dictionary <string, string>();
            var accounts   = ReadFileData.GetAllAccounts();
            var customers  = ReadFileData.GetAllCustomers();
            var balance    = 0M;

            foreach (var account in accounts)
            {
                balance += account.Balance;
            }

            statistics.Add("numberOfAccounts", accounts.Count.ToString());
            statistics.Add("numberOfCustomers", customers.Count.ToString());
            statistics.Add("totalBalance", balance.ToString());

            return(statistics);
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.Clear();
            ReadFileData.ReadFileFromBankData();
            var bank = new Bank();

            try
            {
                RunProgram(bank);
            }
            catch (Exception e)
            {
                Console.WriteLine("Ett allvarligt fel uppstod. Tryck på ENTER för att fortsätta");
                Console.WriteLine(e);
                Console.ReadLine();
                Console.Clear();
                RunProgram(bank);
            }
        }
예제 #4
0
 public void GetBankData()
 {
     Accounts     = ReadFileData.GetAllAccounts();
     Customers    = ReadFileData.GetAllCustomers();
     TotalBalance = ReadFileData.GetTotalBalance();
 }