Beispiel #1
0
 // Save Button Click
 private void customerSaveButton_Click(object sender, EventArgs e)
 {
     // Check if inputs are valid
     if (validateInputs())
     {
         // attempt to save update customer entry
         try
         {
             // Pass data from form to update customer query
             DataInterface.updateCustomer(
                 Convert.ToInt32(customerIDTextBox.Text),
                 customerNameTextBox.Text,
                 customerAddressTextBox.Text,
                 customerCityTextBox.Text,
                 customerCountryTextBox.Text,
                 customerZipCodeTextBox.Text,
                 customerPhoneTextBox.Text,
                 customerActiveCheckBox.Checked,
                 customerAddress2TextBox.Text);
             DataInterface.DBClose();
             CustomerMainForm.editCustomer = this;
             customerForm.Show();
             CustomerMainForm.editCustomer.Close();
         }
         // Display message and cancel save if an exception rises
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             return;
         }
     }
 }