private void btnEditAccount_Click(object sender, EventArgs e)
 {
     using (EditAccountDetails frmEdit = new EditAccountDetails(currentAccount.AccountNumber, currentCustomer.CustomerID))
     {
         frmEdit.ShowDialog();
         if (frmEdit.UpdateCustomer != null)
         {
             txtFirstName.Text = frmEdit.UpdateCustomer.FirstName;
             txtSurname.Text   = frmEdit.UpdateCustomer.Surname;
             txtEmail.Text     = frmEdit.UpdateCustomer.Email;
             txtPhone.Text     = frmEdit.UpdateCustomer.Phone;
             txtAddress1.Text  = frmEdit.UpdateCustomer.AddressLine1;
             txtAddress2.Text  = frmEdit.UpdateCustomer.AddressLine2;
             txtCounty.Text    = frmEdit.UpdateCustomer.County;
             txtCity.Text      = frmEdit.UpdateCustomer.City;
         }
     }
 }
        //Identify selected row value and open pre-populated form, EditAccountDetails
        private void editAccountToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataTable dTable = dgvAccounts.DataSource as DataTable;
            if (dTable != null && dTable.Rows.Count > 0)
            {
                DataGridViewRow dgvRow = dgvAccounts.CurrentRow;

                if (dgvRow != null)
                {
                    int AccountNumber = Convert.ToInt32(dgvRow.Cells[Convert.ToInt32(MainGridCloumns.AccountNumber)].Value);
                    int CustomerID = Convert.ToInt32(dgvRow.Cells[Convert.ToInt32(MainGridCloumns.CustomerID)].Value);
                    using (EditAccountDetails editAccount = new EditAccountDetails(AccountNumber, CustomerID))
                    {
                        editAccount.ShowDialog();
                    }
                    PrimeGrid();
                }
                else
                    MessageBox.Show("No Selection Made", "ERROR!");
            }
        }
예제 #3
0
        //Identify selected row value and open pre-populated form, EditAccountDetails
        private void editAccountToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataTable dTable = dgvAccounts.DataSource as DataTable;

            if (dTable != null && dTable.Rows.Count > 0)
            {
                DataGridViewRow dgvRow = dgvAccounts.CurrentRow;

                if (dgvRow != null)
                {
                    int AccountNumber = Convert.ToInt32(dgvRow.Cells[Convert.ToInt32(MainGridCloumns.AccountNumber)].Value);
                    int CustomerID    = Convert.ToInt32(dgvRow.Cells[Convert.ToInt32(MainGridCloumns.CustomerID)].Value);
                    using (EditAccountDetails editAccount = new EditAccountDetails(AccountNumber, CustomerID))
                    {
                        editAccount.ShowDialog();
                    }
                    PrimeGrid();
                }
                else
                {
                    MessageBox.Show("No Selection Made", "ERROR!");
                }
            }
        }
 private void btnEditAccount_Click(object sender, EventArgs e)
 {
     using (EditAccountDetails frmEdit = new EditAccountDetails(currentAccount.AccountNumber, currentCustomer.CustomerID))
     {
         frmEdit.ShowDialog();
         if (frmEdit.UpdateCustomer != null)
         {
             txtFirstName.Text = frmEdit.UpdateCustomer.FirstName;
             txtSurname.Text = frmEdit.UpdateCustomer.Surname;
             txtEmail.Text = frmEdit.UpdateCustomer.Email;
             txtPhone.Text = frmEdit.UpdateCustomer.Phone;
             txtAddress1.Text = frmEdit.UpdateCustomer.AddressLine1;
             txtAddress2.Text = frmEdit.UpdateCustomer.AddressLine2;
             txtCounty.Text = frmEdit.UpdateCustomer.County;
             txtCity.Text = frmEdit.UpdateCustomer.City;
         }
     }
 }