public static void ShowAccountStatement() { string filePath = SearchAccount.SearchAccountInfo(); if (filePath != null) { SearchAccount.DisplayAccountDetails(filePath); string accountInfo = Utility.GenerateEmailBodyWithAccountInfo(filePath); string transactionInfo = Utility.GetLatestFiveTransaction(filePath); // Split account info to find the email id to which mail is supposed to be sent string[] accountInfoArray = accountInfo.Split('\n'); string[] emailLine = accountInfoArray[6].Split(' '); string sendTo = emailLine[1]; string emailBody = accountInfo + transactionInfo; Console.WriteLine(transactionInfo); Console.WriteLine("Email Statement (y/n)?"); string input = Console.ReadLine(); if (input.ToLower().Equals("y")) { Email.SendEmail(emailBody, sendTo); Console.WriteLine("Email sent successfully!..."); } } Console.WriteLine("Press any key to continue..."); Console.Read(); Console.Clear(); MainMenu.ShowMenu(); }
public static void DeleteUserAccount() { string filePath = SearchAccount.SearchAccountInfo(); if (filePath != null) { SearchAccount.DisplayAccountDetails(filePath); Console.WriteLine("Delete (y/n)?"); string input = Console.ReadLine(); if (input.ToLower().Equals("y")) { File.Delete(filePath); Console.WriteLine("Account Deleted!..."); Console.WriteLine("Press Enter to continue..."); Console.ReadLine(); } } Console.Clear(); MainMenu.ShowMenu(); }
/// <summary> /// A switch case in this method will decide what to show to the user based on the input, /// Respective methods will be called based on the input /// </summary> /// <param name="number">The Operation the user selects from the screen</param> private static void RedirectUser(int number) { switch (number) { case 1: CreateAccount.GetAccountInfoFromUser(); break; case 2: SearchAccount.DisplayAccountDetails(); break; case 3: Deposit.DepositAmount(); break; case 4: Withdraw.WithdrawAmount(); break; case 5: AccountStatement.ShowAccountStatement(); break; case 6: DeleteAccount.DeleteUserAccount(); break; case 7: Console.WriteLine("Exiting console..."); Environment.Exit(0); break; default: break; } }