Exemplo n.º 1
0
        private void btnPower_Click(object sender, EventArgs e)
        {
            Console.WriteLine("Power button clicked");
            System.Windows.Forms.DialogResult result;
            result = MessageBox.Show("Power down ATM?", "Power Down", MessageBoxButtons.YesNo,
                                     MessageBoxIcon.Question);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                BinaryAccountDAO.SaveAmounts(accounts);
                Close();
            }
            else //Admin decides to keep ATM running
            {
                btnPower.Hide();
                unlockMachineWithMsg("Power down sequence cancelled");
            }
        }
Exemplo n.º 2
0
        private void loadAccounts()
        {
            string[] userNames = { "StevenJones",
                                   "SusanMitchell",
                                   "JohnSmith",
                                   "CarolMichaels",
                                   "PaulGordon" };
            string[] pins = { "1111",
                              "2222",
                              "3333",
                              "4444",
                              "5555" };
            string[] accountNumbers = { "11111",
                                        "222222",
                                        "333333",
                                        "444444",
                                        "555555",
                                        "666666",
                                        "777777",
                                        "888888",
                                        "999999",
                                        "000000" };

            accounts = BinaryAccountDAO.GetAccountAmounts();
            if (accounts.Count == 0)
            {
                for (int k = 0; k < SIZE; k++)
                {
                    accounts.Add(new Account());
                }
            }
            int i = 0;
            int j = 0;

            foreach (Account account in accounts)
            {
                account.UserName        = userNames[i];
                account.Pin             = pins[i];
                account.CheckingAccount = accountNumbers[j++];
                account.SavingsAccount  = accountNumbers[j++];
                i++;
            }
        }