private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Text == "Main") { this.right_usercontrol = b; } else if (e.Node.Text.Equals("Withdraw")) { this.right_usercontrol = w; } else if (e.Node.Text.Equals("Transfer")) { this.right_usercontrol = t; } else if (e.Node.Text.Equals("Deposit")) { this.right_usercontrol = d; } this.right_usercontrol.Visible = false; this.mainPanel.Controls.Clear(); this.mainPanel.Controls.Add(this.right_usercontrol); this.right_usercontrol.Visible = true; }
void login_FormClosed(object sender, FormClosedEventArgs e) { if (login.DialogResult == DialogResult.OK) { // Populate toolbar with accounts List <String> accountNums = customer.AccountNumbers; foreach (String i in accountNums) { this.accountsComboBox.Items.Add(i); } this.right_usercontrol = b; // Default to the first account this.accountsComboBox.SelectedIndex = 0; // Display main user control this.mainPanel.Controls.Add(this.right_usercontrol); } else if (login.DialogResult == DialogResult.Cancel) { // They cancelled this.treeView1.Enabled = false; } }
// When they change the account from the dropdown private void accountsComboBox_SelectedIndexChanged(object sender, EventArgs e) { this.right_usercontrol = b; // Get what they changed it to String acctNum = this.accountsComboBox.Text; List <Account> accts = this.customer.Accounts; bool has_savings = false, has_checking = false; // Used for settings savings or checking to null foreach (Account i in accts) { if (i.AccountNumber.ToString() == acctNum) { if (i is SavingsAccount) { this.SAccount = (SavingsAccount)i; has_savings = true; } else if (i is CheckingAccount) { this.CAccount = (CheckingAccount)i; has_checking = true; } } } if (!has_checking) { this.CAccount = null; } if (!has_savings) { this.SAccount = null; } this.right_usercontrol.Visible = false; this.treeView1.SelectedNode = this.treeView1.Nodes[0]; this.right_usercontrol.Visible = true; }
// When they change the account from the dropdown private void accountsComboBox_SelectedIndexChanged(object sender, EventArgs e) { this.right_usercontrol = b; // Get what they changed it to String acctNum = this.accountsComboBox.Text; List<Account> accts = this.customer.Accounts; bool has_savings = false, has_checking = false; // Used for settings savings or checking to null foreach (Account i in accts) { if (i.AccountNumber.ToString() == acctNum) { if (i is SavingsAccount) { this.SAccount = (SavingsAccount)i; has_savings = true; } else if (i is CheckingAccount) { this.CAccount = (CheckingAccount)i; has_checking = true; } } } if (!has_checking) this.CAccount = null; if (!has_savings) this.SAccount = null; this.right_usercontrol.Visible = false; this.treeView1.SelectedNode = this.treeView1.Nodes[0]; this.right_usercontrol.Visible = true; }
void login_FormClosed(object sender, FormClosedEventArgs e) { if (login.DialogResult == DialogResult.OK) { // Populate toolbar with accounts List<String> accountNums = customer.AccountNumbers; foreach (String i in accountNums) { this.accountsComboBox.Items.Add(i); } this.right_usercontrol = b; // Default to the first account this.accountsComboBox.SelectedIndex = 0; // Display main user control this.mainPanel.Controls.Add(this.right_usercontrol); } else if (login.DialogResult == DialogResult.Cancel) { // They cancelled this.treeView1.Enabled = false; } }