コード例 #1
0
ファイル: Program.cs プロジェクト: TanJacks/BankingConsoleMVC
        private static void displayTransactionLog(Dictionary <string, string> args)
        {
            Account account;
            long    accountNumber = Convert.ToInt64(args["accountNumber"]);
            string  cacheKey;

            if (AccountManager.AccountExists(accountNumber))
            {
                account  = AccountManager.GetAccount(accountNumber);
                cacheKey = account.UserName + "/" + account.Password;
                if (Cache.Exists(cacheKey))
                {
                    Cache.Set(cacheKey, account, 30);
                    displayTransactions(account);
                    return;
                }
                else
                {
                    Console.WriteLine("Account is not logged in.");
                }
            }
            else
            {
                Console.WriteLine("Account does not exist.");
            }
            return;
        }
コード例 #2
0
        public static double?Balance(Dictionary <string, string> args)
        {
            Account account;
            long    accountNumber = Convert.ToInt64(args["accountNumber"]);
            string  cacheKey;

            if (AccountManager.AccountExists(accountNumber))
            {
                account  = AccountManager.GetAccount(accountNumber);
                cacheKey = account.UserName + "/" + account.Password;
                if (Cache.Exists(cacheKey))
                {
                    Cache.Set(cacheKey, account, 30);
                    return(account.Balance);
                }
                else
                {
                    Console.WriteLine("Account is not logged in.");
                }
            }
            else
            {
                Console.WriteLine("Account does not exist.");
            }
            return(null);
        }