示例#1
0
        private void btnFindPersEmail_Click(object sender, EventArgs e)
        {
            try
            {
                Customer.CheckEmail(txtMail.Text);

                if (!myDatabase.IsEmailInDatabase(txtMail.Text))
                {
                    throw new ArgumentException("Customer Email not found");
                }

                Customer customer = myDatabase.FindCustomerByEmail(txtMail.Text);
                dataGridView2.Rows.Clear();
                dataGridView2.Rows.Add(
                    customer.CustomerID,
                    customer.FirstName,
                    customer.LastName,
                    customer.Email,
                    customer.AccountBalance,
                    customer.LastChange);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtMail.Clear();
            }
        }