예제 #1
0
        public void Login()
        {
            Console.WriteLine("Please enter Acount Number: ");
            string anumber = Console.ReadLine();

            Console.WriteLine("Please enter password: "******"Username or password false!");
            }
            else
            {
                {
                    while (true)
                    {
                        Console.WriteLine("-----------Welcome to SHB--------------");
                        Console.WriteLine("1, Account Information.");
                        Console.WriteLine("2, The amount in the account");
                        Console.WriteLine("3, Deposit into account.");
                        Console.WriteLine("4, Transfers.");
                        Console.WriteLine("5, Withdrawal");
                        Console.WriteLine("6, Transaction history.");
                        Console.WriteLine("7, Change history.");
                        Console.WriteLine("8, Log out.");
                        Console.WriteLine("---------------------------------------");
                        Console.WriteLine("Please enter choice: ");
                        int choice = Int32.Parse(Console.ReadLine());

                        switch (choice)
                        {
                        case 1:
                            DbConnection.Instance().CloseConnection();
                            Console.WriteLine("You choice acount information.");
                            YYAccount ac          = new YYAccount();
                            var       infoAccount = _model.GetByAccountNumber(anumber);
                            Console.WriteLine("Account Number: " + infoAccount.AccountNumber +
                                              ", User Name: " + infoAccount.UserName +
                                              ", Balance: " + infoAccount.Balance +
                                              ", Identity Card: " + infoAccount.IdentityCard +
                                              ", Full Name: " + infoAccount.FullName +
                                              "\n, Email: " + infoAccount.Email +
                                              ", Phone Number: " + infoAccount.PhoneNumber +
                                              ", Address: " + infoAccount.Address +
                                              ", Gender: " + infoAccount.Gender1()
                                              + ", Status: " + infoAccount.Status1());
                            Console.WriteLine("Do you want to change information(y/n): ");
                            string conts = Console.ReadLine();
                            switch (conts)
                            {
                            case "y":
                                ChangeAccount(anumber);
                                break;

                            case "n":
                                break;
                            }
                            break;

                        case 2:
                            Console.WriteLine("You choice the amount in the account");
                            DbConnection.Instance().CloseConnection();
                            var amount = _model.GetByAccountNumber(anumber);
                            Console.WriteLine("Account balance available is: " + amount.Balance);
                            break;

                        case 3:
                            Console.WriteLine("You choice deposit into account.");
                            DbConnection.Instance().CloseConnection();
                            DepositBalance(anumber);
                            break;

                        case 4:
                            Console.WriteLine("You choice transfers.");
                            DbConnection.Instance().CloseConnection();
                            Trasaction(anumber);
                            break;

                        case 5:
                            Console.WriteLine("You choice withdrawal");
                            DbConnection.Instance().CloseConnection();
                            WithdrawalBalance(anumber);
                            break;

                        case 6:
                            Console.WriteLine("You choice transaction history.");
                            DbConnection.Instance().CloseConnection();
                            Console.WriteLine("You choice transaction history.");
                            Console.WriteLine("{0,-10}{1,-20}{2,-20}{3,-10}{4,-20}{5,-30},{6,-20}", "Id", "Account Number",
                                              "Type", "Amount", "", "Trading account number", "Created Date");
                            List <YYTransactionHistory> list = _history.queryHistory(anumber);
                            foreach (var th in list)
                            {
                                Console.WriteLine("{0,-10}{1,-20}{2,-20}{3,-10}{4,-20}{5,-30},{6, -20}",
                                                  th.Id, th.AccountNumber, th.Type1(), th.Amount, "(VNĐ)", th.TradingAcountNumber1(), th.CreatedDate);
                            }
                            break;

                        case 7:
                            Console.WriteLine("You choice change history.");
                            DbConnection.Instance().CloseConnection();
                            Console.WriteLine("{0,-60}{1,-40}", "Account Number", "Content");
                            List <YYChangeHistory> list1 = _change.queryChange(anumber);
                            foreach (var ch in list1)
                            {
                                Console.WriteLine("{0,-60}{1,-40}", ch.AccountNumber, ch.Content);
                            }
                            break;

                        case 8:
                            Console.WriteLine("Log out.");
                            DbConnection.Instance().CloseConnection();
                            break;

                        default:
                            Console.WriteLine("You enter fails. Please enter again!");
                            break;
                        }

                        if (choice == 8)
                        {
                            break;
                        }
                    }
                }
            }
        }