Example #1
0
        private void bnEditSelfInfo_Click(object sender, EventArgs e)
        {
            // XXX Edit Self Info button event handler
            BookShopControl.populateCustomerDialog(customerDialog);

            try
            {
                if (BookShopControl.LoggedinCustomer != null)
                {
                    switch (customerDialog.Display())
                    {
                    case DialogReturn.Cancel:
                        return;

                    case DialogReturn.Done:
                        BookShopControl.editCurrentCustomer(customerDialog.FirstName, customerDialog.LastName,
                                                            customerDialog.UserName, customerDialog.Password, customerDialog.EMailAddress, customerDialog.Address, customerDialog.TelephoneNumber);
                        break;

                    default:
                        return;
                    }
                }
                else
                {
                    throw new BookShopException("There is no user logged in.");
                }
            }
            catch (BookShopException bsex)
            {
                MessageBox.Show(this, bsex.ErrorMessage);
            }
        }