Exemple #1
0
 // Cancel Button click
 private void customerCancelButton_Click(object sender, EventArgs e)
 {
     // Show CustomerMainForm, close this form
     DataInterface.DBClose();
     CustomerMainForm.editCustomer = this;
     customerForm.Show();
     CustomerMainForm.editCustomer.Close();
 }
Exemple #2
0
        // Customer Button Click
        private void mainCustomerButton_Click(object sender, EventArgs e)
        {
            // Open CustomerMainForm, hide this form, show CustomerMainForm
            CustomerMainForm customerForm = new CustomerMainForm();

            CustomerMainForm.mainForm = this;
            this.Hide();
            customerForm.Show();
        }
        // Save Button click
        private void customerSaveButton_Click(object sender, EventArgs e)
        {
            // Check if inputs are valid
            if (validateInputs())
            {
                // If valid, obtain data from form controls
                ID       = DataInterface.getNextID("customerId", "customer", DataInterface.getCustomerIDList());
                name     = customerNameTextBox.Text;
                address  = customerAddressTextBox.Text;
                address2 = customerAddress2TextBox.Text;
                city     = customerCityTextBox.Text;
                zipCode  = customerZipCodeTextBox.Text;
                country  = customerCountryTextBox.Text;
                phone    = customerPhoneTextBox.Text;
                active   = customerActiveCheckBox.Checked;

                // Send data to DataInterface to create new customer
                DataInterface.createCustomer(name, address, city, country, zipCode, phone, active, currentUser, address2);
                // Set CustomerMainForm's reference to this form, show CustomerMainForm, close this form
                CustomerMainForm.addCustomer = this;
                customerForm.Show();
                CustomerMainForm.addCustomer.Close();
            }
        }