private void btnUpdateCustomer_Click(object sender, EventArgs e)
        {
            Customer customerInfo = new Customer();

            customerInfo.Name       = txtUpdateName.Text;
            customerInfo.Address    = txtUpdateAddress.Text;
            customerInfo.Address2   = txtUpdateAddress2.Text;
            customerInfo.City       = txtUpdateCity.Text;
            customerInfo.Country    = txtUpdateCountry.Text;
            customerInfo.PostalCode = txtUpdatePostal.Text;
            customerInfo.Phone      = txtUpdatePhone.Text;
            customerInfo.countryId  = currentCountryId;
            customerInfo.cityId     = currentCityId;
            customerInfo.addressId  = currentAddressId;
            customerInfo.customerId = currentCustomerId;

            DialogResult confirmInsert = MessageBox.Show("Are you sure that you want to update this customer?", "Confirm?", MessageBoxButtons.YesNo);

            if (confirmInsert == DialogResult.Yes)
            {
                bool result = Controller.updateCustomer(customerInfo);
                if (result)
                {
                    MessageBox.Show($"Customer: {customerInfo.Name} has been successfully updated.");
                }
                else
                {
                    MessageBox.Show($"ERROR: Customer: {customerInfo.Name} has NOT been updated.");
                }

                UpdateCustomer updateCustomer = new UpdateCustomer();
                updateCustomer.Show();
                this.Dispose(false);
            }
        }
Exemple #2
0
        private void btnEditCustomer_Click(object sender, EventArgs e)
        {
            UpdateCustomer updateCustomer = new UpdateCustomer();

            updateCustomer.Show();
        }