public void Transfer() { Console.WriteLine("Vui lòng nhập số tài khoản người nhận."); var receiverAccountNumber = Console.ReadLine(); var checkAc = model.GetByAccountNumber(receiverAccountNumber); Console.WriteLine("Full Name: " + checkAc.FullName); Console.WriteLine("Vui lòng nhập số tiền cần chuyển: "); var amount = Utility.GetDecimalNumber(); Console.WriteLine("Vui lòng nhập nội dung tin nhắn: "); var content = Console.ReadLine(); var historyTransaction = new YYTransaction() { Id = Guid.NewGuid().ToString(), Type = YYTransaction.TransactionType.TRANSFER, Amount = amount, Content = content, SenderAccountNumber = Program.currentLoggedInYyAccount.AccountNumber, ReceiverAccountNumber = receiverAccountNumber, Status = YYTransaction.ActiveStatus.DONE }; if (model.UpdateTranfers(Program.currentLoggedInYyAccount.AccountNumber, receiverAccountNumber, historyTransaction)) { Console.WriteLine("Giao dịch thành công!"); } else { Console.WriteLine("Giao dịch thất bại, vui lòng kiểm tra lại.!"); } }
public void Transfer() { Console.WriteLine("Transfer."); Console.WriteLine("---------------------------------"); Console.WriteLine("Please enter recever account number."); var receiverAccountNumber = Console.ReadLine(); var checkAc = model.GetByAccountNumber(receiverAccountNumber); if (checkAc == null) { Console.WriteLine("Account does not exist"); } Console.WriteLine("Full Name: " + checkAc.FullName); Console.WriteLine("Please enter amount to transfer: "); var amount = Utility.GetDecimalNumber(); if (amount > Program.currentLoggedInYyAccount.Balance) { Console.WriteLine("Input balances can not be executed. Please retype."); } Console.WriteLine("Please enter message content: "); var content = Console.ReadLine(); var historyTransaction = new YYTransaction() { Id = Guid.NewGuid().ToString(), Type = YYTransaction.TransactionType.TRANSFER, Amount = amount, Content = content, SenderAccountNumber = Program.currentLoggedInYyAccount.AccountNumber, ReceiverAccountNumber = receiverAccountNumber, Status = YYTransaction.ActiveStatus.DONE }; if (model.UpdateTranfers(Program.currentLoggedInYyAccount.AccountNumber, receiverAccountNumber, historyTransaction)) { Console.WriteLine("Transaction success!"); } else { Console.WriteLine("Transaction fails, please try again!"); } Program.currentLoggedInYyAccount = model.GetByAccountNumber(Program.currentLoggedInYyAccount.AccountNumber); Console.WriteLine("Current balance: " + Program.currentLoggedInYyAccount.Balance); }