コード例 #1
0
        private void bnAddCustomer_Click(object sender, EventArgs e)
        {
            try
            {
                customerDialog.ClearDisplayItems();

                //BookShopControl.findDuplicateCustomers(customerDialog.UserName);
                switch (customerDialog.Display())
                {
                case DialogReturn.Cancel:
                    return;

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

                default:
                    return;
                }
            }
            catch (BookShopException bsex)
            {
                MessageBox.Show(this, bsex.ErrorMessage);
            }
        }
コード例 #2
0
 private void bnAddCustomer_Click(object sender, EventArgs e)
 {
     // XXX Register Button event handler
     customerDialog.ClearDisplayItems();
     if (customerDialog.Display() == DialogReturn.Cancel)
     {
         return;
     }
     // XXX pick up information from customerDialog by calling its properties
     // and register a new customer
     try
     {
         controller.RegisterNewCustomer(customerDialog.FirstName, customerDialog.LastName, customerDialog.UserName, customerDialog.Password, customerDialog.EMailAddress, customerDialog.Address, customerDialog.TelephoneNumber);
     }
     catch (BookShopException bsex)
     {
         MessageBox.Show(this, bsex.ErrorMessage);
     }
 }
コード例 #3
0
        private void bnAddCustomer_Click(object sender, EventArgs e)
        {
            try
            {
                // throw exception if the customer id is already registered
                // ZTM : Throws exception inside Control
                // XXX Register Button event handler

                customerDialog.ClearDisplayItems();

                switch (customerDialog.Display())
                {
                case DialogReturn.Cancel:
                    return;

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

                default:
                    return;
                }

                //if (customerDialog.Display() == DialogReturn.Cancel) return;
                //// XXX pick up information from customerDialog by calling its properties
                //// and register a new customer
                //if (customerDialog.Display() == DialogReturn.Done)
                //{
                //    _attachedControl.RegisterCustomer(customerDialog.FirstName, customerDialog.LastName, customerDialog.UserName, customerDialog.Password, customerDialog.EMailAddress, customerDialog.Address, Convert.ToInt32(customerDialog.TelephoneNumber));
                //}
            }
            catch (BookShopException bsex)
            {
                MessageBox.Show(this, bsex.ErrorMessage);
            }
        }