protected void Page_Load(object sender, EventArgs e) { if (Session["ATM"] != null) { // Vi har en ATM atm = (ATM)Session["ATM"]; } else { Server.Transfer("WelcomePage.aspx"); } //PIN.Visible = false; //Button1.Visible = false; //Button2.Visible = false; //Button3.Visible = false; //Button4.Visible = false; //Button5.Visible = false; //Button6.Visible = false; //Button7.Visible = false; //Button8.Visible = false; //Button9.Visible = false; //Button10.Visible = false; //ButtonHashtag.Visible = false; //ButtonCancel.Visible = false; //ButtonConfirm.Visible = false; //Backspace.Visible = false; //// dropdown //lblInsertCard.Visible = true; //DropDownListCards.Visible = true; //lblWrongPIN.Visible = false; //// Reset header label //lblHeader.Text = "Ange din PIN-kod"; }
protected void Page_Load(object sender, EventArgs e) { if (Session["ATM"] != null) { // Vi har en ATM atm = (ATM)Session["ATM"]; } else { atm = new ATM(123456789); Session["ATM"] = atm; } // populate list of accounts. // clear first ListOfAccounts.Items.Clear(); try { foreach (var accountname in atm.GetHolderAccounts()) { ListOfAccounts.Items.Add(accountname); } } catch (Exception ex) { ListOfAccounts.Items.Clear(); ListOfAccounts.Items.Add(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["ATM"] != null) { // Vi har en ATM atm = (ATM)Session["ATM"]; } else { atm = new ATM(123456789); Session["ATM"] = atm; } }
private static void Run() { ATM atm = new ATM(1337); // Tests the auth bool authResult = atm.Authenticate("55555", 1111); Console.WriteLine($"Login attempt, Outcome: {authResult}"); //var res = atm.GetHolderAccounts(); //res.ForEach(Console.WriteLine); //Tests the withdrawal if (authResult == true) { try { int amount = 200; Console.WriteLine($"Balance before transaction " + atm.ViewConnectedAccountBalance()); Console.WriteLine($"Trying to withdraw {amount}:-"); atm.Withdraw(amount); Console.WriteLine($"Balance after transaction " + atm.ViewConnectedAccountBalance()); } catch (Exception ex) { Console.WriteLine(ex.Message); } } // Tests the transactions Console.WriteLine(System.Environment.NewLine + "Transaction on the account:"); List<String> latestTrans = atm.getFiveLatestTransactions("55555"); latestTrans.ForEach(Console.WriteLine); // Test the database //DbFacade dbFacade = new DbFacade(); //DateTime dt = dbFacade.MakeTransaction(); Console.WriteLine(""); var r = atm.GetHolderAccounts(); r.ForEach(Console.WriteLine); Console.WriteLine(""); atm.ViewBalance("55555"); }