public void ShowUserDetails() { Console.Clear(); ReadAndWriteDataBase u = new ReadAndWriteDataBase(); Console.Write("{0}", "Your Account Number : "); u.Account_Number = Int64.Parse(Console.ReadLine()); u.Userdata(); }
public void TransferMoney() { Console.Clear(); Console.WriteLine("**** Banking System | Transfer Money ****\n"); Console.WriteLine("{0}", "Plese ReEnter your Account Number: "); User.Account_Number = Convert.ToInt64(Console.ReadLine()); User.Total_Balance = User.getBalance(); Console.Write("{0}", "Enter amount you want to transfer : "); Double TransferAmount = Double.Parse(Console.ReadLine()); if (TransferAmount <= User.Total_Balance) { ReadAndWriteDataBase Transfer = new ReadAndWriteDataBase(); Console.Write("{0}", "Enter Account Number where you want to transfer : "); Transfer.Account_Number = Int64.Parse(Console.ReadLine()); if (Transfer.ReadFromDatabase()) { Console.WriteLine("\n{0}", "The account number " + Transfer.Account_Number + " belongs to " + Transfer.Title + ". " + Transfer.FName); Console.Write("{0}", "Do you want to proceed with this transaction [y/n] "); char choice = Console.ReadLine()[0]; Console.WriteLine("\n"); if (choice == 'y' || choice == 'Y') { Console.WriteLine("Rs. " + TransferAmount + " has been successfully transfered to " + Transfer.Title + ". " + Transfer.FName + "[" + Transfer.Account_Number + "]"); User.UpdatePassbook(User.Account_Number, TransferAmount, "NEFT To " + Transfer.Account_Number); Transfer.UpdatePassbook(Transfer.Account_Number, TransferAmount, "NEFT From " + User.Account_Number); UpdatedBalance(); } else { Console.WriteLine("The transaction has been aborted!"); } } else { Console.WriteLine("\n"); Console.WriteLine("Sorry but the account number : " + Transfer.Account_Number + " does not exist in our database"); Console.WriteLine("Please check the account number and try again!"); } Transfer.CloseConnection(); } else { Console.WriteLine("\n"); Console.WriteLine("You don't have sufficient balance in your account to complete this transaction"); } }