コード例 #1
0
            private void AutofillBtn_Click(object sender, EventArgs e)
            {
                if (RoutingNumberTxtBox.Enabled == false)
                {
                    // Unlock all of the textboxes
                    TextBox[] textBoxes = { FNameTxtBox, LNameTxtBox, AddressTxtBox, RoutingNumberTxtBox, AccNumberTxtBox, BankAddressTxtBox, BankNameTxtBox, PhoneNumberTxtBox };
                    foreach (var box in textBoxes)
                    {
                        box.Enabled = true;
                    }
                    AutofillBtn.Text = "Autofill";
                    ClearBtn.Enabled = true;
                    return;
                }
                var selecter = new Bounced_Check_Manager_UI_Layer.SelectAccount(AccNumberTxtBox.Text, FNameTxtBox.Text, LNameTxtBox.Text, PhoneNumberTxtBox.Text, AddressTxtBox.Text, RoutingNumberTxtBox.Text);
                selecter.ShowDialog();
                Account acc = selecter.returnAccount;
                if (acc != null)
                {
                    // Autofill values
                    FNameTxtBox.Text = acc.AccountFirstName;
                    LNameTxtBox.Text = acc.AccountLastName;
                    AddressTxtBox.Text = acc.AccountAddress;
                    PhoneNumberTxtBox.Text = acc.AccountPhoneNum.ToString();
                    Bank bank = acc.Bank;
                    BankAddressTxtBox.Text = bank.BankAddress;
                    BankNameTxtBox.Text = bank.BankName;
                    RoutingNumberTxtBox.Text = acc.AccountRoutingNum.ToString();
                    AccNumberTxtBox.Text = acc.AccountNum.ToString();

                    // Lock the text boxes
                    TextBox[] textBoxes = { FNameTxtBox, LNameTxtBox, AddressTxtBox, RoutingNumberTxtBox, AccNumberTxtBox, BankAddressTxtBox, BankNameTxtBox, PhoneNumberTxtBox, };
                    foreach (var box in textBoxes)
                    {
                        box.Enabled = false;
                    }
                    AutofillBtn.Text = "Unlock";
                    ClearBtn.Enabled = false;
                }
                else
                {
                    if (RoutingNumberTxtBox.Text != "")
                    {
                        int routNum = Convert.ToInt32(RoutingNumberTxtBox.Text);
                        Bank bank = Bounced_Check_Manager_Data_Layer.BankDAO.find(routNum);
                        if (bank != null)
                        {
                            BankAddressTxtBox.Text = bank.BankAddress;
                            BankNameTxtBox.Text = bank.BankName;
                            RoutingNumberTxtBox.Enabled = false;
                            BankAddressTxtBox.Enabled = false;
                            BankNameTxtBox.Enabled = false;
                            AutofillBtn.Text = "Unlock";
                            ClearBtn.Enabled = false;
                        }
                    }
                }
                return;
            }
コード例 #2
0
            private void AutofillBtn_Click(object sender, EventArgs e)
            {
                if (RoutingNumberTxtBox.Enabled == false)
                {
                    // Unlock all of the textboxes
                    TextBox[] textBoxes = { FNameTxtBox, LNameTxtBox, AddressTxtBox, RoutingNumberTxtBox, AccNumberTxtBox, BankAddressTxtBox, BankNameTxtBox, PhoneNumberTxtBox };
                    foreach (var box in textBoxes)
                    {
                        box.Enabled = true;
                    }
                    AutofillBtn.Text = "Autofill";
                    ClearBtn.Enabled = true;
                    return;
                }
                var selecter = new Bounced_Check_Manager_UI_Layer.SelectAccount(AccNumberTxtBox.Text, FNameTxtBox.Text, LNameTxtBox.Text, PhoneNumberTxtBox.Text, AddressTxtBox.Text, RoutingNumberTxtBox.Text);

                selecter.ShowDialog();
                Account acc = selecter.returnAccount;

                if (acc != null)
                {
                    // Autofill values
                    FNameTxtBox.Text       = acc.AccountFirstName;
                    LNameTxtBox.Text       = acc.AccountLastName;
                    AddressTxtBox.Text     = acc.AccountAddress;
                    PhoneNumberTxtBox.Text = acc.AccountPhoneNum.ToString();
                    Bank bank = acc.Bank;
                    BankAddressTxtBox.Text   = bank.BankAddress;
                    BankNameTxtBox.Text      = bank.BankName;
                    RoutingNumberTxtBox.Text = acc.AccountRoutingNum.ToString();
                    AccNumberTxtBox.Text     = acc.AccountNum.ToString();

                    // Lock the text boxes
                    TextBox[] textBoxes = { FNameTxtBox, LNameTxtBox, AddressTxtBox, RoutingNumberTxtBox, AccNumberTxtBox, BankAddressTxtBox, BankNameTxtBox, PhoneNumberTxtBox, };
                    foreach (var box in textBoxes)
                    {
                        box.Enabled = false;
                    }
                    AutofillBtn.Text = "Unlock";
                    ClearBtn.Enabled = false;
                }
                else
                {
                    if (RoutingNumberTxtBox.Text != "")
                    {
                        int  routNum = Convert.ToInt32(RoutingNumberTxtBox.Text);
                        Bank bank    = Bounced_Check_Manager_Data_Layer.BankDAO.find(routNum);
                        if (bank != null)
                        {
                            BankAddressTxtBox.Text      = bank.BankAddress;
                            BankNameTxtBox.Text         = bank.BankName;
                            RoutingNumberTxtBox.Enabled = false;
                            BankAddressTxtBox.Enabled   = false;
                            BankNameTxtBox.Enabled      = false;
                            AutofillBtn.Text            = "Unlock";
                            ClearBtn.Enabled            = false;
                        }
                    }
                }
                return;
            }