Exemple #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            AltSourceCache.InitializeCache();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //initialize the cache
            //the cache will allow the user to create multiple accounts and interact
            //with those different accounts within the same program session
            //so, if a user creates user TEST, they could sign out and sign back in with
            //that account without haveing to recreate it or losing the transaction history from the program session
            AltSourceCache.InitializeCache();

            string command;
            bool   quitNow = false;

            while (!quitNow)
            {
                success = false;
                if (!loggedin)
                {
                    //if the user is not currently logged in, they can only log in or create a new user
                    Console.WriteLine(@"Please enter a command:
R = Register a new account
L = Login
Q = Quit");
                }
                else
                {
                    //user is logged in, allow them to interact with their account
                    Console.WriteLine(@"Please enter a command:

D = Deposit
W = Withdrawal
T = Transaction History
B = Account Balance
O = Logout
Q = Exit program");
                }
                command = Console.ReadLine();
                switch (command.ToUpper())
                {
                case "R":
                    //register
                    registerUser();
                    break;

                case "L":
                    //login
                    login();
                    break;

                case "O":
                    //logoff
                    currentUser = "";
                    loggedin    = false;
                    break;

                case "T":
                    //transactions
                    history();
                    break;

                case "D":
                    //deposit
                    deposit();
                    break;

                case "W":
                    //withdrawal
                    withdrawal();
                    break;

                case "B":
                    //current balanace
                    balance();
                    break;

                case "Q":
                    //Quit
                    quitNow = true;
                    break;

                default:
                    Console.WriteLine("Unknown Command " + command);
                    break;
                }
            }
        }