예제 #1
0
        private static void ViewAllTransfers()
        {
            List <Transfer> allTransfers = transferService.GetAllTransfers(UserService.GetUserId());

            allTransfers = allTransfers.OrderBy(m => m.transfer_ID).ToList();
            PrintTransfers(allTransfers);
            int transferToView = -1;

            if (!int.TryParse(Console.ReadLine(), out transferToView))
            {
                Console.Clear();
                Console.WriteLine("Invalid Input. Please enter only a number.");
                Console.WriteLine();
                SomethingWentWrong();
            }
            else if (transferToView > 0)
            {
                do
                {
                    Console.Clear();
                    PrintTransferDetails(allTransfers, transferToView);
                    Console.WriteLine();
                    Console.Write("Would you like to view another transfer? (Y/N) : ");
                    string Continue = Console.ReadLine().ToLower();
                    if (Continue == "n" || Continue == "no")
                    {
                        transferToView = 0;
                        Console.Clear();
                    }
                    else
                    {
                        PrintTransfers(allTransfers);
                        transferToView = int.Parse(Console.ReadLine());
                        Console.Clear();
                    }
                } while (transferToView > 0);
            }
            else
            {
                Console.Clear();
                MenuSelection();
            }
        }
예제 #2
0
        private void DisplayListOfTransfers()
        {
            Console.WriteLine("-------------------------------------------");
            Console.WriteLine(" Transfers ID      From/To        Amount   ");
            Console.WriteLine("-------------------------------------------");

            List <API_Transfer> usersTransfers = transferService.GetAllTransfers(UserService.UserId);

            List <API_User> userList = profileService.GetAllUsers();

            Dictionary <int, string> userDict =
                new Dictionary <int, string>();

            foreach (API_User user in userList)
            {
                userDict.Add(user.UserId, user.Username);
            }

            foreach (API_Transfer t in usersTransfers)
            {
                Console.WriteLine();
                Console.Write(t.TransferId + "\t\t");
                Console.Write("From: " + userDict[t.AccountFrom] + "/" + "To: " + userDict[t.AccountTo] + "\t");
                Console.Write("$" + t.Amount);
            }
            Console.WriteLine();

            Console.WriteLine("Please enter transfer ID to view details (0 to cancel):");
            int transferIdInput = int.Parse(Console.ReadLine());

            if (transferIdInput == 0)
            {
                //ShowMainMenu();
            }
            else
            {
                DisplaySpecificTransfer(transferIdInput, userDict);
            }
        }