Exemplo n.º 1
0
 public UserService(Bank bank)
 {
     this.bank = bank;
     db = bank.Database;
     authenticatedUsers.Add(new Guid("7ab37b8c-2e92-4493-a40c-8425750c3d59"), new LoginInfo() { LastActivity = DateTime.Now + TimeSpan.FromDays(1), User = db.InternetBankingUsers.First(), UID = new Guid("7ab37b8c-2e92-4493-a40c-8425750c3d59")});
     authenticatedUsers.Add(new Guid("c59b9bd7-ddc6-4cf6-9036-9c678b44e093"), new LoginInfo() { LastActivity = DateTime.Now + TimeSpan.FromDays(1), User = db.InternetBankingUsers.Where(u => u.Role.Name == "user").First(), UID = new Guid("c59b9bd7-ddc6-4cf6-9036-9c678b44e093") });
 }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     Bank bk = new Bank();
     string output = "Press 0 to use the ATM, press 1 to manage your account,press n to exit";
     while (true)
     {
         Show(output);
         string op = GetInput();
         if (op=="n")
         {
             break;
         }
         switch (op)
         {
             case ("0"):
                 {
                     string op_atm;
                     ATM atm = new ATM(bk);
                     while (true)
                     {
                         Show("input any key to use ATM or Press n to exit");
                         op_atm = GetInput();
                         if (op_atm == "n")
                         {
                             break;
                         }
                         else
                         {
                             atm.Transaction();
                         }
                     }
                 }
                 break;//ATM
             case ("1"):
                 {
                     string op_bank;
                     while (true)
                     {
                         Show("input any key to manage your account or Press n to exit");
                         op_bank = GetInput();
                         if (op_bank == "n")
                         {
                             break;
                         }
                         else
                         {
                             bk.init();
                         }
                     }
                 }
                 break;//Bank
             default:
                 break;
         }
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Bank fib = new Bank("First Investment Bank");
            IndividualCustomer pesho = new IndividualCustomer("Pesho");
            DepositAccount depositAccount = new DepositAccount(pesho, 2M, 0.05m);
            fib.AddCustomer(pesho);
            fib.AddAccount(depositAccount);

            depositAccount.Deposit(1000M);

            Console.WriteLine("Current blanace: " + depositAccount.Balance);

            Console.WriteLine("Interest amount: " + depositAccount.CalculateInterest(23));

            depositAccount.Withdraw(153.03M);
            Console.WriteLine("Current blanace: " + depositAccount.Balance);
        }
Exemplo n.º 4
0
        static void Main()
        {
            try
            {
                Bank myBank = new Bank();
                Random ranGen = new Random();
                for (int i = 0; i < 3; i++)
                {
                    myBank.Accounts.Add(new Loan(new Company("CheatInvestments Ltd", ranGen.Next(100000000, 1000000000).ToString()), 10m / 100, new DateTime(ranGen.Next(2012, 2014), ranGen.Next(1, 13), ranGen.Next(1, 29)), ranGen.Next(-10000, -1000)));
                    myBank.Accounts.Add(new Mortgage(new Person("Petar Penev", string.Format("{0}{1}", ranGen.Next(100000000, 1000000000), ranGen.Next(0, 10))), 10m / 100, new DateTime(2012, ranGen.Next(1, 13), ranGen.Next(1, 29)), ranGen.Next(-10000, -1000)));
                    myBank.Accounts.Add(new Deposit(new Company("GiveMeYourMoney Ltd", ranGen.Next(100000000, 1000000000).ToString()), 10m / 100, new DateTime(2012, ranGen.Next(1, 13), ranGen.Next(1, 29)), ranGen.Next(0, 10000)));
                }
                Console.WriteLine("My Bank:");
                Console.WriteLine(myBank);

                foreach (var account in myBank.Accounts)
                {
                    account.Deposit(ranGen.Next(100, 1001));
                }
                Console.WriteLine("We deposite some money:");
                Console.WriteLine(myBank);

                foreach (Deposit deposit in myBank.Accounts.Where(x => x is Deposit))
                {
                    deposit.Withdraw(ranGen.Next(5, 101));
                }
                Console.WriteLine("We withdraw some money:");
                Console.WriteLine(myBank);

                Console.WriteLine("We calculate some interests:");
                foreach (var account in myBank.Accounts)
                {
                    int months = ranGen.Next(1, 12);
                    Console.WriteLine();
                    Console.WriteLine("Calculated interest: {0} for months: {1}", account.CalcInterest(months), months);
                    account.Balance += account.CalcInterest(months);
                    Console.WriteLine("New saldo:");
                    Console.WriteLine(account);
                }
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }
        }
        static void Main()
        {
            Console.Title = "Welcome to the Bank of Kurtovo Konare";
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            var bank = new Bank {Accounts = Accounts()};

            foreach (var account in bank.Accounts)
            {
                account.DepositMoney(500m);
                account.WithdrawMoney(400m);

                Console.WriteLine("Interest amount is: " + account.InterestAmount(3));
                Console.Write("Press any key to continue: ");

                Console.ReadKey();
                Console.Clear();
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Bank   bank    = new Bank("Super_Igor");
            Client clients = new Client();

            int choose = 1;

            while (choose != 0)
            {
                Console.WriteLine("1. Добавить клиента\n2. Показать всех клиентов\n3. Выбрать клиента\n0. Выход");
                try
                {
                    choose = Int32.Parse(Console.ReadLine());
                    Console.Clear();
                }
                catch
                {
                    Console.WriteLine("Введите число");
                    Console.Clear();
                    continue;
                }
                switch (choose)
                {
                case 1:
                    clients = Terminal.RegistrationForm();
                    bank.AddClient(clients);
                    Console.Clear();
                    break;

                case 2:
                    Terminal.ShowAllInfo(bank);
                    break;

                case 3:
                    if (clients.FirstName == null)
                    {
                        Console.WriteLine("У вас нет пользователей!");
                        break;
                    }
                    int check;
                    while (true)
                    {
                        Terminal.ShowAllInfo(bank);
                        Console.Write("Выберите одного из пользователей: ");
                        try
                        {
                            check = Int32.Parse(Console.ReadLine());
                        }
                        catch
                        {
                            Console.Clear();
                            Console.WriteLine("Введите число");
                            continue;
                        }
                        if (check <= 0 || check > bank.RegisteredCount)
                        {
                            Console.Clear();
                            Console.WriteLine("Введите число еще раз!");
                            continue;
                        }
                        break;
                    }

                    Terminal.ShowClientInfo(bank, check - 1);
                    break;

                case 0:
                    return;

                default:
                    break;
                }
            }
            Console.Read();
        }